diff --git a/configs/310014.yaml.in b/configs/310014.yaml.in index 476e7ec17..1306f7d8e 100644 --- a/configs/310014.yaml.in +++ b/configs/310014.yaml.in @@ -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 diff --git a/configs/csfb.yaml.in b/configs/csfb.yaml.in index 56a18fd24..27a7ab363 100644 --- a/configs/csfb.yaml.in +++ b/configs/csfb.yaml.in @@ -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 diff --git a/configs/meson.build b/configs/meson.build index dd7eae14f..da7c21bc1 100644 --- a/configs/meson.build +++ b/configs/meson.build @@ -39,7 +39,7 @@ example_conf = ''' csfb.yaml volte.yaml vonr.yaml - minimal.yaml + slice.yaml srslte.yaml sample.yaml '''.split() diff --git a/configs/open5gs/amf.yaml.in b/configs/open5gs/amf.yaml.in index d9daedb0f..777d02f81 100644 --- a/configs/open5gs/amf.yaml.in +++ b/configs/open5gs/amf.yaml.in @@ -143,7 +143,7 @@ logger: # mnc: 70 # s_nssai: # - sst: 1 -# - sd: 010000 +# sd: 010000 # - plmn_id: # mcc: 901 # mnc: 70 diff --git a/configs/open5gs/meson.build b/configs/open5gs/meson.build index a4fe54978..11186bdb1 100644 --- a/configs/open5gs/meson.build +++ b/configs/open5gs/meson.build @@ -33,6 +33,7 @@ open5gs_conf = ''' udm.yaml udr.yaml pcf.yaml + nssf.yaml '''.split() foreach file : open5gs_conf diff --git a/configs/open5gs/nssf.yaml.in b/configs/open5gs/nssf.yaml.in new file mode 100644 index 000000000..e6674393d --- /dev/null +++ b/configs/open5gs/nssf.yaml.in @@ -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: +# +# +# +# o SBI Server(http://:80) +# sbi: +# +# o SBI Server(http://:80) +# sbi: +# - addr: +# - 0.0.0.0 +# - ::0 +# port: 7777 +# +# o SBI Server(https://: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://:80) +# sbi: +# dev: eth0 +# +nssf: + sbi: + - addr: 127.0.0.14 + port: 7777 + +# +# nrf: +# +# > +# +# 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: diff --git a/configs/open5gs/smf.yaml.in b/configs/open5gs/smf.yaml.in index 6c51748b7..8306e92ae 100644 --- a/configs/open5gs/smf.yaml.in +++ b/configs/open5gs/smf.yaml.in @@ -83,61 +83,48 @@ logger: # - addr: 127.0.0.4 # - addr: fe80::3%@loopback_devname@ # -# +# # # 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 +# # # # o Provisioning a limit on the size of the packets sent by the MS @@ -167,6 +160,136 @@ logger: # - 127.0.0.1 # - ::1 # +# +# 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 # -# +# # -# 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: diff --git a/configs/open5gs/upf.yaml.in b/configs/open5gs/upf.yaml.in index bbd6554a3..e7f70772f 100644 --- a/configs/open5gs/upf.yaml.in +++ b/configs/open5gs/upf.yaml.in @@ -81,19 +81,22 @@ logger: # advertise_name: upf1.5gc.mnc001.mcc001.3gppnetwork.org # # -# +# +# +# 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 diff --git a/configs/sample.yaml.in b/configs/sample.yaml.in index e5e721513..d1f29cf43 100644 --- a/configs/sample.yaml.in +++ b/configs/sample.yaml.in @@ -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 diff --git a/configs/minimal.yaml.in b/configs/slice.yaml.in similarity index 89% rename from configs/minimal.yaml.in rename to configs/slice.yaml.in index f02d6b9e4..f25bab88f 100644 --- a/configs/minimal.yaml.in +++ b/configs/slice.yaml.in @@ -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 diff --git a/configs/srslte.yaml.in b/configs/srslte.yaml.in index cbf102c86..c132fe565 100644 --- a/configs/srslte.yaml.in +++ b/configs/srslte.yaml.in @@ -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 diff --git a/configs/systemd/meson.build b/configs/systemd/meson.build index 1650c3ca3..8b0cf3422 100644 --- a/configs/systemd/meson.build +++ b/configs/systemd/meson.build @@ -28,6 +28,7 @@ systemd_conf_in = ''' open5gs-ausfd.service open5gs-udmd.service open5gs-pcfd.service + open5gs-nssfd.service open5gs-udrd.service '''.split() diff --git a/configs/systemd/open5gs-nssfd.service.in b/configs/systemd/open5gs-nssfd.service.in new file mode 100644 index 000000000..1d03925a2 --- /dev/null +++ b/configs/systemd/open5gs-nssfd.service.in @@ -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 diff --git a/configs/volte.yaml.in b/configs/volte.yaml.in index d63ce15d9..0c9c0db34 100644 --- a/configs/volte.yaml.in +++ b/configs/volte.yaml.in @@ -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 diff --git a/configs/vonr.yaml.in b/configs/vonr.yaml.in index 2a2fc69e8..cd25bb7b9 100644 --- a/configs/vonr.yaml.in +++ b/configs/vonr.yaml.in @@ -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 diff --git a/debian/changelog b/debian/changelog index 6b6b9c593..ad0e1f1c9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +open5gs (2.2.0) unstable; urgency=medium + + * New function: NSSF + + -- Sukchan Lee Mon, 08 Mar 2021 14:14:41 +0900 + open5gs (2.1.7) unstable; urgency=medium * Bug Fixed diff --git a/debian/control b/debian/control index 5e2be55ad..65bc02c47 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/debian/open5gs-common.install b/debian/open5gs-common.install index ef50a9ca3..31a4e591a 100644 --- a/debian/open5gs-common.install +++ b/debian/open5gs-common.install @@ -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 diff --git a/debian/open5gs-nssf.install b/debian/open5gs-nssf.install new file mode 100644 index 000000000..17541af1d --- /dev/null +++ b/debian/open5gs-nssf.install @@ -0,0 +1,3 @@ +usr/bin/open5gs-nssfd +configs/open5gs/nssf.yaml etc/open5gs +configs/systemd/open5gs-nssfd.service lib/systemd/system diff --git a/docs/_docs/guide/01-quickstart.md b/docs/_docs/guide/01-quickstart.md index 8b857513d..156bf75db 100644 --- a/docs/_docs/guide/01-quickstart.md +++ b/docs/_docs/guide/01-quickstart.md @@ -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 @@ -463,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 ``` @@ -480,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 ``` diff --git a/docs/_docs/guide/02-building-open5gs-from-sources.md b/docs/_docs/guide/02-building-open5gs-from-sources.md index a7722b93d..5a12c2970 100644 --- a/docs/_docs/guide/02-building-open5gs-from-sources.md +++ b/docs/_docs/guide/02-building-open5gs-from-sources.md @@ -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) diff --git a/docs/_docs/guide/03-splitting-network-functions.md b/docs/_docs/guide/03-splitting-network-functions.md index ff502249d..cd5a03964 100644 --- a/docs/_docs/guide/03-splitting-network-functions.md +++ b/docs/_docs/guide/03-splitting-network-functions.md @@ -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 diff --git a/docs/_docs/platform/02-centos.md b/docs/_docs/platform/02-centos.md index afaa5aa28..7be9828f5 100644 --- a/docs/_docs/platform/02-centos.md +++ b/docs/_docs/platform/02-centos.md @@ -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 diff --git a/docs/_docs/platform/03-fedora.md b/docs/_docs/platform/03-fedora.md index f269e7bd0..854e99e11 100644 --- a/docs/_docs/platform/03-fedora.md +++ b/docs/_docs/platform/03-fedora.md @@ -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} diff --git a/docs/_docs/platform/05-macosx-apple-silicon.md b/docs/_docs/platform/05-macosx-apple-silicon.md index 054e47a7d..152251150 100644 --- a/docs/_docs/platform/05-macosx-apple-silicon.md +++ b/docs/_docs/platform/05-macosx-apple-silicon.md @@ -80,7 +80,7 @@ $ sudo sh -c "echo 'nat on {en0} from cafe::1/64 to any -> {en0}' > /etc/pf.anch $ 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} diff --git a/docs/_docs/platform/06-macosx-intel.md b/docs/_docs/platform/06-macosx-intel.md index 6f4fdda34..49c759c01 100644 --- a/docs/_docs/platform/06-macosx-intel.md +++ b/docs/_docs/platform/06-macosx-intel.md @@ -80,7 +80,7 @@ $ sudo sh -c "echo 'nat on {en0} from cafe::1/64 to any -> {en0}' > /etc/pf.anch $ 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} diff --git a/docs/_docs/platform/07-freebsd.md b/docs/_docs/platform/07-freebsd.md index 74a571901..edc6686c2 100644 --- a/docs/_docs/platform/07-freebsd.md +++ b/docs/_docs/platform/07-freebsd.md @@ -97,7 +97,7 @@ $ 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/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} diff --git a/docs/_docs/troubleshoot/01-simple-issues.md b/docs/_docs/troubleshoot/01-simple-issues.md index eecfd6bf9..1d5504960 100644 --- a/docs/_docs/troubleshoot/01-simple-issues.md +++ b/docs/_docs/troubleshoot/01-simple-issues.md @@ -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 ``` diff --git a/docs/_docs/troubleshoot/02-now-in-github-issues.md b/docs/_docs/troubleshoot/02-now-in-github-issues.md index fa303b119..ab5688077 100644 --- a/docs/_docs/troubleshoot/02-now-in-github-issues.md +++ b/docs/_docs/troubleshoot/02-now-in-github-issues.md @@ -64,6 +64,7 @@ $ open5gs-amfd $ open5gs-ausfd $ open5gs-udmd $ open5gs-pcfd +$ open5gs-nssfd $ open5gs-udrd ``` @@ -268,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 ``` @@ -706,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 @@ -744,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 ``` diff --git a/docs/_docs/tutorial/01-your-first-lte.md b/docs/_docs/tutorial/01-your-first-lte.md index 7bcf9ed58..a49594230 100644 --- a/docs/_docs/tutorial/01-your-first-lte.md +++ b/docs/_docs/tutorial/01-your-first-lte.md @@ -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 diff --git a/docs/_pages/about.md b/docs/_pages/about.md index 4b81dcdc8..3dd8bc110 100644 --- a/docs/_pages/about.md +++ b/docs/_pages/about.md @@ -21,7 +21,6 @@ Open5GS is a C-language Open Source implementation of 5GC and EPC, i.e. the core #### Known Limitations --- -- No NSSF - No VoNR(Voice over NR) - No Interworking with EPC - No NB-IoT diff --git a/lib/app/ogs-app.h b/lib/app/ogs-app.h index a034f7272..40f62c72a 100644 --- a/lib/app/ogs-app.h +++ b/lib/app/ogs-app.h @@ -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); diff --git a/lib/app/ogs-context.h b/lib/app/ogs-context.h index 739cc8823..f35e2972b 100644 --- a/lib/app/ogs-context.h +++ b/lib/app/ogs-context.h @@ -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; diff --git a/lib/core/ogs-3gpp-types.c b/lib/core/ogs-3gpp-types.c index bc06fff8f..1301273cd 100644 --- a/lib/core/ogs-3gpp-types.c +++ b/lib/core/ogs-3gpp-types.c @@ -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]); } diff --git a/lib/core/ogs-3gpp-types.h b/lib/core/ogs-3gpp-types.h index 142b086d4..fb9c41835 100644 --- a/lib/core/ogs-3gpp-types.h +++ b/lib/core/ogs-3gpp-types.h @@ -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); diff --git a/lib/dbi/session.c b/lib/dbi/session.c index 02cb689d2..a0a831522 100644 --- a/lib/dbi/session.c +++ b/lib/dbi/session.c @@ -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); diff --git a/lib/dbi/session.h b/lib/dbi/session.h index 4ec1a31fd..17e4ddd3e 100644 --- a/lib/dbi/session.h +++ b/lib/dbi/session.h @@ -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 diff --git a/lib/dbi/subscription.c b/lib/dbi/subscription.c index c551de3f7..e4e9bfa36 100644 --- a/lib/dbi/subscription.c +++ b/lib/dbi/subscription.c @@ -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; } } diff --git a/lib/gtp/conv.c b/lib/gtp/conv.c index 6d4eb8e99..8bdb80375 100644 --- a/lib/gtp/conv.c +++ b/lib/gtp/conv.c @@ -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); diff --git a/lib/nas/5gs/decoder.c b/lib/nas/5gs/decoder.c index 7609eb390..f6048524a 100644 --- a/lib/nas/5gs/decoder.c +++ b/lib/nas/5gs/decoder.c @@ -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 ******************************************************************************/ diff --git a/lib/nas/5gs/encoder.c b/lib/nas/5gs/encoder.c index de0d4a722..9b9061563 100644 --- a/lib/nas/5gs/encoder.c +++ b/lib/nas/5gs/encoder.c @@ -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 ******************************************************************************/ diff --git a/lib/nas/5gs/ies.c b/lib/nas/5gs/ies.c index e0bdb344d..fce11cc1f 100644 --- a/lib/nas/5gs/ies.c +++ b/lib/nas/5gs/ies.c @@ -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); diff --git a/lib/nas/5gs/ies.h b/lib/nas/5gs/ies.h index 17a3b3654..e711a96f4 100644 --- a/lib/nas/5gs/ies.h +++ b/lib/nas/5gs/ies.h @@ -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 ******************************************************************************/ diff --git a/lib/nas/5gs/message.h b/lib/nas/5gs/message.h index 6005dfd22..4bf81fbd9 100644 --- a/lib/nas/5gs/message.h +++ b/lib/nas/5gs/message.h @@ -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 ******************************************************************************/ diff --git a/lib/nas/5gs/support/type-list.py b/lib/nas/5gs/support/type-list.py index bac40a083..9022924ef 100644 --- a/lib/nas/5gs/support/type-list.py +++ b/lib/nas/5gs/support/type-list.py @@ -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" diff --git a/lib/nas/5gs/types.c b/lib/nas/5gs/types.c index 365d756a2..149509053 100644 --- a/lib/nas/5gs/types.c +++ b/lib/nas/5gs/types.c @@ -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; diff --git a/lib/nas/5gs/types.h b/lib/nas/5gs/types.h index 3a125ecf3..1d2083b87 100644 --- a/lib/nas/5gs/types.h +++ b/lib/nas/5gs/types.h @@ -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; diff --git a/lib/nas/common/types.c b/lib/nas/common/types.c index 717190609..7dbf509d2 100644 --- a/lib/nas/common/types.c +++ b/lib/nas/common/types.c @@ -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; } diff --git a/lib/nas/common/types.h b/lib/nas/common/types.h index 64eb0f036..8d44d73c1 100644 --- a/lib/nas/common/types.h +++ b/lib/nas/common/types.h @@ -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( diff --git a/lib/pfcp/context.c b/lib/pfcp/context.c index c9e4f4bae..16efd681f 100644 --- a/lib/pfcp/context.c +++ b/lib/pfcp/context.c @@ -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) diff --git a/lib/pfcp/conv.c b/lib/pfcp/conv.c index 7da5d7269..096b771c4 100644 --- a/lib/pfcp/conv.c +++ b/lib/pfcp/conv.c @@ -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); diff --git a/lib/sbi/context.c b/lib/sbi/context.c index fae858b05..8096d53ef 100644 --- a/lib/sbi/context.c +++ b/lib/sbi/context.c @@ -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)); } } diff --git a/lib/sbi/context.h b/lib/sbi/context.h index 7cd5ce854..42287593c 100644 --- a/lib/sbi/context.h +++ b/lib/sbi/context.h @@ -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); diff --git a/lib/sbi/conv.c b/lib/sbi/conv.c index da11db782..c39270163 100644 --- a/lib/sbi/conv.c +++ b/lib/sbi/conv.c @@ -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]; @@ -515,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); @@ -531,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; } @@ -541,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); diff --git a/lib/sbi/conv.h b/lib/sbi/conv.h index cea71d589..b083dc5b0 100644 --- a/lib/sbi/conv.h +++ b/lib/sbi/conv.h @@ -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); diff --git a/lib/sbi/message.c b/lib/sbi/message.c index 9e3d55769..eb17561f1 100644 --- a/lib/sbi/message.c +++ b/lib/sbi/message.c @@ -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) @@ -242,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); @@ -266,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; @@ -295,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); @@ -374,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), @@ -413,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; } @@ -421,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); + } + } } } @@ -744,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) { @@ -1369,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) diff --git a/lib/sbi/message.h b/lib/sbi/message.h index 19603adb5..b3b299947 100644 --- a/lib/sbi/message.h +++ b/lib/sbi/message.h @@ -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; diff --git a/lib/sbi/nnrf-build.c b/lib/sbi/nnrf-build.c index 973504140..c6eed2053 100644 --- a/lib/sbi/nnrf-build.c +++ b/lib/sbi/nnrf-build.c @@ -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,45 +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_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; diff --git a/lib/sbi/nnrf-build.h b/lib/sbi/nnrf-build.h index 2272b5bbe..567b3e4ff 100644 --- a/lib/sbi/nnrf-build.h +++ b/lib/sbi/nnrf-build.h @@ -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( diff --git a/lib/sbi/nnrf-handler.c b/lib/sbi/nnrf-handler.c index 61a166fcc..b182e83dd 100644 --- a/lib/sbi/nnrf-handler.c +++ b/lib/sbi/nnrf-handler.c @@ -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; } diff --git a/lib/sbi/ogs-sbi.h b/lib/sbi/ogs-sbi.h index bb63bbb82..d6c5648fd 100644 --- a/lib/sbi/ogs-sbi.h +++ b/lib/sbi/ogs-sbi.h @@ -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" diff --git a/lib/sbi/openapi/meson.build b/lib/sbi/openapi/meson.build index 02531d1e9..6194aa1e9 100644 --- a/lib/sbi/openapi/meson.build +++ b/lib/sbi/openapi/meson.build @@ -20,572 +20,295 @@ libsbi_openapi_sources = files(''' src/apiKey.c src/binary.c external/cJSON.c - model/object.c + + model/access_and_mobility_data.c + model/access_and_mobility_subscription_data.c + model/access_network_id.c + model/access_right_status.c + model/access_tech.c model/access_type.c - model/amf_cond.c - model/amf_info.c - model/atsss_capability.c - model/ausf_info.c - model/bsf_info.c - model/change_item.c - model/change_type.c - model/chf_info.c - model/chf_service_info.c - model/data_set_id.c - model/default_notification_subscription.c - model/dnn_smf_info_item.c - model/dnn_upf_info_item.c - model/event_id.c - model/guami.c - model/guami_list_cond.c - model/identity_range.c - model/inline_response_200.c - model/interface_upf_info_item.c - model/invalid_param.c - model/ip_end_point.c - model/ipv4_address_range.c - model/ipv6_prefix_range.c - model/link.c - model/links_value_schema.c - model/n1_message_class.c - model/n2_information_class.c - model/n2_interface_amf_info.c - model/network_slice_cond.c - model/nf_group_cond.c - model/nf_instance_id_cond.c - model/nf_profile.c - model/nf_service.c - model/nf_service_status.c - model/nf_service_version.c - model/nf_status.c - model/nf_type.c - model/nf_type_cond.c - model/notif_condition.c - model/notification_data.c - model/notification_event_type.c - model/notification_type.c - model/nrf_info.c - model/nwdaf_event.c - model/nwdaf_info.c - model/patch_item.c - model/patch_operation.c - model/pcf_info.c - model/pdu_session_type.c - model/plmn_id.c - model/plmn_range.c - model/plmn_snssai.c - model/problem_details.c - model/service_name_cond.c - model/smf_info.c - model/snssai.c - model/snssai_smf_info_item.c - model/snssai_upf_info_item.c - model/subscription_data.c - model/supi_range.c - model/tac_range.c - model/tai.c - model/tai_range.c - model/transport_protocol.c - model/udm_info.c - model/udr_info.c - model/up_interface_type.c - model/upf_info.c - model/uri_scheme.c - - model/atom.c - model/cnf.c - model/cnf_unit.c - model/complex_query.c - model/dnf.c - model/dnf_unit.c - model/search_result.c - model/stored_search_result.c - + model/acc_net_charging_address.c + model/acc_net_ch_id.c + model/accu_usage_report.c + model/acknowledge_info.c + model/acs_info.c + model/acs_info_rm.c + model/additional_access_info.c + model/additional_qos_flow_info.c + model/additional_snssai_data.c model/af_event.c model/af_event_exposure_data.c + model/af_external.c + model/af_sig_protocol.c + model/allowed_nssai.c + model/allowed_snssai.c + model/alternative_qos_profile.c + model/ambr.c + model/ambr_rm.c + model/amf3_gpp_access_registration.c + model/amf3_gpp_access_registration_modification.c + model/amf_cond.c + model/amf_dereg_info.c + model/amf_event_area.c + model/amf_event.c + model/amf_event_mode.c + model/amf_event_subscription.c + model/amf_event_trigger.c + model/amf_event_type.c + model/amf_info.c + model/amf_non3_gpp_access_registration.c + model/amf_non3_gpp_access_registration_modification.c + model/amf_status_change_notification.c + model/amf_status_change_subscription_data.c + model/amf_status_info.c + model/amf_subscription_info.c + model/am_policy_data.c + model/an_gw_address.c model/an_node_type.c - model/external_client_type.c - model/gmlc_info.c - model/hss_info.c - model/imsi_range.c - model/internal_group_id_range.c - model/lmf_info.c - model/nef_info.c - model/nf_info.c - model/nf_service_set_cond.c - model/nf_set_cond.c - model/pcscf_info.c - model/pfd_data.c - model/plmn_id_nid.c - model/preferred_search.c - model/rat_type.c - model/tngf_info.c - model/twif_info.c - model/udsf_info.c - model/upf_cond.c - model/vendor_specific_feature.c - model/w_agf_info.c - - model/auth_result.c - model/auth_type.c + model/apn_rate_status.c + model/app_descriptor.c + model/app_detection_info.c + model/application_data_change_notif.c + model/application_data_subs.c + model/app_port_id.c + model/area.c + model/area_of_validity.c + model/area_scope.c + model/arp.c + model/assign_ebi_data.c + model/assign_ebi_error.c + model/assign_ebi_failed.c + model/assigned_ebi_data.c + model/association_type.c + model/atom.c + model/atsss_capability.c + model/ausf_info.c model/authentication_info.c - model/av5g_aka.c - model/confirmation_data.c - model/confirmation_data_response.c - model/eap_session.c - model/resynchronization_info.c - model/rg_auth_ctx.c - model/rg_authentication_info.c - model/trace_data.c - model/trace_depth.c - model/ue_authentication_ctx.c - - model/auth_event.c model/authentication_info_request.c model/authentication_info_result.c + model/authentication_subscription.c model/authentication_vector.c + model/auth_event.c + model/auth_method.c + model/authorization_data.c + model/authorized_default_qos.c + model/authorized_network_slice_info.c + model/auth_result.c + model/auth_type.c + model/av5g_aka.c model/av5_g_he_aka.c model/av_eap_aka_prime.c model/av_eps_aka.c model/av_ims_gba_eap_aka.c model/av_type.c - model/hss_auth_type.c - model/hss_authentication_info_request.c - model/hss_authentication_info_result.c - model/hss_authentication_vectors.c - model/hss_av_type.c - - model/amf3_gpp_access_registration.c - model/amf3_gpp_access_registration_modification.c - model/amf_dereg_info.c - model/amf_non3_gpp_access_registration.c - model/amf_non3_gpp_access_registration_modification.c model/backup_amf_info.c - model/cm_info.c - model/cm_info_report.c - model/cm_state.c - model/deregistration_data.c - model/deregistration_reason.c - model/eps_interworking_info.c - model/eps_iwk_pgw.c - model/ims_vo_ps.c - model/location_info.c - model/network_node_diameter_address.c - model/patch_result.c - model/pcscf_restoration_notification.c - model/pei_update_info.c - model/registration_reason.c - model/report_item.c - model/smf_registration.c - model/smf_registration_info.c - model/smsf_registration.c - model/trigger_request.c - model/vgmlc_address.c - - model/access_and_mobility_subscription_data.c - model/access_tech.c - model/acknowledge_info.c - model/acs_info.c - model/additional_snssai_data.c - model/af_external.c - model/af_non_external.c - model/ambr.c - model/ambr_rm.c - model/app_descriptor.c - model/app_port_id.c - model/area.c - model/arp.c model/battery_indication.c - model/cag_data.c - model/cag_info.c - model/civic_address.c - model/code_word_ind.c - model/core_network_type.c - model/data_set_name.c - model/dnn_configuration.c - model/dnn_info.c - model/ec_restriction_data.c - model/ecgi.c - model/edrx_parameters.c - model/ellipsoid_arc.c - model/ellipsoid_arc_all_of.c - model/emergency_info.c - model/enhanced_coverage_restriction_data.c - model/expected_ue_behaviour_data.c - model/external_unrelated_class.c - model/frame_route_info.c - model/g_nb_id.c - model/gad_shape.c - model/geographic_area.c - model/geographical_coordinates.c - model/global_ran_node_id.c - model/group_identifiers.c - model/id_translation_result.c - model/ip_address.c - model/lcs_client_class.c - model/lcs_client_external.c - model/lcs_client_group_external.c - model/lcs_client_non_external.c - model/lcs_mo_data.c - model/lcs_mo_service_class.c - model/lcs_privacy_data.c - model/location_area.c - model/location_privacy_ind.c - model/lpi.c - model/lte_v2x_auth.c - model/maximum_latency.c - model/maximum_response_time.c - model/modification_notification.c - model/ncgi.c - model/network_area_info.c - model/nidd_information.c - model/non_external_unrelated_class.c - model/notify_item.c - model/nr_v2x_auth.c - model/nssai.c - model/null_value.c - model/odb_packet_services.c - model/operation_mode.c - model/pdu_session.c - model/pdu_session_continuity_ind.c - model/pdu_session_types.c - model/pgw_info.c - model/plmn_ec_info.c - model/plmn_operator_class.c - model/point.c - model/point_all_of.c - model/point_altitude.c - model/point_altitude_all_of.c - model/point_altitude_uncertainty.c - model/point_altitude_uncertainty_all_of.c - model/point_uncertainty_circle.c - model/point_uncertainty_circle_all_of.c - model/point_uncertainty_ellipse.c - model/point_uncertainty_ellipse_all_of.c - model/polygon.c - model/polygon_all_of.c - model/preemption_capability.c - model/preemption_vulnerability.c - model/privacy_check_related_action.c - model/ptw_parameters.c - model/restriction_type.c - model/scheduled_communication_time.c - model/scheduled_communication_type.c - model/sdm_subs_modification.c - model/sdm_subscription.c - model/service_area_restriction.c - model/service_type_unrelated_class.c - model/session_management_subscription_data.c - model/shared_data.c - model/smf_selection_subscription_data.c - model/sms_management_subscription_data.c - model/sms_subscription_data.c - model/smsf_info.c - model/snssai_info.c - model/sor_info.c - model/sor_update_indicator.c - model/sor_update_info.c - model/ssc_mode.c - model/ssc_modes.c - model/stationary_indication.c - model/steering_container.c - model/steering_info.c - model/subscribed_default_qos.c - model/subscription_data_sets.c - model/suggested_packet_num_dl.c - model/supported_gad_shapes.c - model/tmbr.c - model/trace_data_response.c - model/traffic_profile.c - model/ue_auth.c - model/ue_context_in_smf_data.c - model/ue_context_in_smsf_data.c - model/ue_id.c - model/uncertainty_ellipse.c - model/unrelated_class.c - model/up_confidentiality.c - model/up_integrity.c - model/up_security.c - model/upu_data.c - model/upu_info.c - model/valid_time_period.c - model/vn_group_data.c - - model/access_and_mobility_data.c - model/acs_info_rm.c - model/amf_subscription_info.c - model/association_type.c - model/auth_method.c - model/authentication_subscription.c - model/authorization_data.c - model/battery_indication_rm.c - model/cag_ack_data.c - model/communication_characteristics.c - model/data_change_notify.c - model/datalink_reporting_configuration.c - model/ddd_traffic_descriptor.c - model/dl_data_delivery_status.c - model/domain_name_protocol.c - model/ec_restriction.c - model/ee_profile_data.c - model/ee_subscription.c - model/eutra_location.c - model/event_report_mode.c - model/event_type.c - model/expected_ue_behaviour.c - model/exposure_data_change_notification.c - model/exposure_data_subscription.c - model/hfc_node_id.c - model/identity_data.c - model/lcs_privacy.c - model/location_accuracy.c - model/location_reporting_configuration.c - model/model_5_g_vn_group_configuration.c - model/model_5_g_vn_group_data.c - model/monitoring_configuration.c - model/n3ga_location.c - model/nr_location.c - model/nssai_ack_data.c - model/odb_data.c - model/operator_specific_data_container.c - model/pdu_session_management_data.c - model/pdu_session_status.c - model/pfd_content.c - model/pfd_data_for_app.c - model/pfd_data_for_app_ext.c - model/pfd_data_for_app_ext_all_of.c - model/pp_active_time.c - model/pp_data.c - model/pp_dl_packet_count_ext.c - model/pp_maximum_latency.c - model/pp_maximum_response_time.c - model/pp_subs_reg_timer.c - model/problem_details_2.c - model/provisioned_data_sets.c - model/reporting_options.c - model/rm_info.c - model/rm_state.c - model/roaming_odb.c - model/route_information.c - model/route_to_location.c - model/scheduled_communication_time_rm.c - model/scheduled_communication_type_rm.c - model/sequence_number.c - model/sign.c - model/sms_support.c - model/sor_data.c - model/sqn_scheme.c - model/stationary_indication_rm.c - model/subscription_data_subscriptions.c - model/traffic_profile_rm.c - model/ue_reachability.c - model/ue_update_status.c - model/upu_data_2.c - model/user_identifier.c - model/user_location.c - - model/access_right_status.c - model/am_policy_data.c - model/application_data_change_notif.c - model/application_data_subs.c + model/battery_indication_rm.c model/bdt_data.c model/bdt_policy_data.c model/bdt_policy_data_patch.c + model/bsf_info.c + model/cag_ack_data.c + model/cag_data.c + model/cag_info.c + model/candidate_for_replacement.c + model/cause.c + model/change_item.c + model/change_type.c + model/charging_data.c model/charging_information.c + model/chf_info.c + model/chf_service_info.c + model/ciphering_algorithm.c + model/civic_address.c + model/cm_info.c + model/cm_state.c + model/cn_assisted_ran_para.c + model/cnf.c + model/cnf_unit.c + model/code_word_ind.c + model/collection_period_rmm_lte_mdt.c + model/collection_period_rmm_nr_mdt.c + model/communication_characteristics.c + model/complex_query.c + model/condition_data.c + model/condition_event_type.c model/configuration_parameters_eutra.c model/configuration_parameters_nr.c + model/configured_snssai.c + model/confirmation_data.c + model/confirmation_data_response.c model/context_data_set_name.c model/context_data_sets.c + model/context_info.c + model/core_network_type.c + model/credit_management_status.c + model/data_change_notify.c model/data_filter.c model/data_ind.c - model/dnai_change_type.c - model/dnn_route_selection_descriptor.c - model/eth_flow_description.c - model/flow_direction.c - model/flow_info.c - model/iptv_config_data.c - model/iptv_config_data_patch.c - model/limit_id_to_monitoring_key.c - model/multicast_access_control.c - model/network_area_info_2.c - model/notification_item.c - model/operator_managed.c - model/parameter_over_pc5.c - model/parameter_over_uu.c - model/pc5_flow_bit_rates.c - model/pc5_qo_s_para.c - model/pc5_qos_flow_item.c - model/pc5_qos_mapping.c - model/periodicity.c - model/pfd_change_notification.c - model/plmn_rat_served.c - model/plmn_route_selection_descriptor.c - model/policy_data_change_notification.c - model/policy_data_subscription.c - model/pppp_to_pdb.c - model/presence_info.c - model/presence_state.c - model/privacy_parameter.c - model/radio_parameter_not_served.c - model/resource_item.c - model/service_application_server_address.c - model/service_id_to_frequency.c - model/service_id_to_layer2_id.c - model/service_id_to_pppr.c - model/service_parameter_data.c - model/service_to_pdu_session.c - model/service_to_tx.c - model/slrb_configurations.c - model/sm_policy_data.c - model/sm_policy_data_patch.c - model/sm_policy_dnn_data.c - model/sm_policy_dnn_data_patch.c - model/sm_policy_snssai_data.c - model/sm_policy_snssai_data_patch.c - model/snssai_route_selection_descriptor.c - model/sponsor_connectivity_data.c - model/subscribed_event.c - model/temporal_validity.c - model/time_period.c - model/time_window.c - model/traffic_influ_data.c - model/traffic_influ_data_notif.c - model/traffic_influ_data_patch.c - model/traffic_influ_sub.c - model/transfer_policy.c - model/ue_policy_section.c - model/ue_policy_set.c - model/ue_policy_set_patch.c - model/updated_item.c - model/usage_mon_data.c - model/usage_mon_data_limit.c - model/usage_mon_data_scope.c - model/usage_mon_level.c - model/usage_threshold.c - model/v2x_rat_type.c - - model/additional_qos_flow_info.c - model/apn_rate_status.c - model/cause.c - model/cn_assisted_ran_para.c + model/datalink_reporting_configuration.c + model/data_set_id.c + model/data_set_name.c + model/ddd_traffic_descriptor.c + model/ddn_failure_sub_info.c model/ddn_failure_subs.c + model/default_notification_subscription.c + model/default_unrelated_class.c + model/deregistration_data.c + model/deregistration_reason.c + model/dl_data_delivery_status.c + model/dnai_change_type.c model/dnai_information.c + model/dnf.c + model/dnf_unit.c + model/dnn_configuration.c + model/dnn_info.c + model/dnn_route_selection_descriptor.c model/dnn_selection_mode.c + model/dnn_smf_info_item.c + model/dnn_upf_info_item.c + model/domain_name_protocol.c model/dynamic5_qi.c + model/eap_session.c model/ebi_arp_mapping.c + model/ecgi.c + model/ec_restriction.c + model/ec_restriction_data_wb.c + model/edrx_parameters.c + model/ee_profile_data.c + model/ee_subscription.c + model/ellipsoid_arc_all_of.c + model/ellipsoid_arc.c + model/emergency_info.c + model/enhanced_coverage_restriction_data.c model/eps_bearer_info.c model/eps_interworking_indication.c + model/eps_interworking_info.c + model/eps_iwk_pgw.c model/eps_pdn_cnx_info.c + model/error_report.c + model/eth_flow_description.c + model/eutra_location.c + model/event_for_mdt.c + model/event_id.c + model/event_report_mode.c + model/event_type.c model/exemption_ind.c + model/expected_ue_behavior.c + model/expected_ue_behaviour.c + model/expected_ue_behaviour_data.c + model/exposure_data_change_notification.c + model/exposure_data_subscription.c + model/external_client_type.c + model/external_unrelated_class.c + model/ext_problem_details.c + model/ext_snssai.c + model/failure_cause.c + model/failure_code.c + model/final_unit_action.c + model/flow_direction.c + model/flow_info.c + model/flow_information.c + model/flow_status.c + model/frame_route_info.c + model/gad_shape.c model/gbr_qos_flow_information.c + model/geographical_coordinates.c + model/geographic_area.c + model/global_ran_node_id.c + model/gmlc_info.c + model/g_nb_id.c + model/group_identifiers.c + model/guami.c + model/guami_list_cond.c + model/hfc_node_id.c model/ho_state.c model/hsmf_update_data.c - model/hsmf_update_error.c model/hsmf_updated_data.c + model/hsmf_update_error.c + model/hss_authentication_info_request.c + model/hss_authentication_info_result.c + model/hss_authentication_vectors.c + model/hss_auth_type.c + model/hss_auth_type_in_uri.c + model/hss_av_type.c + model/hss_info.c + model/identity_data.c + model/identity_range.c + model/id_translation_result.c + model/imsi_range.c + model/ims_vo_ps.c model/indirect_data_forwarding_tunnel_info.c - model/inline_object.c model/inline_object_1.c model/inline_object_2.c model/inline_object_3.c model/inline_object_4.c - model/ma_release_indication.c - model/max_integrity_protected_data_rate.c - model/mme_capabilities.c - model/mo_exception_data_flag.c - model/mo_exp_data_counter.c - model/n2_sm_info_type.c - model/n4_information.c - model/n4_message_type.c - model/ng_ap_cause.c - model/ng_ran_target_id.c - model/non_dynamic5_qi.c - model/notification_cause.c - model/notification_control.c - model/partial_record_method.c - model/pdu_session_create_data.c - model/pdu_session_create_error.c - model/pdu_session_created_data.c - model/pdu_session_notify_item.c - model/psa_indication.c - model/psa_information.c - model/qos_flow_access_type.c - model/qos_flow_add_modify_request_item.c - model/qos_flow_item.c - model/qos_flow_notify_item.c - model/qos_flow_profile.c - model/qos_flow_release_request_item.c - model/qos_flow_setup_item.c - model/qos_flow_usage_report.c - model/qos_resource_type.c - model/ref_to_binary_data.c - model/reflective_qo_s_attribute.c - model/release_data.c - model/released_data.c - model/request_indication.c - model/request_type.c - model/resource_status.c - model/roaming_charging_profile.c - model/secondary_rat_usage_info.c - model/secondary_rat_usage_report.c - model/send_mo_data_req_data.c - model/sm_context.c - model/sm_context_create_data.c - model/sm_context_create_error.c - model/sm_context_created_data.c - model/sm_context_release_data.c - model/sm_context_released_data.c - model/sm_context_retrieve_data.c - model/sm_context_retrieved_data.c - model/sm_context_status_notification.c - model/sm_context_type.c - model/sm_context_update_data.c - model/sm_context_update_error.c - model/sm_context_updated_data.c - model/small_data_rate_status.c - model/status_info.c - model/status_notification.c - model/transfer_mo_data_req_data.c - model/transfer_mt_data_add_info.c - model/transfer_mt_data_error.c - model/transfer_mt_data_req_data.c - model/trigger.c - model/trigger_category.c - model/trigger_type.c - model/tunnel_info.c - model/ulcl_bp_information.c - model/unavailable_access_indication.c - model/up_cnx_state.c - model/volume_timed_report.c - model/vplmn_qos.c - model/vsmf_update_data.c - model/vsmf_update_error.c - model/vsmf_updated_data.c - - model/allowed_nssai.c - model/allowed_snssai.c - model/amf_event.c - model/amf_event_area.c - model/amf_event_mode.c - model/amf_event_subscription.c - model/amf_event_trigger.c - model/amf_event_type.c - model/amf_status_change_notification.c - model/amf_status_change_subscription_data.c - model/amf_status_info.c - model/area_of_validity.c - model/assign_ebi_data.c - model/assign_ebi_error.c - model/assign_ebi_failed.c - model/assigned_ebi_data.c - model/ciphering_algorithm.c - model/configured_snssai.c - model/expected_ue_behavior.c + model/inline_object.c + model/inline_response_200.c model/integrity_algorithm.c + model/interface_upf_info_item.c + model/inter_freq_target_info.c + model/internal_group_id_range.c + model/invalid_param.c + model/ip_address.c + model/ip_end_point.c + model/ip_multicast_address_info.c + model/ip_sm_gw_registration.c + model/iptv_config_data.c + model/iptv_config_data_patch.c + model/ipv4_address_range.c + model/ipv6_prefix_range.c + model/job_type.c model/key_amf.c model/key_amf_type.c model/ladn_info.c + model/lcs_broadcast_assistance_types_data.c + model/lcs_client_class.c + model/lcs_client_external.c + model/lcs_client_group_external.c + model/lcs_mo_data.c + model/lcs_mo_service_class.c + model/lcs_privacy.c + model/lcs_privacy_data.c + model/limit_id_to_monitoring_key.c + model/line_type.c + model/link.c + model/links_value_schema.c + model/lmf_info.c + model/location_accuracy.c + model/location_area.c model/location_filter.c + model/location_info.c + model/location_privacy_ind.c + model/location_reporting_configuration.c + model/logging_duration_mdt.c + model/logging_duration_nr_mdt.c + model/logging_interval_mdt.c + model/logging_interval_nr_mdt.c + model/loss_connectivity_cfg.c + model/lpi.c + model/lte_v2x_auth.c + model/ma_pdu_indication.c + model/mapping_of_snssai.c + model/ma_release_indication.c + model/max_integrity_protected_data_rate.c + model/mbsfn_area.c + model/mdt_configuration.c + model/mdt_user_consent.c + model/measurement_lte_for_mdt.c + model/measurement_nr_for_mdt.c + model/measurement_period_lte_mdt.c + model/message_waiting_data.c + model/metering_method.c model/mm_context.c + model/mme_capabilities.c + model/model_5_g_vn_group_configuration.c + model/model_5_g_vn_group_data.c + model/modification_notification.c + model/mo_exp_data_counter.c + model/monitoring_configuration.c + model/multicast_access_control.c + model/n1_message_class.c model/n1_message_container.c model/n1_message_notification.c model/n1_n2_message_transfer_cause.c @@ -598,135 +321,464 @@ libsbi_openapi_sources = files(''' model/n2_info_content.c model/n2_info_notification_rsp_data.c model/n2_info_notify_reason.c + model/n2_information_class.c model/n2_information_notification.c model/n2_information_transfer_error.c model/n2_information_transfer_req_data.c model/n2_information_transfer_result.c model/n2_information_transfer_rsp_data.c + model/n2_interface_amf_info.c model/n2_ran_information.c model/n2_sm_information.c + model/n2_sm_info_type.c + model/n3ga_location.c + model/n4_information.c + model/n4_message_type.c model/nas_security_mode.c - model/ng_ksi.c + model/ncgi.c + model/nef_cond.c + model/nef_info.c + model/network_area_info_2.c + model/network_area_info.c + model/network_node_diameter_address.c + model/network_slice_cond.c + model/nf_group_cond.c + model/nf_info.c + model/nf_instance_id_cond.c + model/nf_instance_id_list_cond.c + model/nf_profile.c + model/nf_service.c + model/nf_service_set_cond.c + model/nf_service_status.c + model/nf_service_version.c + model/nf_set_cond.c + model/nf_status.c + model/nf_type.c + model/nf_type_cond.c + model/ng_ap_cause.c model/ngap_ie_type.c + model/ng_ksi.c + model/ng_ran_target_id.c + model/nidd_information.c + model/node_type.c + model/non_dynamic5_qi.c model/non_ue_n2_info_subscription_create_data.c model/non_ue_n2_info_subscription_created_data.c + model/notif_condition.c + model/notification_cause.c + model/notification_control.c + model/notification_data.c + model/notification_event_type.c + model/notification_item.c + model/notification_type.c + model/notify_item.c + model/nrf_info.c + model/nr_location.c model/nrppa_information.c + model/nr_v2x_auth.c model/nsi_information.c + model/nssai_ack_data.c + model/nssai.c model/nssai_mapping.c - model/pdu_session_context.c - model/policy_req_trigger.c - model/pws_error_data.c - model/pws_information.c - model/pws_response_data.c - model/rat_selector.c - model/registration_context_container.c - model/sbi_binding_level.c - model/sc_type.c - model/seaf_data.c - model/small_data_rate_status_info.c - model/smf_change_indication.c - model/smf_change_info.c - model/status_change.c - model/traffic_descriptor.c - model/transfer_reason.c - model/ue_context.c - model/ue_context_create_data.c - model/ue_context_create_error.c - model/ue_context_created_data.c - model/ue_context_release.c - model/ue_context_transfer_req_data.c - model/ue_context_transfer_rsp_data.c - model/ue_context_transfer_status.c - model/ue_n1_n2_info_subscription_create_data.c - model/ue_n1_n2_info_subscription_created_data.c - model/ue_reg_status_update_req_data.c - model/ue_reg_status_update_rsp_data.c - model/v2x_context.c - - model/acc_net_ch_id.c - model/acc_net_charging_address.c - model/accu_usage_report.c - model/additional_access_info.c - model/af_sig_protocol.c - model/an_gw_address.c - model/app_detection_info.c - model/authorized_default_qos.c - model/candidate_for_replacement.c - model/charging_data.c - model/condition_data.c - model/credit_management_status.c - model/error_report.c - model/failure_cause.c - model/failure_code.c - model/final_unit_action.c - model/flow_direction_rm.c - model/flow_information.c - model/flow_status.c - model/ip_multicast_address_info.c - model/ma_pdu_indication.c - model/mapping_of_snssai.c - model/metering_method.c + model/null_value.c + model/nwdaf_cond.c + model/nwdaf_event.c + model/nwdaf_info.c + model/object.c + model/odb_data.c + model/odb_packet_services.c + model/operation_mode.c + model/operator_managed.c + model/operator_specific_data_container.c + model/options_response.c model/packet_filter_info.c + model/parameter_over_pc5.c + model/parameter_over_uu.c + model/partial_record_method.c model/partial_success_report.c + model/patch_item.c + model/patch_operation.c + model/patch_result.c + model/pc5_flow_bit_rates.c + model/pc5_qos_flow_item.c + model/pc5_qos_mapping.c + model/pc5_qo_s_para.c model/pcc_rule.c + model/pcf_info.c + model/pcscf_info.c + model/pcscf_restoration_notification.c + model/pdu_session.c + model/pdu_session_context.c + model/pdu_session_continuity_ind.c + model/pdu_session_create_data.c + model/pdu_session_created_data.c + model/pdu_session_create_error.c + model/pdu_session_management_data.c + model/pdu_session_notify_item.c model/pdu_session_rel_cause.c + model/pdu_session_status.c + model/pdu_session_status_cfg.c + model/pdu_session_type.c + model/pdu_session_types.c + model/pei_update_info.c + model/periodicity.c + model/pfd_change_notification.c + model/pfd_content.c + model/pfd_data.c + model/pfd_data_for_app.c + model/pfd_data_for_app_ext_all_of.c + model/pfd_data_for_app_ext.c + model/pgw_info.c + model/plmn_ec_info.c + model/plmn_id.c + model/plmn_id_nid.c + model/plmn_operator_class.c + model/plmn_range.c + model/plmn_rat_served.c + model/plmn_route_selection_descriptor.c + model/plmn_snssai.c + model/point_all_of.c + model/point_altitude_all_of.c + model/point_altitude.c + model/point_altitude_uncertainty_all_of.c + model/point_altitude_uncertainty.c + model/point.c + model/point_uncertainty_circle_all_of.c + model/point_uncertainty_circle.c + model/point_uncertainty_ellipse_all_of.c + model/point_uncertainty_ellipse.c model/policy_association.c model/policy_association_release_cause.c model/policy_association_request.c model/policy_association_update_request.c model/policy_control_request_trigger.c + model/policy_data_change_notification.c + model/policy_data_subscription.c + model/policy_req_trigger.c model/policy_update.c + model/polygon_all_of.c + model/polygon.c model/port_management_container.c + model/positioning_method_mdt.c + model/pp_active_time.c + model/pp_data.c + model/pp_dl_packet_count_ext.c + model/pp_maximum_latency.c + model/pp_maximum_response_time.c + model/pppp_to_pdb.c + model/pp_subs_reg_timer.c + model/preemption_capability.c + model/preemption_vulnerability.c + model/preferred_search.c + model/presence_info.c model/presence_info_rm.c + model/presence_state.c + model/privacy_check_related_action.c + model/privacy_parameter.c + model/problem_details_2.c + model/problem_details_add_info.c + model/problem_details.c + model/protection_result.c + model/provisioned_data_sets.c + model/psa_indication.c + model/psa_information.c + model/ptw_parameters.c + model/pws_error_data.c + model/pws_information.c + model/pws_response_data.c model/qos_characteristics.c model/qos_data.c + model/qos_flow_access_type.c + model/qos_flow_add_modify_request_item.c + model/qos_flow_item.c + model/qos_flow_notify_item.c + model/qos_flow_profile.c + model/qos_flow_release_request_item.c + model/qos_flow_setup_item.c model/qos_flow_usage.c + model/qos_flow_usage_report.c model/qos_monitoring_data.c + model/qos_monitoring_info.c model/qos_monitoring_report.c - model/qos_notif_type.c + model/qos_monitoring_req.c model/qos_notification_control_info.c + model/qos_notif_type.c + model/qos_resource_type.c + model/radio_parameter_not_served.c model/ran_nas_rel_cause.c + model/rat_selector.c + model/rat_type.c + model/reachability_for_sms_configuration.c model/redirect_address_type.c model/redirect_information.c + model/reflective_qo_s_attribute.c + model/ref_to_binary_data.c + model/registration_context_container.c + model/registration_data_set_name.c + model/registration_data_sets.c + model/registration_location_info.c + model/registration_reason.c + model/release_data.c + model/released_data.c + model/report_amount_mdt.c model/reporting_frequency.c model/reporting_level.c - model/request_trigger.c + model/reporting_options.c + model/reporting_trigger.c + model/report_interval_mdt.c + model/report_interval_nr_mdt.c + model/report_item.c + model/report_type_mdt.c model/requested_qos.c model/requested_qos_monitoring_parameter.c model/requested_rule_data.c model/requested_rule_data_type.c model/requested_usage_data.c + model/request_indication.c + model/request_trigger.c + model/request_type.c + model/resource_item.c + model/resource_status.c + model/restriction_type.c + model/resynchronization_info.c + model/retrieve_data.c + model/retrieved_data.c + model/rg_auth_ctx.c + model/rg_authentication_info.c + model/rm_info.c + model/rm_state.c + model/roaming_charging_profile.c + model/roaming_indication.c + model/roaming_odb.c + model/route_information.c + model/route_to_location.c model/rule_operation.c model/rule_report.c model/rule_status.c + model/sbi_binding_level.c + model/scheduled_communication_time.c + model/scheduled_communication_time_rm.c + model/scheduled_communication_type.c + model/scheduled_communication_type_rm.c + model/scp_domain_cond.c + model/scp_domain_info.c + model/scp_info.c + model/sc_type.c + model/sdm_subscription.c + model/sdm_subs_modification.c + model/sd_range.c + model/seaf_data.c + model/search_result.c + model/secondary_rat_usage_info.c + model/secondary_rat_usage_report.c + model/security_result.c + model/send_mo_data_req_data.c + model/sensor_measurement.c + model/sequence_number.c + model/service_application_server_address.c + model/service_area_restriction.c + model/service_id_to_frequency.c + model/service_id_to_layer2_id.c + model/service_id_to_pppr.c + model/service_name_cond.c + model/service_parameter_data.c + model/service_to_pdu_session.c + model/service_to_tx.c + model/service_type_unrelated_class.c model/serving_nf_identity.c + model/session_management_subscription_data.c model/session_rule.c model/session_rule_failure_code.c model/session_rule_report.c + model/shared_data.c + model/sign.c + model/slice_info_for_pdu_session.c + model/slice_info_for_registration.c + model/slice_info_for_ue_configuration_update.c + model/slrb_configurations.c + model/small_data_rate_status.c + model/small_data_rate_status_info.c + model/sm_context.c + model/sm_context_create_data.c + model/sm_context_created_data.c + model/sm_context_create_error.c + model/sm_context_release_data.c + model/sm_context_released_data.c + model/sm_context_retrieve_data.c + model/sm_context_retrieved_data.c + model/sm_context_status_notification.c + model/sm_context_type.c + model/sm_context_update_data.c + model/sm_context_updated_data.c + model/sm_context_update_error.c + model/smf_change_indication.c + model/smf_change_info.c + model/smf_info.c + model/smf_registration.c + model/smf_registration_info.c + model/smf_selection_data.c + model/smf_selection_subscription_data.c model/sm_policy_association_release_cause.c model/sm_policy_context_data.c model/sm_policy_control.c + model/sm_policy_data.c + model/sm_policy_data_patch.c model/sm_policy_decision.c model/sm_policy_delete_data.c + model/sm_policy_dnn_data.c + model/sm_policy_dnn_data_patch.c model/sm_policy_notification.c + model/sm_policy_snssai_data.c + model/sm_policy_snssai_data_patch.c model/sm_policy_update_context_data.c - model/smf_selection_data.c - model/steer_mode_value.c + model/smsc_data.c + model/smsf_info.c + model/smsf_registration.c + model/sms_management_subscription_data.c + model/sms_subscription_data.c + model/sms_support.c + model/snssai.c + model/snssai_extension.c + model/snssai_info.c + model/snssai_route_selection_descriptor.c + model/snssai_smf_info_item.c + model/snssai_upf_info_item.c + model/sor_data.c + model/sor_info.c + model/sor_update_indicator.c + model/sor_update_info.c + model/sponsor_connectivity_data.c + model/sqn_scheme.c + model/ssc_mode.c + model/ssc_modes.c + model/stationary_indication.c + model/stationary_indication_rm.c + model/status_change.c + model/status_info.c + model/status_notification.c + model/steering_container.c model/steering_functionality.c + model/steering_info.c model/steering_mode.c + model/steer_mode_value.c + model/stored_search_result.c + model/subscribed_default_qos.c + model/subscribed_event.c + model/subscribed_snssai.c + model/subscription_data.c + model/subscription_data_sets.c + model/subscription_data_subscr_cond.c + model/subscription_data_subscriptions.c + model/suggested_packet_num_dl.c + model/supi_range.c + model/supported_gad_shapes.c + model/tac_info.c + model/tac_range.c + model/tai.c + model/tai_range.c + model/temporal_validity.c model/termination_notification.c + model/time_period.c + model/time_window.c + model/tnap_id.c + model/tngf_info.c + model/trace_data.c + model/trace_data_response.c + model/trace_depth.c model/traffic_control_data.c + model/traffic_descriptor.c + model/traffic_influ_data.c + model/traffic_influ_data_notif.c + model/traffic_influ_data_patch.c + model/traffic_influ_sub.c + model/traffic_profile.c + model/traffic_profile_rm.c + model/transfer_mo_data_req_data.c + model/transfer_mt_data_add_info.c + model/transfer_mt_data_error.c + model/transfer_mt_data_req_data.c + model/transfer_policy.c + model/transfer_reason.c + model/transport_protocol.c + model/trigger.c + model/trigger_category.c + model/trigger_request.c + model/trigger_type.c model/tscai_input_container.c model/tsn_bridge_info.c model/tsn_port_identifier.c + model/tunnel_info.c + model/twap_id.c + model/twif_info.c + model/udm_info.c + model/udr_info.c + model/udsf_info.c + model/ue_auth.c + model/ue_authentication_ctx.c model/ue_camping_rep.c + model/ue_context.c + model/ue_context_create_data.c + model/ue_context_created_data.c + model/ue_context_create_error.c + model/ue_context_in_amf_data.c + model/ue_context_in_smf_data.c + model/ue_context_in_smsf_data.c + model/ue_context_release.c + model/ue_context_transfer_req_data.c + model/ue_context_transfer_rsp_data.c + model/ue_context_transfer_status.c + model/ue_id.c model/ue_initiated_resource_request.c + model/ue_n1_n2_info_subscription_create_data.c + model/ue_n1_n2_info_subscription_created_data.c + model/ue_policy_section.c + model/ue_policy_set.c + model/ue_policy_set_patch.c + model/ue_reachability.c + model/ue_reg_status_update_req_data.c + model/ue_reg_status_update_rsp_data.c + model/ue_update_status.c + model/ulcl_bp_information.c + model/unavailable_access_indication.c + model/uncertainty_ellipse.c + model/unrelated_class.c + model/up_cnx_state.c + model/up_confidentiality.c + model/updated_item.c + model/upf_cond.c + model/upf_info.c + model/up_integrity.c + model/up_interface_type.c model/up_path_chg_event.c + model/up_security.c + model/up_security_info.c + model/upu_data_2.c + model/upu_data.c + model/upu_info.c + model/uri_scheme.c + model/usage_mon_data.c + model/usage_mon_data_limit.c + model/usage_mon_data_scope.c model/usage_monitoring_data.c + model/usage_mon_level.c + model/usage_threshold.c + model/user_identifier.c + model/user_location.c + model/v2x_context.c + model/v2x_rat_type.c + model/v2x_subscription_data.c + model/valid_time_period.c + model/vendor_specific_feature.c + model/vgmlc_address.c + model/vn_group_data.c + model/volume_timed_report.c + model/vplmn_qos.c + model/vsmf_update_data.c + model/vsmf_updated_data.c + model/vsmf_update_error.c + model/w_agf_info.c model/wireline_area.c model/wireline_service_area_restriction.c - - model/subscription_data_subscr_cond.c '''.split()) libsbi_openapi_inc = include_directories('.') diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data.c b/lib/sbi/openapi/model/access_and_mobility_subscription_data.c index 1dd835ed3..5726d7aac 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data.c +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data.c @@ -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; diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data.h b/lib/sbi/openapi/model/access_and_mobility_subscription_data.h index 7f38b3752..ffbc733d0 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data.h +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data.h @@ -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); diff --git a/lib/sbi/openapi/model/access_network_id.c b/lib/sbi/openapi/model/access_network_id.c new file mode 100644 index 000000000..204ca842c --- /dev/null +++ b/lib/sbi/openapi/model/access_network_id.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#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; +} + diff --git a/lib/sbi/openapi/model/access_network_id.h b/lib/sbi/openapi/model/access_network_id.h new file mode 100644 index 000000000..e17cd6aa2 --- /dev/null +++ b/lib/sbi/openapi/model/access_network_id.h @@ -0,0 +1,31 @@ +/* + * access_network_id.h + * + * + */ + +#ifndef _OpenAPI_access_network_id_H_ +#define _OpenAPI_access_network_id_H_ + +#include +#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_ */ + diff --git a/lib/sbi/openapi/model/additional_qos_flow_info.c b/lib/sbi/openapi/model/additional_qos_flow_info.c index dcb1bb0c4..7c645b8d2 100644 --- a/lib/sbi/openapi/model/additional_qos_flow_info.c +++ b/lib/sbi/openapi/model/additional_qos_flow_info.c @@ -4,82 +4,27 @@ #include #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; } diff --git a/lib/sbi/openapi/model/additional_qos_flow_info.h b/lib/sbi/openapi/model/additional_qos_flow_info.h index b81373843..86c10ae9e 100644 --- a/lib/sbi/openapi/model/additional_qos_flow_info.h +++ b/lib/sbi/openapi/model/additional_qos_flow_info.h @@ -12,22 +12,16 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "null_value.h" #ifdef __cplusplus extern "C" { #endif -typedef struct OpenAPI_additional_qos_flow_info_s OpenAPI_additional_qos_flow_info_t; -typedef struct OpenAPI_additional_qos_flow_info_s { -} OpenAPI_additional_qos_flow_info_t; +typedef enum { OpenAPI_additional_qos_flow_info_NULL = 0, OpenAPI_additional_qos_flow_info_MORE_LIKELY } OpenAPI_additional_qos_flow_info_e; -OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_create( - ); -void OpenAPI_additional_qos_flow_info_free(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info); -OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_parseFromJSON(cJSON *additional_qos_flow_infoJSON); -cJSON *OpenAPI_additional_qos_flow_info_convertToJSON(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info); -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); +char* OpenAPI_additional_qos_flow_info_ToString(OpenAPI_additional_qos_flow_info_e additional_qos_flow_info); + +OpenAPI_additional_qos_flow_info_e OpenAPI_additional_qos_flow_info_FromString(char* additional_qos_flow_info); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/af_non_external.c b/lib/sbi/openapi/model/af_non_external.c deleted file mode 100644 index 9cf8798a8..000000000 --- a/lib/sbi/openapi/model/af_non_external.c +++ /dev/null @@ -1,226 +0,0 @@ - -#include -#include -#include -#include "af_non_external.h" - -OpenAPI_af_non_external_t *OpenAPI_af_non_external_create( - char *af_id, - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_t *valid_time_period - ) -{ - OpenAPI_af_non_external_t *af_non_external_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_non_external_t)); - if (!af_non_external_local_var) { - return NULL; - } - af_non_external_local_var->af_id = af_id; - af_non_external_local_var->allowed_geographic_area = allowed_geographic_area; - af_non_external_local_var->privacy_check_related_action = privacy_check_related_action; - af_non_external_local_var->code_word_ind = code_word_ind; - af_non_external_local_var->valid_time_period = valid_time_period; - - return af_non_external_local_var; -} - -void OpenAPI_af_non_external_free(OpenAPI_af_non_external_t *af_non_external) -{ - if (NULL == af_non_external) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(af_non_external->af_id); - OpenAPI_list_for_each(af_non_external->allowed_geographic_area, node) { - OpenAPI_geographic_area_free(node->data); - } - OpenAPI_list_free(af_non_external->allowed_geographic_area); - OpenAPI_valid_time_period_free(af_non_external->valid_time_period); - ogs_free(af_non_external); -} - -cJSON *OpenAPI_af_non_external_convertToJSON(OpenAPI_af_non_external_t *af_non_external) -{ - cJSON *item = NULL; - - if (af_non_external == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [AfNonExternal]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!af_non_external->af_id) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [af_id]"); - goto end; - } - if (cJSON_AddStringToObject(item, "afId", af_non_external->af_id) == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [af_id]"); - goto end; - } - - if (af_non_external->allowed_geographic_area) { - cJSON *allowed_geographic_areaList = cJSON_AddArrayToObject(item, "allowedGeographicArea"); - if (allowed_geographic_areaList == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - - OpenAPI_lnode_t *allowed_geographic_area_node; - if (af_non_external->allowed_geographic_area) { - OpenAPI_list_for_each(af_non_external->allowed_geographic_area, allowed_geographic_area_node) { - cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(allowed_geographic_area_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal); - } - } - } - - if (af_non_external->privacy_check_related_action) { - if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(af_non_external->privacy_check_related_action)) == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [privacy_check_related_action]"); - goto end; - } - } - - if (af_non_external->code_word_ind) { - if (cJSON_AddStringToObject(item, "codeWordInd", OpenAPI_code_word_ind_ToString(af_non_external->code_word_ind)) == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [code_word_ind]"); - goto end; - } - } - - if (af_non_external->valid_time_period) { - cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_convertToJSON(af_non_external->valid_time_period); - if (valid_time_period_local_JSON == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [valid_time_period]"); - goto end; - } - cJSON_AddItemToObject(item, "validTimePeriod", valid_time_period_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_af_non_external_convertToJSON() failed [valid_time_period]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_af_non_external_t *OpenAPI_af_non_external_parseFromJSON(cJSON *af_non_externalJSON) -{ - OpenAPI_af_non_external_t *af_non_external_local_var = NULL; - cJSON *af_id = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "afId"); - if (!af_id) { - ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [af_id]"); - goto end; - } - - - if (!cJSON_IsString(af_id)) { - ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [af_id]"); - goto end; - } - - cJSON *allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "allowedGeographicArea"); - - OpenAPI_list_t *allowed_geographic_areaList; - if (allowed_geographic_area) { - cJSON *allowed_geographic_area_local_nonprimitive; - if (!cJSON_IsArray(allowed_geographic_area)) { - ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - - allowed_geographic_areaList = OpenAPI_list_create(); - - cJSON_ArrayForEach(allowed_geographic_area_local_nonprimitive, allowed_geographic_area ) { - if (!cJSON_IsObject(allowed_geographic_area_local_nonprimitive)) { - ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local_nonprimitive); - - OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem); - } - } - - cJSON *privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "privacyCheckRelatedAction"); - - OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable; - if (privacy_check_related_action) { - if (!cJSON_IsString(privacy_check_related_action)) { - ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [privacy_check_related_action]"); - goto end; - } - privacy_check_related_actionVariable = OpenAPI_privacy_check_related_action_FromString(privacy_check_related_action->valuestring); - } - - cJSON *code_word_ind = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "codeWordInd"); - - OpenAPI_code_word_ind_e code_word_indVariable; - if (code_word_ind) { - if (!cJSON_IsString(code_word_ind)) { - ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [code_word_ind]"); - goto end; - } - code_word_indVariable = OpenAPI_code_word_ind_FromString(code_word_ind->valuestring); - } - - cJSON *valid_time_period = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "validTimePeriod"); - - OpenAPI_valid_time_period_t *valid_time_period_local_nonprim = NULL; - if (valid_time_period) { - valid_time_period_local_nonprim = OpenAPI_valid_time_period_parseFromJSON(valid_time_period); - } - - af_non_external_local_var = OpenAPI_af_non_external_create ( - ogs_strdup(af_id->valuestring), - allowed_geographic_area ? allowed_geographic_areaList : NULL, - privacy_check_related_action ? privacy_check_related_actionVariable : 0, - code_word_ind ? code_word_indVariable : 0, - valid_time_period ? valid_time_period_local_nonprim : NULL - ); - - return af_non_external_local_var; -end: - return NULL; -} - -OpenAPI_af_non_external_t *OpenAPI_af_non_external_copy(OpenAPI_af_non_external_t *dst, OpenAPI_af_non_external_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_af_non_external_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_af_non_external_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_af_non_external_free(dst); - dst = OpenAPI_af_non_external_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/af_non_external.h b/lib/sbi/openapi/model/af_non_external.h deleted file mode 100644 index 646d48749..000000000 --- a/lib/sbi/openapi/model/af_non_external.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * af_non_external.h - * - * - */ - -#ifndef _OpenAPI_af_non_external_H_ -#define _OpenAPI_af_non_external_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "code_word_ind.h" -#include "geographic_area.h" -#include "privacy_check_related_action.h" -#include "valid_time_period.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_af_non_external_s OpenAPI_af_non_external_t; -typedef struct OpenAPI_af_non_external_s { - char *af_id; - OpenAPI_list_t *allowed_geographic_area; - OpenAPI_privacy_check_related_action_e privacy_check_related_action; - OpenAPI_code_word_ind_e code_word_ind; - struct OpenAPI_valid_time_period_s *valid_time_period; -} OpenAPI_af_non_external_t; - -OpenAPI_af_non_external_t *OpenAPI_af_non_external_create( - char *af_id, - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_t *valid_time_period - ); -void OpenAPI_af_non_external_free(OpenAPI_af_non_external_t *af_non_external); -OpenAPI_af_non_external_t *OpenAPI_af_non_external_parseFromJSON(cJSON *af_non_externalJSON); -cJSON *OpenAPI_af_non_external_convertToJSON(OpenAPI_af_non_external_t *af_non_external); -OpenAPI_af_non_external_t *OpenAPI_af_non_external_copy(OpenAPI_af_non_external_t *dst, OpenAPI_af_non_external_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_af_non_external_H_ */ - diff --git a/lib/sbi/openapi/model/alternative_qos_profile.c b/lib/sbi/openapi/model/alternative_qos_profile.c new file mode 100644 index 000000000..b59d81b68 --- /dev/null +++ b/lib/sbi/openapi/model/alternative_qos_profile.c @@ -0,0 +1,188 @@ + +#include +#include +#include +#include "alternative_qos_profile.h" + +OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_create( + int index, + char *gua_fbr_dl, + char *gua_fbr_ul, + int packet_delay_budget, + char *packet_err_rate + ) +{ + OpenAPI_alternative_qos_profile_t *alternative_qos_profile_local_var = OpenAPI_malloc(sizeof(OpenAPI_alternative_qos_profile_t)); + if (!alternative_qos_profile_local_var) { + return NULL; + } + alternative_qos_profile_local_var->index = index; + alternative_qos_profile_local_var->gua_fbr_dl = gua_fbr_dl; + alternative_qos_profile_local_var->gua_fbr_ul = gua_fbr_ul; + alternative_qos_profile_local_var->packet_delay_budget = packet_delay_budget; + alternative_qos_profile_local_var->packet_err_rate = packet_err_rate; + + return alternative_qos_profile_local_var; +} + +void OpenAPI_alternative_qos_profile_free(OpenAPI_alternative_qos_profile_t *alternative_qos_profile) +{ + if (NULL == alternative_qos_profile) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(alternative_qos_profile->gua_fbr_dl); + ogs_free(alternative_qos_profile->gua_fbr_ul); + ogs_free(alternative_qos_profile->packet_err_rate); + ogs_free(alternative_qos_profile); +} + +cJSON *OpenAPI_alternative_qos_profile_convertToJSON(OpenAPI_alternative_qos_profile_t *alternative_qos_profile) +{ + cJSON *item = NULL; + + if (alternative_qos_profile == NULL) { + ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [AlternativeQosProfile]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!alternative_qos_profile->index) { + ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [index]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "index", alternative_qos_profile->index) == NULL) { + ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [index]"); + goto end; + } + + if (alternative_qos_profile->gua_fbr_dl) { + if (cJSON_AddStringToObject(item, "guaFbrDl", alternative_qos_profile->gua_fbr_dl) == NULL) { + ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [gua_fbr_dl]"); + goto end; + } + } + + if (alternative_qos_profile->gua_fbr_ul) { + if (cJSON_AddStringToObject(item, "guaFbrUl", alternative_qos_profile->gua_fbr_ul) == NULL) { + ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [gua_fbr_ul]"); + goto end; + } + } + + if (alternative_qos_profile->packet_delay_budget) { + if (cJSON_AddNumberToObject(item, "packetDelayBudget", alternative_qos_profile->packet_delay_budget) == NULL) { + ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [packet_delay_budget]"); + goto end; + } + } + + if (alternative_qos_profile->packet_err_rate) { + if (cJSON_AddStringToObject(item, "packetErrRate", alternative_qos_profile->packet_err_rate) == NULL) { + ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [packet_err_rate]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_parseFromJSON(cJSON *alternative_qos_profileJSON) +{ + OpenAPI_alternative_qos_profile_t *alternative_qos_profile_local_var = NULL; + cJSON *index = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "index"); + if (!index) { + ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [index]"); + goto end; + } + + + if (!cJSON_IsNumber(index)) { + ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [index]"); + goto end; + } + + cJSON *gua_fbr_dl = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrDl"); + + if (gua_fbr_dl) { + if (!cJSON_IsString(gua_fbr_dl)) { + ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [gua_fbr_dl]"); + goto end; + } + } + + cJSON *gua_fbr_ul = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrUl"); + + if (gua_fbr_ul) { + if (!cJSON_IsString(gua_fbr_ul)) { + ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [gua_fbr_ul]"); + goto end; + } + } + + cJSON *packet_delay_budget = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetDelayBudget"); + + if (packet_delay_budget) { + if (!cJSON_IsNumber(packet_delay_budget)) { + ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [packet_delay_budget]"); + goto end; + } + } + + cJSON *packet_err_rate = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetErrRate"); + + if (packet_err_rate) { + if (!cJSON_IsString(packet_err_rate)) { + ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [packet_err_rate]"); + goto end; + } + } + + alternative_qos_profile_local_var = OpenAPI_alternative_qos_profile_create ( + index->valuedouble, + gua_fbr_dl ? ogs_strdup(gua_fbr_dl->valuestring) : NULL, + gua_fbr_ul ? ogs_strdup(gua_fbr_ul->valuestring) : NULL, + packet_delay_budget ? packet_delay_budget->valuedouble : 0, + packet_err_rate ? ogs_strdup(packet_err_rate->valuestring) : NULL + ); + + return alternative_qos_profile_local_var; +end: + return NULL; +} + +OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_copy(OpenAPI_alternative_qos_profile_t *dst, OpenAPI_alternative_qos_profile_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_alternative_qos_profile_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_alternative_qos_profile_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_alternative_qos_profile_free(dst); + dst = OpenAPI_alternative_qos_profile_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/alternative_qos_profile.h b/lib/sbi/openapi/model/alternative_qos_profile.h new file mode 100644 index 000000000..d347d58a0 --- /dev/null +++ b/lib/sbi/openapi/model/alternative_qos_profile.h @@ -0,0 +1,46 @@ +/* + * alternative_qos_profile.h + * + * + */ + +#ifndef _OpenAPI_alternative_qos_profile_H_ +#define _OpenAPI_alternative_qos_profile_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_alternative_qos_profile_s OpenAPI_alternative_qos_profile_t; +typedef struct OpenAPI_alternative_qos_profile_s { + int index; + char *gua_fbr_dl; + char *gua_fbr_ul; + int packet_delay_budget; + char *packet_err_rate; +} OpenAPI_alternative_qos_profile_t; + +OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_create( + int index, + char *gua_fbr_dl, + char *gua_fbr_ul, + int packet_delay_budget, + char *packet_err_rate + ); +void OpenAPI_alternative_qos_profile_free(OpenAPI_alternative_qos_profile_t *alternative_qos_profile); +OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_parseFromJSON(cJSON *alternative_qos_profileJSON); +cJSON *OpenAPI_alternative_qos_profile_convertToJSON(OpenAPI_alternative_qos_profile_t *alternative_qos_profile); +OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_copy(OpenAPI_alternative_qos_profile_t *dst, OpenAPI_alternative_qos_profile_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_alternative_qos_profile_H_ */ + diff --git a/lib/sbi/openapi/model/ambr_rm.h b/lib/sbi/openapi/model/ambr_rm.h index c916854fb..13b2d69b2 100644 --- a/lib/sbi/openapi/model/ambr_rm.h +++ b/lib/sbi/openapi/model/ambr_rm.h @@ -12,6 +12,8 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ambr.h" +#include "null_value.h" #ifdef __cplusplus extern "C" { diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration.c b/lib/sbi/openapi/model/amf3_gpp_access_registration.c index d47549712..b8c6e5470 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration.c +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration.c @@ -21,12 +21,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, + OpenAPI_eps_interworking_info_t *eps_interworking_info, int ue_srvcc_capability, - char *nid, char *registration_time, - char *vgmlc_address_ipv4, - char *vgmlc_address_ipv6, - char *vgmlc_fqdn + OpenAPI_vgmlc_address_t *vgmlc_address, + OpenAPI_context_info_t *context_info, + int no_ee_subscription_ind ) { OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf3_gpp_access_registration_t)); @@ -49,12 +49,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre amf3_gpp_access_registration_local_var->rat_type = rat_type; amf3_gpp_access_registration_local_var->urrp_indicator = urrp_indicator; amf3_gpp_access_registration_local_var->amf_ee_subscription_id = amf_ee_subscription_id; + amf3_gpp_access_registration_local_var->eps_interworking_info = eps_interworking_info; amf3_gpp_access_registration_local_var->ue_srvcc_capability = ue_srvcc_capability; - amf3_gpp_access_registration_local_var->nid = nid; amf3_gpp_access_registration_local_var->registration_time = registration_time; - amf3_gpp_access_registration_local_var->vgmlc_address_ipv4 = vgmlc_address_ipv4; - amf3_gpp_access_registration_local_var->vgmlc_address_ipv6 = vgmlc_address_ipv6; - amf3_gpp_access_registration_local_var->vgmlc_fqdn = vgmlc_fqdn; + amf3_gpp_access_registration_local_var->vgmlc_address = vgmlc_address; + amf3_gpp_access_registration_local_var->context_info = context_info; + amf3_gpp_access_registration_local_var->no_ee_subscription_ind = no_ee_subscription_ind; return amf3_gpp_access_registration_local_var; } @@ -79,11 +79,10 @@ void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registrat } OpenAPI_list_free(amf3_gpp_access_registration->backup_amf_info); ogs_free(amf3_gpp_access_registration->amf_ee_subscription_id); - ogs_free(amf3_gpp_access_registration->nid); + OpenAPI_eps_interworking_info_free(amf3_gpp_access_registration->eps_interworking_info); ogs_free(amf3_gpp_access_registration->registration_time); - ogs_free(amf3_gpp_access_registration->vgmlc_address_ipv4); - ogs_free(amf3_gpp_access_registration->vgmlc_address_ipv6); - ogs_free(amf3_gpp_access_registration->vgmlc_fqdn); + OpenAPI_vgmlc_address_free(amf3_gpp_access_registration->vgmlc_address); + OpenAPI_context_info_free(amf3_gpp_access_registration->context_info); ogs_free(amf3_gpp_access_registration); } @@ -242,16 +241,22 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } - if (amf3_gpp_access_registration->ue_srvcc_capability) { - if (cJSON_AddBoolToObject(item, "ueSrvccCapability", amf3_gpp_access_registration->ue_srvcc_capability) == NULL) { - ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ue_srvcc_capability]"); + if (amf3_gpp_access_registration->eps_interworking_info) { + cJSON *eps_interworking_info_local_JSON = OpenAPI_eps_interworking_info_convertToJSON(amf3_gpp_access_registration->eps_interworking_info); + if (eps_interworking_info_local_JSON == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [eps_interworking_info]"); + goto end; + } + cJSON_AddItemToObject(item, "epsInterworkingInfo", eps_interworking_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [eps_interworking_info]"); goto end; } } - if (amf3_gpp_access_registration->nid) { - if (cJSON_AddStringToObject(item, "nid", amf3_gpp_access_registration->nid) == NULL) { - ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [nid]"); + if (amf3_gpp_access_registration->ue_srvcc_capability) { + if (cJSON_AddBoolToObject(item, "ueSrvccCapability", amf3_gpp_access_registration->ue_srvcc_capability) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ue_srvcc_capability]"); goto end; } } @@ -263,23 +268,35 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } - if (amf3_gpp_access_registration->vgmlc_address_ipv4) { - if (cJSON_AddStringToObject(item, "vgmlcAddressIpv4", amf3_gpp_access_registration->vgmlc_address_ipv4) == NULL) { - ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv4]"); + if (amf3_gpp_access_registration->vgmlc_address) { + cJSON *vgmlc_address_local_JSON = OpenAPI_vgmlc_address_convertToJSON(amf3_gpp_access_registration->vgmlc_address); + if (vgmlc_address_local_JSON == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address]"); + goto end; + } + cJSON_AddItemToObject(item, "vgmlcAddress", vgmlc_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address]"); goto end; } } - if (amf3_gpp_access_registration->vgmlc_address_ipv6) { - if (cJSON_AddStringToObject(item, "vgmlcAddressIpv6", amf3_gpp_access_registration->vgmlc_address_ipv6) == NULL) { - ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv6]"); + if (amf3_gpp_access_registration->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(amf3_gpp_access_registration->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [context_info]"); goto end; } } - if (amf3_gpp_access_registration->vgmlc_fqdn) { - if (cJSON_AddStringToObject(item, "vgmlcFqdn", amf3_gpp_access_registration->vgmlc_fqdn) == NULL) { - ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_fqdn]"); + if (amf3_gpp_access_registration->no_ee_subscription_ind) { + if (cJSON_AddBoolToObject(item, "noEeSubscriptionInd", amf3_gpp_access_registration->no_ee_subscription_ind) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [no_ee_subscription_ind]"); goto end; } } @@ -459,6 +476,13 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par } } + cJSON *eps_interworking_info = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "epsInterworkingInfo"); + + OpenAPI_eps_interworking_info_t *eps_interworking_info_local_nonprim = NULL; + if (eps_interworking_info) { + eps_interworking_info_local_nonprim = OpenAPI_eps_interworking_info_parseFromJSON(eps_interworking_info); + } + cJSON *ue_srvcc_capability = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "ueSrvccCapability"); if (ue_srvcc_capability) { @@ -468,15 +492,6 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par } } - cJSON *nid = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "nid"); - - if (nid) { - if (!cJSON_IsString(nid)) { - ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [nid]"); - goto end; - } - } - cJSON *registration_time = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "registrationTime"); if (registration_time) { @@ -486,29 +501,25 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par } } - cJSON *vgmlc_address_ipv4 = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddressIpv4"); + cJSON *vgmlc_address = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddress"); - if (vgmlc_address_ipv4) { - if (!cJSON_IsString(vgmlc_address_ipv4)) { - ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv4]"); - goto end; - } + OpenAPI_vgmlc_address_t *vgmlc_address_local_nonprim = NULL; + if (vgmlc_address) { + vgmlc_address_local_nonprim = OpenAPI_vgmlc_address_parseFromJSON(vgmlc_address); } - cJSON *vgmlc_address_ipv6 = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddressIpv6"); + cJSON *context_info = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "contextInfo"); - if (vgmlc_address_ipv6) { - if (!cJSON_IsString(vgmlc_address_ipv6)) { - ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv6]"); - goto end; - } + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); } - cJSON *vgmlc_fqdn = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcFqdn"); + cJSON *no_ee_subscription_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "noEeSubscriptionInd"); - if (vgmlc_fqdn) { - if (!cJSON_IsString(vgmlc_fqdn)) { - ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_fqdn]"); + if (no_ee_subscription_ind) { + if (!cJSON_IsBool(no_ee_subscription_ind)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [no_ee_subscription_ind]"); goto end; } } @@ -530,12 +541,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par rat_typeVariable, urrp_indicator ? urrp_indicator->valueint : 0, amf_ee_subscription_id ? ogs_strdup(amf_ee_subscription_id->valuestring) : NULL, + eps_interworking_info ? eps_interworking_info_local_nonprim : NULL, ue_srvcc_capability ? ue_srvcc_capability->valueint : 0, - nid ? ogs_strdup(nid->valuestring) : NULL, registration_time ? ogs_strdup(registration_time->valuestring) : NULL, - vgmlc_address_ipv4 ? ogs_strdup(vgmlc_address_ipv4->valuestring) : NULL, - vgmlc_address_ipv6 ? ogs_strdup(vgmlc_address_ipv6->valuestring) : NULL, - vgmlc_fqdn ? ogs_strdup(vgmlc_fqdn->valuestring) : NULL + vgmlc_address ? vgmlc_address_local_nonprim : NULL, + context_info ? context_info_local_nonprim : NULL, + no_ee_subscription_ind ? no_ee_subscription_ind->valueint : 0 ); return amf3_gpp_access_registration_local_var; diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration.h b/lib/sbi/openapi/model/amf3_gpp_access_registration.h index 29ec6f052..1511ed69a 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration.h +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration.h @@ -13,9 +13,12 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "backup_amf_info.h" +#include "context_info.h" +#include "eps_interworking_info.h" #include "guami.h" #include "ims_vo_ps.h" #include "rat_type.h" +#include "vgmlc_address.h" #ifdef __cplusplus extern "C" { @@ -39,12 +42,12 @@ typedef struct OpenAPI_amf3_gpp_access_registration_s { OpenAPI_rat_type_e rat_type; int urrp_indicator; char *amf_ee_subscription_id; + struct OpenAPI_eps_interworking_info_s *eps_interworking_info; int ue_srvcc_capability; - char *nid; char *registration_time; - char *vgmlc_address_ipv4; - char *vgmlc_address_ipv6; - char *vgmlc_fqdn; + struct OpenAPI_vgmlc_address_s *vgmlc_address; + struct OpenAPI_context_info_s *context_info; + int no_ee_subscription_ind; } OpenAPI_amf3_gpp_access_registration_t; OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_create( @@ -64,12 +67,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, + OpenAPI_eps_interworking_info_t *eps_interworking_info, int ue_srvcc_capability, - char *nid, char *registration_time, - char *vgmlc_address_ipv4, - char *vgmlc_address_ipv6, - char *vgmlc_fqdn + OpenAPI_vgmlc_address_t *vgmlc_address, + OpenAPI_context_info_t *context_info, + int no_ee_subscription_ind ); void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration); OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_parseFromJSON(cJSON *amf3_gpp_access_registrationJSON); diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c index 43227d597..edb2b4043 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c @@ -11,7 +11,8 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg OpenAPI_ims_vo_ps_t *ims_vo_ps, OpenAPI_list_t *backup_amf_info, OpenAPI_eps_interworking_info_t *eps_interworking_info, - int ue_srvcc_capability + int ue_srvcc_capability, + int no_ee_subscription_ind ) { OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf3_gpp_access_registration_modification_t)); @@ -25,6 +26,7 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg amf3_gpp_access_registration_modification_local_var->backup_amf_info = backup_amf_info; amf3_gpp_access_registration_modification_local_var->eps_interworking_info = eps_interworking_info; amf3_gpp_access_registration_modification_local_var->ue_srvcc_capability = ue_srvcc_capability; + amf3_gpp_access_registration_modification_local_var->no_ee_subscription_ind = no_ee_subscription_ind; return amf3_gpp_access_registration_modification_local_var; } @@ -138,6 +140,13 @@ cJSON *OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(OpenAPI_a } } + if (amf3_gpp_access_registration_modification->no_ee_subscription_ind) { + if (cJSON_AddBoolToObject(item, "noEeSubscriptionInd", amf3_gpp_access_registration_modification->no_ee_subscription_ind) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed [no_ee_subscription_ind]"); + goto end; + } + } + end: return item; } @@ -219,6 +228,15 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg } } + cJSON *no_ee_subscription_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registration_modificationJSON, "noEeSubscriptionInd"); + + if (no_ee_subscription_ind) { + if (!cJSON_IsBool(no_ee_subscription_ind)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON() failed [no_ee_subscription_ind]"); + goto end; + } + } + amf3_gpp_access_registration_modification_local_var = OpenAPI_amf3_gpp_access_registration_modification_create ( guami_local_nonprim, purge_flag ? purge_flag->valueint : 0, @@ -226,7 +244,8 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg ims_vo_ps ? ims_vo_ps_local_nonprim : NULL, backup_amf_info ? backup_amf_infoList : NULL, eps_interworking_info ? eps_interworking_info_local_nonprim : NULL, - ue_srvcc_capability ? ue_srvcc_capability->valueint : 0 + ue_srvcc_capability ? ue_srvcc_capability->valueint : 0, + no_ee_subscription_ind ? no_ee_subscription_ind->valueint : 0 ); return amf3_gpp_access_registration_modification_local_var; diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h index 600c39782..004f9cc25 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h @@ -30,6 +30,7 @@ typedef struct OpenAPI_amf3_gpp_access_registration_modification_s { OpenAPI_list_t *backup_amf_info; struct OpenAPI_eps_interworking_info_s *eps_interworking_info; int ue_srvcc_capability; + int no_ee_subscription_ind; } OpenAPI_amf3_gpp_access_registration_modification_t; OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_create( @@ -39,7 +40,8 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg OpenAPI_ims_vo_ps_t *ims_vo_ps, OpenAPI_list_t *backup_amf_info, OpenAPI_eps_interworking_info_t *eps_interworking_info, - int ue_srvcc_capability + int ue_srvcc_capability, + int no_ee_subscription_ind ); void OpenAPI_amf3_gpp_access_registration_modification_free(OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification); OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON(cJSON *amf3_gpp_access_registration_modificationJSON); diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c index ed6b6853f..e73a5394d 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c @@ -19,11 +19,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, - char *nid, char *registration_time, - char *vgmlc_address_ipv4, - char *vgmlc_address_ipv6, - char *vgmlc_fqdn + OpenAPI_vgmlc_address_t *vgmlc_address, + OpenAPI_context_info_t *context_info ) { OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_non3_gpp_access_registration_t)); @@ -44,11 +42,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra amf_non3_gpp_access_registration_local_var->rat_type = rat_type; amf_non3_gpp_access_registration_local_var->urrp_indicator = urrp_indicator; amf_non3_gpp_access_registration_local_var->amf_ee_subscription_id = amf_ee_subscription_id; - amf_non3_gpp_access_registration_local_var->nid = nid; amf_non3_gpp_access_registration_local_var->registration_time = registration_time; - amf_non3_gpp_access_registration_local_var->vgmlc_address_ipv4 = vgmlc_address_ipv4; - amf_non3_gpp_access_registration_local_var->vgmlc_address_ipv6 = vgmlc_address_ipv6; - amf_non3_gpp_access_registration_local_var->vgmlc_fqdn = vgmlc_fqdn; + amf_non3_gpp_access_registration_local_var->vgmlc_address = vgmlc_address; + amf_non3_gpp_access_registration_local_var->context_info = context_info; return amf_non3_gpp_access_registration_local_var; } @@ -73,11 +69,9 @@ void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_r } OpenAPI_list_free(amf_non3_gpp_access_registration->backup_amf_info); ogs_free(amf_non3_gpp_access_registration->amf_ee_subscription_id); - ogs_free(amf_non3_gpp_access_registration->nid); ogs_free(amf_non3_gpp_access_registration->registration_time); - ogs_free(amf_non3_gpp_access_registration->vgmlc_address_ipv4); - ogs_free(amf_non3_gpp_access_registration->vgmlc_address_ipv6); - ogs_free(amf_non3_gpp_access_registration->vgmlc_fqdn); + OpenAPI_vgmlc_address_free(amf_non3_gpp_access_registration->vgmlc_address); + OpenAPI_context_info_free(amf_non3_gpp_access_registration->context_info); ogs_free(amf_non3_gpp_access_registration); } @@ -224,13 +218,6 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g } } - if (amf_non3_gpp_access_registration->nid) { - if (cJSON_AddStringToObject(item, "nid", amf_non3_gpp_access_registration->nid) == NULL) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [nid]"); - goto end; - } - } - if (amf_non3_gpp_access_registration->registration_time) { if (cJSON_AddStringToObject(item, "registrationTime", amf_non3_gpp_access_registration->registration_time) == NULL) { ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [registration_time]"); @@ -238,23 +225,28 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g } } - if (amf_non3_gpp_access_registration->vgmlc_address_ipv4) { - if (cJSON_AddStringToObject(item, "vgmlcAddressIpv4", amf_non3_gpp_access_registration->vgmlc_address_ipv4) == NULL) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv4]"); + if (amf_non3_gpp_access_registration->vgmlc_address) { + cJSON *vgmlc_address_local_JSON = OpenAPI_vgmlc_address_convertToJSON(amf_non3_gpp_access_registration->vgmlc_address); + if (vgmlc_address_local_JSON == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address]"); + goto end; + } + cJSON_AddItemToObject(item, "vgmlcAddress", vgmlc_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address]"); goto end; } } - if (amf_non3_gpp_access_registration->vgmlc_address_ipv6) { - if (cJSON_AddStringToObject(item, "vgmlcAddressIpv6", amf_non3_gpp_access_registration->vgmlc_address_ipv6) == NULL) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv6]"); + if (amf_non3_gpp_access_registration->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(amf_non3_gpp_access_registration->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [context_info]"); goto end; } - } - - if (amf_non3_gpp_access_registration->vgmlc_fqdn) { - if (cJSON_AddStringToObject(item, "vgmlcFqdn", amf_non3_gpp_access_registration->vgmlc_fqdn) == NULL) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_fqdn]"); + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [context_info]"); goto end; } } @@ -419,15 +411,6 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra } } - cJSON *nid = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "nid"); - - if (nid) { - if (!cJSON_IsString(nid)) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [nid]"); - goto end; - } - } - cJSON *registration_time = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "registrationTime"); if (registration_time) { @@ -437,31 +420,18 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra } } - cJSON *vgmlc_address_ipv4 = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcAddressIpv4"); + cJSON *vgmlc_address = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcAddress"); - if (vgmlc_address_ipv4) { - if (!cJSON_IsString(vgmlc_address_ipv4)) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv4]"); - goto end; - } + OpenAPI_vgmlc_address_t *vgmlc_address_local_nonprim = NULL; + if (vgmlc_address) { + vgmlc_address_local_nonprim = OpenAPI_vgmlc_address_parseFromJSON(vgmlc_address); } - cJSON *vgmlc_address_ipv6 = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcAddressIpv6"); + cJSON *context_info = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "contextInfo"); - if (vgmlc_address_ipv6) { - if (!cJSON_IsString(vgmlc_address_ipv6)) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv6]"); - goto end; - } - } - - cJSON *vgmlc_fqdn = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcFqdn"); - - if (vgmlc_fqdn) { - if (!cJSON_IsString(vgmlc_fqdn)) { - ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [vgmlc_fqdn]"); - goto end; - } + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); } amf_non3_gpp_access_registration_local_var = OpenAPI_amf_non3_gpp_access_registration_create ( @@ -479,11 +449,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra rat_typeVariable, urrp_indicator ? urrp_indicator->valueint : 0, amf_ee_subscription_id ? ogs_strdup(amf_ee_subscription_id->valuestring) : NULL, - nid ? ogs_strdup(nid->valuestring) : NULL, registration_time ? ogs_strdup(registration_time->valuestring) : NULL, - vgmlc_address_ipv4 ? ogs_strdup(vgmlc_address_ipv4->valuestring) : NULL, - vgmlc_address_ipv6 ? ogs_strdup(vgmlc_address_ipv6->valuestring) : NULL, - vgmlc_fqdn ? ogs_strdup(vgmlc_fqdn->valuestring) : NULL + vgmlc_address ? vgmlc_address_local_nonprim : NULL, + context_info ? context_info_local_nonprim : NULL ); return amf_non3_gpp_access_registration_local_var; diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h index 9a2144622..668314d9b 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h @@ -13,9 +13,11 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "backup_amf_info.h" +#include "context_info.h" #include "guami.h" #include "ims_vo_ps.h" #include "rat_type.h" +#include "vgmlc_address.h" #ifdef __cplusplus extern "C" { @@ -37,11 +39,9 @@ typedef struct OpenAPI_amf_non3_gpp_access_registration_s { OpenAPI_rat_type_e rat_type; int urrp_indicator; char *amf_ee_subscription_id; - char *nid; char *registration_time; - char *vgmlc_address_ipv4; - char *vgmlc_address_ipv6; - char *vgmlc_fqdn; + struct OpenAPI_vgmlc_address_s *vgmlc_address; + struct OpenAPI_context_info_s *context_info; } OpenAPI_amf_non3_gpp_access_registration_t; OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_create( @@ -59,11 +59,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra OpenAPI_rat_type_e rat_type, int urrp_indicator, char *amf_ee_subscription_id, - char *nid, char *registration_time, - char *vgmlc_address_ipv4, - char *vgmlc_address_ipv6, - char *vgmlc_fqdn + OpenAPI_vgmlc_address_t *vgmlc_address, + OpenAPI_context_info_t *context_info ); void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration); OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_parseFromJSON(cJSON *amf_non3_gpp_access_registrationJSON); diff --git a/lib/sbi/openapi/model/an_node_type.c b/lib/sbi/openapi/model/an_node_type.c index de3750a32..80cc50438 100644 --- a/lib/sbi/openapi/model/an_node_type.c +++ b/lib/sbi/openapi/model/an_node_type.c @@ -4,82 +4,27 @@ #include #include "an_node_type.h" -OpenAPI_an_node_type_t *OpenAPI_an_node_type_create( - ) +char* OpenAPI_an_node_type_ToString(OpenAPI_an_node_type_e an_node_type) { - OpenAPI_an_node_type_t *an_node_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_an_node_type_t)); - if (!an_node_type_local_var) { - return NULL; - } - - return an_node_type_local_var; + const char *an_node_typeArray[] = { "NULL", "GNB", "NG_ENB" }; + size_t sizeofArray = sizeof(an_node_typeArray) / sizeof(an_node_typeArray[0]); + if (an_node_type < sizeofArray) + return (char *)an_node_typeArray[an_node_type]; + else + return (char *)"Unknown"; } -void OpenAPI_an_node_type_free(OpenAPI_an_node_type_t *an_node_type) +OpenAPI_an_node_type_e OpenAPI_an_node_type_FromString(char* an_node_type) { - if (NULL == an_node_type) { - return; + int stringToReturn = 0; + const char *an_node_typeArray[] = { "NULL", "GNB", "NG_ENB" }; + size_t sizeofArray = sizeof(an_node_typeArray) / sizeof(an_node_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(an_node_type, an_node_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(an_node_type); -} - -cJSON *OpenAPI_an_node_type_convertToJSON(OpenAPI_an_node_type_t *an_node_type) -{ - cJSON *item = NULL; - - if (an_node_type == NULL) { - ogs_error("OpenAPI_an_node_type_convertToJSON() failed [AnNodeType]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_an_node_type_t *OpenAPI_an_node_type_parseFromJSON(cJSON *an_node_typeJSON) -{ - OpenAPI_an_node_type_t *an_node_type_local_var = NULL; - an_node_type_local_var = OpenAPI_an_node_type_create ( - ); - - return an_node_type_local_var; -end: - return NULL; -} - -OpenAPI_an_node_type_t *OpenAPI_an_node_type_copy(OpenAPI_an_node_type_t *dst, OpenAPI_an_node_type_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_an_node_type_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_an_node_type_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_an_node_type_free(dst); - dst = OpenAPI_an_node_type_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/an_node_type.h b/lib/sbi/openapi/model/an_node_type.h index b608fb315..674c9fcff 100644 --- a/lib/sbi/openapi/model/an_node_type.h +++ b/lib/sbi/openapi/model/an_node_type.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_an_node_type_s OpenAPI_an_node_type_t; -typedef struct OpenAPI_an_node_type_s { -} OpenAPI_an_node_type_t; +typedef enum { OpenAPI_an_node_type_NULL = 0, OpenAPI_an_node_type_GNB, OpenAPI_an_node_type_NG_ENB } OpenAPI_an_node_type_e; -OpenAPI_an_node_type_t *OpenAPI_an_node_type_create( - ); -void OpenAPI_an_node_type_free(OpenAPI_an_node_type_t *an_node_type); -OpenAPI_an_node_type_t *OpenAPI_an_node_type_parseFromJSON(cJSON *an_node_typeJSON); -cJSON *OpenAPI_an_node_type_convertToJSON(OpenAPI_an_node_type_t *an_node_type); -OpenAPI_an_node_type_t *OpenAPI_an_node_type_copy(OpenAPI_an_node_type_t *dst, OpenAPI_an_node_type_t *src); +char* OpenAPI_an_node_type_ToString(OpenAPI_an_node_type_e an_node_type); + +OpenAPI_an_node_type_e OpenAPI_an_node_type_FromString(char* an_node_type); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/area_scope.c b/lib/sbi/openapi/model/area_scope.c new file mode 100644 index 000000000..110bd8e66 --- /dev/null +++ b/lib/sbi/openapi/model/area_scope.c @@ -0,0 +1,267 @@ + +#include +#include +#include +#include "area_scope.h" + +OpenAPI_area_scope_t *OpenAPI_area_scope_create( + OpenAPI_list_t *eutra_cell_id_list, + OpenAPI_list_t *nr_cell_id_list, + OpenAPI_list_t *tac_list, + OpenAPI_list_t* tac_info_per_plmn + ) +{ + OpenAPI_area_scope_t *area_scope_local_var = OpenAPI_malloc(sizeof(OpenAPI_area_scope_t)); + if (!area_scope_local_var) { + return NULL; + } + area_scope_local_var->eutra_cell_id_list = eutra_cell_id_list; + area_scope_local_var->nr_cell_id_list = nr_cell_id_list; + area_scope_local_var->tac_list = tac_list; + area_scope_local_var->tac_info_per_plmn = tac_info_per_plmn; + + return area_scope_local_var; +} + +void OpenAPI_area_scope_free(OpenAPI_area_scope_t *area_scope) +{ + if (NULL == area_scope) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(area_scope->eutra_cell_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(area_scope->eutra_cell_id_list); + OpenAPI_list_for_each(area_scope->nr_cell_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(area_scope->nr_cell_id_list); + OpenAPI_list_for_each(area_scope->tac_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(area_scope->tac_list); + OpenAPI_list_for_each(area_scope->tac_info_per_plmn, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_tac_info_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(area_scope->tac_info_per_plmn); + ogs_free(area_scope); +} + +cJSON *OpenAPI_area_scope_convertToJSON(OpenAPI_area_scope_t *area_scope) +{ + cJSON *item = NULL; + + if (area_scope == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [AreaScope]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (area_scope->eutra_cell_id_list) { + cJSON *eutra_cell_id_list = cJSON_AddArrayToObject(item, "eutraCellIdList"); + if (eutra_cell_id_list == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [eutra_cell_id_list]"); + goto end; + } + + OpenAPI_lnode_t *eutra_cell_id_list_node; + OpenAPI_list_for_each(area_scope->eutra_cell_id_list, eutra_cell_id_list_node) { + if (cJSON_AddStringToObject(eutra_cell_id_list, "", (char*)eutra_cell_id_list_node->data) == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [eutra_cell_id_list]"); + goto end; + } + } + } + + if (area_scope->nr_cell_id_list) { + cJSON *nr_cell_id_list = cJSON_AddArrayToObject(item, "nrCellIdList"); + if (nr_cell_id_list == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [nr_cell_id_list]"); + goto end; + } + + OpenAPI_lnode_t *nr_cell_id_list_node; + OpenAPI_list_for_each(area_scope->nr_cell_id_list, nr_cell_id_list_node) { + if (cJSON_AddStringToObject(nr_cell_id_list, "", (char*)nr_cell_id_list_node->data) == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [nr_cell_id_list]"); + goto end; + } + } + } + + if (area_scope->tac_list) { + cJSON *tac_list = cJSON_AddArrayToObject(item, "tacList"); + if (tac_list == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_list]"); + goto end; + } + + OpenAPI_lnode_t *tac_list_node; + OpenAPI_list_for_each(area_scope->tac_list, tac_list_node) { + if (cJSON_AddStringToObject(tac_list, "", (char*)tac_list_node->data) == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_list]"); + goto end; + } + } + } + + if (area_scope->tac_info_per_plmn) { + cJSON *tac_info_per_plmn = cJSON_AddObjectToObject(item, "tacInfoPerPlmn"); + if (tac_info_per_plmn == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_info_per_plmn]"); + goto end; + } + cJSON *localMapObject = tac_info_per_plmn; + OpenAPI_lnode_t *tac_info_per_plmn_node; + if (area_scope->tac_info_per_plmn) { + OpenAPI_list_for_each(area_scope->tac_info_per_plmn, tac_info_per_plmn_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)tac_info_per_plmn_node->data; + cJSON *itemLocal = OpenAPI_tac_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_info_per_plmn]"); + goto end; + } + cJSON_AddItemToObject(tac_info_per_plmn, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_area_scope_t *OpenAPI_area_scope_parseFromJSON(cJSON *area_scopeJSON) +{ + OpenAPI_area_scope_t *area_scope_local_var = NULL; + cJSON *eutra_cell_id_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "eutraCellIdList"); + + OpenAPI_list_t *eutra_cell_id_listList; + if (eutra_cell_id_list) { + cJSON *eutra_cell_id_list_local; + if (!cJSON_IsArray(eutra_cell_id_list)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [eutra_cell_id_list]"); + goto end; + } + eutra_cell_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eutra_cell_id_list_local, eutra_cell_id_list) { + if (!cJSON_IsString(eutra_cell_id_list_local)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [eutra_cell_id_list]"); + goto end; + } + OpenAPI_list_add(eutra_cell_id_listList, ogs_strdup(eutra_cell_id_list_local->valuestring)); + } + } + + cJSON *nr_cell_id_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "nrCellIdList"); + + OpenAPI_list_t *nr_cell_id_listList; + if (nr_cell_id_list) { + cJSON *nr_cell_id_list_local; + if (!cJSON_IsArray(nr_cell_id_list)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nr_cell_id_list]"); + goto end; + } + nr_cell_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nr_cell_id_list_local, nr_cell_id_list) { + if (!cJSON_IsString(nr_cell_id_list_local)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nr_cell_id_list]"); + goto end; + } + OpenAPI_list_add(nr_cell_id_listList, ogs_strdup(nr_cell_id_list_local->valuestring)); + } + } + + cJSON *tac_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "tacList"); + + OpenAPI_list_t *tac_listList; + if (tac_list) { + cJSON *tac_list_local; + if (!cJSON_IsArray(tac_list)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_list]"); + goto end; + } + tac_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tac_list_local, tac_list) { + if (!cJSON_IsString(tac_list_local)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_list]"); + goto end; + } + OpenAPI_list_add(tac_listList, ogs_strdup(tac_list_local->valuestring)); + } + } + + cJSON *tac_info_per_plmn = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "tacInfoPerPlmn"); + + OpenAPI_list_t *tac_info_per_plmnList; + if (tac_info_per_plmn) { + cJSON *tac_info_per_plmn_local_map; + if (!cJSON_IsObject(tac_info_per_plmn)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_info_per_plmn]"); + goto end; + } + tac_info_per_plmnList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(tac_info_per_plmn_local_map, tac_info_per_plmn) { + cJSON *localMapObject = tac_info_per_plmn_local_map; + if (!cJSON_IsObject(tac_info_per_plmn_local_map)) { + ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_info_per_plmn]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_tac_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(tac_info_per_plmnList, localMapKeyPair); + } + } + + area_scope_local_var = OpenAPI_area_scope_create ( + eutra_cell_id_list ? eutra_cell_id_listList : NULL, + nr_cell_id_list ? nr_cell_id_listList : NULL, + tac_list ? tac_listList : NULL, + tac_info_per_plmn ? tac_info_per_plmnList : NULL + ); + + return area_scope_local_var; +end: + return NULL; +} + +OpenAPI_area_scope_t *OpenAPI_area_scope_copy(OpenAPI_area_scope_t *dst, OpenAPI_area_scope_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_area_scope_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_area_scope_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_area_scope_free(dst); + dst = OpenAPI_area_scope_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/area_scope.h b/lib/sbi/openapi/model/area_scope.h new file mode 100644 index 000000000..a0b29fd03 --- /dev/null +++ b/lib/sbi/openapi/model/area_scope.h @@ -0,0 +1,45 @@ +/* + * area_scope.h + * + * + */ + +#ifndef _OpenAPI_area_scope_H_ +#define _OpenAPI_area_scope_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "tac_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_area_scope_s OpenAPI_area_scope_t; +typedef struct OpenAPI_area_scope_s { + OpenAPI_list_t *eutra_cell_id_list; + OpenAPI_list_t *nr_cell_id_list; + OpenAPI_list_t *tac_list; + OpenAPI_list_t* tac_info_per_plmn; +} OpenAPI_area_scope_t; + +OpenAPI_area_scope_t *OpenAPI_area_scope_create( + OpenAPI_list_t *eutra_cell_id_list, + OpenAPI_list_t *nr_cell_id_list, + OpenAPI_list_t *tac_list, + OpenAPI_list_t* tac_info_per_plmn + ); +void OpenAPI_area_scope_free(OpenAPI_area_scope_t *area_scope); +OpenAPI_area_scope_t *OpenAPI_area_scope_parseFromJSON(cJSON *area_scopeJSON); +cJSON *OpenAPI_area_scope_convertToJSON(OpenAPI_area_scope_t *area_scope); +OpenAPI_area_scope_t *OpenAPI_area_scope_copy(OpenAPI_area_scope_t *dst, OpenAPI_area_scope_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_area_scope_H_ */ + diff --git a/lib/sbi/openapi/model/atsss_capability.c b/lib/sbi/openapi/model/atsss_capability.c index 432e87662..39f9a3db4 100644 --- a/lib/sbi/openapi/model/atsss_capability.c +++ b/lib/sbi/openapi/model/atsss_capability.c @@ -6,7 +6,8 @@ OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create( int atsss_ll, - int mptcp + int mptcp, + int rtt_without_pmf ) { OpenAPI_atsss_capability_t *atsss_capability_local_var = OpenAPI_malloc(sizeof(OpenAPI_atsss_capability_t)); @@ -15,6 +16,7 @@ OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create( } atsss_capability_local_var->atsss_ll = atsss_ll; atsss_capability_local_var->mptcp = mptcp; + atsss_capability_local_var->rtt_without_pmf = rtt_without_pmf; return atsss_capability_local_var; } @@ -52,6 +54,13 @@ cJSON *OpenAPI_atsss_capability_convertToJSON(OpenAPI_atsss_capability_t *atsss_ } } + if (atsss_capability->rtt_without_pmf) { + if (cJSON_AddBoolToObject(item, "rttWithoutPmf", atsss_capability->rtt_without_pmf) == NULL) { + ogs_error("OpenAPI_atsss_capability_convertToJSON() failed [rtt_without_pmf]"); + goto end; + } + } + end: return item; } @@ -77,9 +86,19 @@ OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_parseFromJSON(cJSON *atsss_ } } + cJSON *rtt_without_pmf = cJSON_GetObjectItemCaseSensitive(atsss_capabilityJSON, "rttWithoutPmf"); + + if (rtt_without_pmf) { + if (!cJSON_IsBool(rtt_without_pmf)) { + ogs_error("OpenAPI_atsss_capability_parseFromJSON() failed [rtt_without_pmf]"); + goto end; + } + } + atsss_capability_local_var = OpenAPI_atsss_capability_create ( atsss_ll ? atsss_ll->valueint : 0, - mptcp ? mptcp->valueint : 0 + mptcp ? mptcp->valueint : 0, + rtt_without_pmf ? rtt_without_pmf->valueint : 0 ); return atsss_capability_local_var; diff --git a/lib/sbi/openapi/model/atsss_capability.h b/lib/sbi/openapi/model/atsss_capability.h index 06489c3cb..d49bc6565 100644 --- a/lib/sbi/openapi/model/atsss_capability.h +++ b/lib/sbi/openapi/model/atsss_capability.h @@ -21,11 +21,13 @@ typedef struct OpenAPI_atsss_capability_s OpenAPI_atsss_capability_t; typedef struct OpenAPI_atsss_capability_s { int atsss_ll; int mptcp; + int rtt_without_pmf; } OpenAPI_atsss_capability_t; OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create( int atsss_ll, - int mptcp + int mptcp, + int rtt_without_pmf ); void OpenAPI_atsss_capability_free(OpenAPI_atsss_capability_t *atsss_capability); OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_parseFromJSON(cJSON *atsss_capabilityJSON); diff --git a/lib/sbi/openapi/model/auth_event.c b/lib/sbi/openapi/model/auth_event.c index c427bf3a5..e455c98c2 100644 --- a/lib/sbi/openapi/model/auth_event.c +++ b/lib/sbi/openapi/model/auth_event.c @@ -9,7 +9,8 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create( int success, char *time_stamp, OpenAPI_auth_type_e auth_type, - char *serving_network_name + char *serving_network_name, + int auth_removal_ind ) { OpenAPI_auth_event_t *auth_event_local_var = OpenAPI_malloc(sizeof(OpenAPI_auth_event_t)); @@ -21,6 +22,7 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create( auth_event_local_var->time_stamp = time_stamp; auth_event_local_var->auth_type = auth_type; auth_event_local_var->serving_network_name = serving_network_name; + auth_event_local_var->auth_removal_ind = auth_removal_ind; return auth_event_local_var; } @@ -88,6 +90,13 @@ cJSON *OpenAPI_auth_event_convertToJSON(OpenAPI_auth_event_t *auth_event) goto end; } + if (auth_event->auth_removal_ind) { + if (cJSON_AddBoolToObject(item, "authRemovalInd", auth_event->auth_removal_ind) == NULL) { + ogs_error("OpenAPI_auth_event_convertToJSON() failed [auth_removal_ind]"); + goto end; + } + } + end: return item; } @@ -157,12 +166,22 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON) goto end; } + cJSON *auth_removal_ind = cJSON_GetObjectItemCaseSensitive(auth_eventJSON, "authRemovalInd"); + + if (auth_removal_ind) { + if (!cJSON_IsBool(auth_removal_ind)) { + ogs_error("OpenAPI_auth_event_parseFromJSON() failed [auth_removal_ind]"); + goto end; + } + } + auth_event_local_var = OpenAPI_auth_event_create ( ogs_strdup(nf_instance_id->valuestring), success->valueint, ogs_strdup(time_stamp->valuestring), auth_typeVariable, - ogs_strdup(serving_network_name->valuestring) + ogs_strdup(serving_network_name->valuestring), + auth_removal_ind ? auth_removal_ind->valueint : 0 ); return auth_event_local_var; diff --git a/lib/sbi/openapi/model/auth_event.h b/lib/sbi/openapi/model/auth_event.h index fee6dd1de..8f894ae26 100644 --- a/lib/sbi/openapi/model/auth_event.h +++ b/lib/sbi/openapi/model/auth_event.h @@ -25,6 +25,7 @@ typedef struct OpenAPI_auth_event_s { char *time_stamp; OpenAPI_auth_type_e auth_type; char *serving_network_name; + int auth_removal_ind; } OpenAPI_auth_event_t; OpenAPI_auth_event_t *OpenAPI_auth_event_create( @@ -32,7 +33,8 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create( int success, char *time_stamp, OpenAPI_auth_type_e auth_type, - char *serving_network_name + char *serving_network_name, + int auth_removal_ind ); void OpenAPI_auth_event_free(OpenAPI_auth_event_t *auth_event); OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON); diff --git a/lib/sbi/openapi/model/authentication_info_request.c b/lib/sbi/openapi/model/authentication_info_request.c index 4c2962337..e009be7f4 100644 --- a/lib/sbi/openapi/model/authentication_info_request.c +++ b/lib/sbi/openapi/model/authentication_info_request.c @@ -9,7 +9,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat char *serving_network_name, OpenAPI_resynchronization_info_t *resynchronization_info, char *ausf_instance_id, - char *cag_id + OpenAPI_list_t *cell_cag_info, + int n5gc_ind ) { OpenAPI_authentication_info_request_t *authentication_info_request_local_var = OpenAPI_malloc(sizeof(OpenAPI_authentication_info_request_t)); @@ -20,7 +21,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat authentication_info_request_local_var->serving_network_name = serving_network_name; authentication_info_request_local_var->resynchronization_info = resynchronization_info; authentication_info_request_local_var->ausf_instance_id = ausf_instance_id; - authentication_info_request_local_var->cag_id = cag_id; + authentication_info_request_local_var->cell_cag_info = cell_cag_info; + authentication_info_request_local_var->n5gc_ind = n5gc_ind; return authentication_info_request_local_var; } @@ -35,7 +37,10 @@ void OpenAPI_authentication_info_request_free(OpenAPI_authentication_info_reques ogs_free(authentication_info_request->serving_network_name); OpenAPI_resynchronization_info_free(authentication_info_request->resynchronization_info); ogs_free(authentication_info_request->ausf_instance_id); - ogs_free(authentication_info_request->cag_id); + OpenAPI_list_for_each(authentication_info_request->cell_cag_info, node) { + ogs_free(node->data); + } + OpenAPI_list_free(authentication_info_request->cell_cag_info); ogs_free(authentication_info_request); } @@ -87,9 +92,25 @@ cJSON *OpenAPI_authentication_info_request_convertToJSON(OpenAPI_authentication_ goto end; } - if (authentication_info_request->cag_id) { - if (cJSON_AddStringToObject(item, "cagId", authentication_info_request->cag_id) == NULL) { - ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cag_id]"); + if (authentication_info_request->cell_cag_info) { + cJSON *cell_cag_info = cJSON_AddArrayToObject(item, "cellCagInfo"); + if (cell_cag_info == NULL) { + ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cell_cag_info]"); + goto end; + } + + OpenAPI_lnode_t *cell_cag_info_node; + OpenAPI_list_for_each(authentication_info_request->cell_cag_info, cell_cag_info_node) { + if (cJSON_AddStringToObject(cell_cag_info, "", (char*)cell_cag_info_node->data) == NULL) { + ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cell_cag_info]"); + goto end; + } + } + } + + if (authentication_info_request->n5gc_ind) { + if (cJSON_AddBoolToObject(item, "n5gcInd", authentication_info_request->n5gc_ind) == NULL) { + ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [n5gc_ind]"); goto end; } } @@ -141,11 +162,31 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse goto end; } - cJSON *cag_id = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "cagId"); + cJSON *cell_cag_info = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "cellCagInfo"); - if (cag_id) { - if (!cJSON_IsString(cag_id)) { - ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cag_id]"); + OpenAPI_list_t *cell_cag_infoList; + if (cell_cag_info) { + cJSON *cell_cag_info_local; + if (!cJSON_IsArray(cell_cag_info)) { + ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]"); + goto end; + } + cell_cag_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cell_cag_info_local, cell_cag_info) { + if (!cJSON_IsString(cell_cag_info_local)) { + ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]"); + goto end; + } + OpenAPI_list_add(cell_cag_infoList, ogs_strdup(cell_cag_info_local->valuestring)); + } + } + + cJSON *n5gc_ind = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "n5gcInd"); + + if (n5gc_ind) { + if (!cJSON_IsBool(n5gc_ind)) { + ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [n5gc_ind]"); goto end; } } @@ -155,7 +196,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse ogs_strdup(serving_network_name->valuestring), resynchronization_info ? resynchronization_info_local_nonprim : NULL, ogs_strdup(ausf_instance_id->valuestring), - cag_id ? ogs_strdup(cag_id->valuestring) : NULL + cell_cag_info ? cell_cag_infoList : NULL, + n5gc_ind ? n5gc_ind->valueint : 0 ); return authentication_info_request_local_var; diff --git a/lib/sbi/openapi/model/authentication_info_request.h b/lib/sbi/openapi/model/authentication_info_request.h index 13c65ace9..abb7a9a22 100644 --- a/lib/sbi/openapi/model/authentication_info_request.h +++ b/lib/sbi/openapi/model/authentication_info_request.h @@ -24,7 +24,8 @@ typedef struct OpenAPI_authentication_info_request_s { char *serving_network_name; struct OpenAPI_resynchronization_info_s *resynchronization_info; char *ausf_instance_id; - char *cag_id; + OpenAPI_list_t *cell_cag_info; + int n5gc_ind; } OpenAPI_authentication_info_request_t; OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_create( @@ -32,7 +33,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat char *serving_network_name, OpenAPI_resynchronization_info_t *resynchronization_info, char *ausf_instance_id, - char *cag_id + OpenAPI_list_t *cell_cag_info, + int n5gc_ind ); void OpenAPI_authentication_info_request_free(OpenAPI_authentication_info_request_t *authentication_info_request); OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parseFromJSON(cJSON *authentication_info_requestJSON); diff --git a/lib/sbi/openapi/model/authentication_subscription.c b/lib/sbi/openapi/model/authentication_subscription.c index 0481704fe..e01330986 100644 --- a/lib/sbi/openapi/model/authentication_subscription.c +++ b/lib/sbi/openapi/model/authentication_subscription.c @@ -13,7 +13,10 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat char *algorithm_id, char *enc_opc_key, char *enc_topc_key, - int vector_generation_in_hss + int vector_generation_in_hss, + OpenAPI_auth_method_e n5gc_auth_method, + int rg_authentication_ind, + char *supi ) { OpenAPI_authentication_subscription_t *authentication_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_authentication_subscription_t)); @@ -29,6 +32,9 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat authentication_subscription_local_var->enc_opc_key = enc_opc_key; authentication_subscription_local_var->enc_topc_key = enc_topc_key; authentication_subscription_local_var->vector_generation_in_hss = vector_generation_in_hss; + authentication_subscription_local_var->n5gc_auth_method = n5gc_auth_method; + authentication_subscription_local_var->rg_authentication_ind = rg_authentication_ind; + authentication_subscription_local_var->supi = supi; return authentication_subscription_local_var; } @@ -46,6 +52,7 @@ void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscriptio ogs_free(authentication_subscription->algorithm_id); ogs_free(authentication_subscription->enc_opc_key); ogs_free(authentication_subscription->enc_topc_key); + ogs_free(authentication_subscription->supi); ogs_free(authentication_subscription); } @@ -130,6 +137,27 @@ cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_ } } + if (authentication_subscription->n5gc_auth_method) { + if (cJSON_AddStringToObject(item, "n5gcAuthMethod", OpenAPI_auth_method_ToString(authentication_subscription->n5gc_auth_method)) == NULL) { + ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [n5gc_auth_method]"); + goto end; + } + } + + if (authentication_subscription->rg_authentication_ind) { + if (cJSON_AddBoolToObject(item, "rgAuthenticationInd", authentication_subscription->rg_authentication_ind) == NULL) { + ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [rg_authentication_ind]"); + goto end; + } + } + + if (authentication_subscription->supi) { + if (cJSON_AddStringToObject(item, "supi", authentication_subscription->supi) == NULL) { + ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [supi]"); + goto end; + } + } + end: return item; } @@ -221,6 +249,35 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse } } + cJSON *n5gc_auth_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "n5gcAuthMethod"); + + OpenAPI_auth_method_e n5gc_auth_methodVariable; + if (n5gc_auth_method) { + if (!cJSON_IsString(n5gc_auth_method)) { + ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [n5gc_auth_method]"); + goto end; + } + n5gc_auth_methodVariable = OpenAPI_auth_method_FromString(n5gc_auth_method->valuestring); + } + + cJSON *rg_authentication_ind = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "rgAuthenticationInd"); + + if (rg_authentication_ind) { + if (!cJSON_IsBool(rg_authentication_ind)) { + ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [rg_authentication_ind]"); + goto end; + } + } + + cJSON *supi = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "supi"); + + if (supi) { + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [supi]"); + goto end; + } + } + authentication_subscription_local_var = OpenAPI_authentication_subscription_create ( authentication_methodVariable, enc_permanent_key ? ogs_strdup(enc_permanent_key->valuestring) : NULL, @@ -230,7 +287,10 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse algorithm_id ? ogs_strdup(algorithm_id->valuestring) : NULL, enc_opc_key ? ogs_strdup(enc_opc_key->valuestring) : NULL, enc_topc_key ? ogs_strdup(enc_topc_key->valuestring) : NULL, - vector_generation_in_hss ? vector_generation_in_hss->valueint : 0 + vector_generation_in_hss ? vector_generation_in_hss->valueint : 0, + n5gc_auth_method ? n5gc_auth_methodVariable : 0, + rg_authentication_ind ? rg_authentication_ind->valueint : 0, + supi ? ogs_strdup(supi->valuestring) : NULL ); return authentication_subscription_local_var; diff --git a/lib/sbi/openapi/model/authentication_subscription.h b/lib/sbi/openapi/model/authentication_subscription.h index d1e9b411e..eee03e4a5 100644 --- a/lib/sbi/openapi/model/authentication_subscription.h +++ b/lib/sbi/openapi/model/authentication_subscription.h @@ -30,6 +30,9 @@ typedef struct OpenAPI_authentication_subscription_s { char *enc_opc_key; char *enc_topc_key; int vector_generation_in_hss; + OpenAPI_auth_method_e n5gc_auth_method; + int rg_authentication_ind; + char *supi; } OpenAPI_authentication_subscription_t; OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_create( @@ -41,7 +44,10 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat char *algorithm_id, char *enc_opc_key, char *enc_topc_key, - int vector_generation_in_hss + int vector_generation_in_hss, + OpenAPI_auth_method_e n5gc_auth_method, + int rg_authentication_ind, + char *supi ); void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscription_t *authentication_subscription); OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parseFromJSON(cJSON *authentication_subscriptionJSON); diff --git a/lib/sbi/openapi/model/authorized_network_slice_info.c b/lib/sbi/openapi/model/authorized_network_slice_info.c new file mode 100644 index 000000000..326615fd3 --- /dev/null +++ b/lib/sbi/openapi/model/authorized_network_slice_info.c @@ -0,0 +1,472 @@ + +#include +#include +#include +#include "authorized_network_slice_info.h" + +OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_create( + OpenAPI_list_t *allowed_nssai_list, + OpenAPI_list_t *configured_nssai, + char *target_amf_set, + OpenAPI_list_t *candidate_amf_list, + OpenAPI_list_t *rejected_nssai_in_plmn, + OpenAPI_list_t *rejected_nssai_in_ta, + OpenAPI_nsi_information_t *nsi_information, + char *supported_features, + char *nrf_amf_set, + char *nrf_amf_set_nf_mgt_uri, + char *nrf_amf_set_access_token_uri, + char *target_amf_service_set + ) +{ + OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_authorized_network_slice_info_t)); + if (!authorized_network_slice_info_local_var) { + return NULL; + } + authorized_network_slice_info_local_var->allowed_nssai_list = allowed_nssai_list; + authorized_network_slice_info_local_var->configured_nssai = configured_nssai; + authorized_network_slice_info_local_var->target_amf_set = target_amf_set; + authorized_network_slice_info_local_var->candidate_amf_list = candidate_amf_list; + authorized_network_slice_info_local_var->rejected_nssai_in_plmn = rejected_nssai_in_plmn; + authorized_network_slice_info_local_var->rejected_nssai_in_ta = rejected_nssai_in_ta; + authorized_network_slice_info_local_var->nsi_information = nsi_information; + authorized_network_slice_info_local_var->supported_features = supported_features; + authorized_network_slice_info_local_var->nrf_amf_set = nrf_amf_set; + authorized_network_slice_info_local_var->nrf_amf_set_nf_mgt_uri = nrf_amf_set_nf_mgt_uri; + authorized_network_slice_info_local_var->nrf_amf_set_access_token_uri = nrf_amf_set_access_token_uri; + authorized_network_slice_info_local_var->target_amf_service_set = target_amf_service_set; + + return authorized_network_slice_info_local_var; +} + +void OpenAPI_authorized_network_slice_info_free(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info) +{ + if (NULL == authorized_network_slice_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(authorized_network_slice_info->allowed_nssai_list, node) { + OpenAPI_allowed_nssai_free(node->data); + } + OpenAPI_list_free(authorized_network_slice_info->allowed_nssai_list); + OpenAPI_list_for_each(authorized_network_slice_info->configured_nssai, node) { + OpenAPI_configured_snssai_free(node->data); + } + OpenAPI_list_free(authorized_network_slice_info->configured_nssai); + ogs_free(authorized_network_slice_info->target_amf_set); + OpenAPI_list_for_each(authorized_network_slice_info->candidate_amf_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(authorized_network_slice_info->candidate_amf_list); + OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_plmn, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(authorized_network_slice_info->rejected_nssai_in_plmn); + OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_ta, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(authorized_network_slice_info->rejected_nssai_in_ta); + OpenAPI_nsi_information_free(authorized_network_slice_info->nsi_information); + ogs_free(authorized_network_slice_info->supported_features); + ogs_free(authorized_network_slice_info->nrf_amf_set); + ogs_free(authorized_network_slice_info->nrf_amf_set_nf_mgt_uri); + ogs_free(authorized_network_slice_info->nrf_amf_set_access_token_uri); + ogs_free(authorized_network_slice_info->target_amf_service_set); + ogs_free(authorized_network_slice_info); +} + +cJSON *OpenAPI_authorized_network_slice_info_convertToJSON(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info) +{ + cJSON *item = NULL; + + if (authorized_network_slice_info == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [AuthorizedNetworkSliceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (authorized_network_slice_info->allowed_nssai_list) { + cJSON *allowed_nssai_listList = cJSON_AddArrayToObject(item, "allowedNssaiList"); + if (allowed_nssai_listList == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [allowed_nssai_list]"); + goto end; + } + + OpenAPI_lnode_t *allowed_nssai_list_node; + if (authorized_network_slice_info->allowed_nssai_list) { + OpenAPI_list_for_each(authorized_network_slice_info->allowed_nssai_list, allowed_nssai_list_node) { + cJSON *itemLocal = OpenAPI_allowed_nssai_convertToJSON(allowed_nssai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [allowed_nssai_list]"); + goto end; + } + cJSON_AddItemToArray(allowed_nssai_listList, itemLocal); + } + } + } + + if (authorized_network_slice_info->configured_nssai) { + cJSON *configured_nssaiList = cJSON_AddArrayToObject(item, "configuredNssai"); + if (configured_nssaiList == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [configured_nssai]"); + goto end; + } + + OpenAPI_lnode_t *configured_nssai_node; + if (authorized_network_slice_info->configured_nssai) { + OpenAPI_list_for_each(authorized_network_slice_info->configured_nssai, configured_nssai_node) { + cJSON *itemLocal = OpenAPI_configured_snssai_convertToJSON(configured_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [configured_nssai]"); + goto end; + } + cJSON_AddItemToArray(configured_nssaiList, itemLocal); + } + } + } + + if (authorized_network_slice_info->target_amf_set) { + if (cJSON_AddStringToObject(item, "targetAmfSet", authorized_network_slice_info->target_amf_set) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [target_amf_set]"); + goto end; + } + } + + if (authorized_network_slice_info->candidate_amf_list) { + cJSON *candidate_amf_list = cJSON_AddArrayToObject(item, "candidateAmfList"); + if (candidate_amf_list == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [candidate_amf_list]"); + goto end; + } + + OpenAPI_lnode_t *candidate_amf_list_node; + OpenAPI_list_for_each(authorized_network_slice_info->candidate_amf_list, candidate_amf_list_node) { + if (cJSON_AddStringToObject(candidate_amf_list, "", (char*)candidate_amf_list_node->data) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [candidate_amf_list]"); + goto end; + } + } + } + + if (authorized_network_slice_info->rejected_nssai_in_plmn) { + cJSON *rejected_nssai_in_plmnList = cJSON_AddArrayToObject(item, "rejectedNssaiInPlmn"); + if (rejected_nssai_in_plmnList == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + + OpenAPI_lnode_t *rejected_nssai_in_plmn_node; + if (authorized_network_slice_info->rejected_nssai_in_plmn) { + OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_plmn, rejected_nssai_in_plmn_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(rejected_nssai_in_plmn_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + cJSON_AddItemToArray(rejected_nssai_in_plmnList, itemLocal); + } + } + } + + if (authorized_network_slice_info->rejected_nssai_in_ta) { + cJSON *rejected_nssai_in_taList = cJSON_AddArrayToObject(item, "rejectedNssaiInTa"); + if (rejected_nssai_in_taList == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + + OpenAPI_lnode_t *rejected_nssai_in_ta_node; + if (authorized_network_slice_info->rejected_nssai_in_ta) { + OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_ta, rejected_nssai_in_ta_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(rejected_nssai_in_ta_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + cJSON_AddItemToArray(rejected_nssai_in_taList, itemLocal); + } + } + } + + if (authorized_network_slice_info->nsi_information) { + cJSON *nsi_information_local_JSON = OpenAPI_nsi_information_convertToJSON(authorized_network_slice_info->nsi_information); + if (nsi_information_local_JSON == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nsi_information]"); + goto end; + } + cJSON_AddItemToObject(item, "nsiInformation", nsi_information_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nsi_information]"); + goto end; + } + } + + if (authorized_network_slice_info->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", authorized_network_slice_info->supported_features) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (authorized_network_slice_info->nrf_amf_set) { + if (cJSON_AddStringToObject(item, "nrfAmfSet", authorized_network_slice_info->nrf_amf_set) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nrf_amf_set]"); + goto end; + } + } + + if (authorized_network_slice_info->nrf_amf_set_nf_mgt_uri) { + if (cJSON_AddStringToObject(item, "nrfAmfSetNfMgtUri", authorized_network_slice_info->nrf_amf_set_nf_mgt_uri) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nrf_amf_set_nf_mgt_uri]"); + goto end; + } + } + + if (authorized_network_slice_info->nrf_amf_set_access_token_uri) { + if (cJSON_AddStringToObject(item, "nrfAmfSetAccessTokenUri", authorized_network_slice_info->nrf_amf_set_access_token_uri) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nrf_amf_set_access_token_uri]"); + goto end; + } + } + + if (authorized_network_slice_info->target_amf_service_set) { + if (cJSON_AddStringToObject(item, "targetAmfServiceSet", authorized_network_slice_info->target_amf_service_set) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [target_amf_service_set]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_parseFromJSON(cJSON *authorized_network_slice_infoJSON) +{ + OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info_local_var = NULL; + cJSON *allowed_nssai_list = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "allowedNssaiList"); + + OpenAPI_list_t *allowed_nssai_listList; + if (allowed_nssai_list) { + cJSON *allowed_nssai_list_local_nonprimitive; + if (!cJSON_IsArray(allowed_nssai_list)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [allowed_nssai_list]"); + goto end; + } + + allowed_nssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nssai_list_local_nonprimitive, allowed_nssai_list ) { + if (!cJSON_IsObject(allowed_nssai_list_local_nonprimitive)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [allowed_nssai_list]"); + goto end; + } + OpenAPI_allowed_nssai_t *allowed_nssai_listItem = OpenAPI_allowed_nssai_parseFromJSON(allowed_nssai_list_local_nonprimitive); + + OpenAPI_list_add(allowed_nssai_listList, allowed_nssai_listItem); + } + } + + cJSON *configured_nssai = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "configuredNssai"); + + OpenAPI_list_t *configured_nssaiList; + if (configured_nssai) { + cJSON *configured_nssai_local_nonprimitive; + if (!cJSON_IsArray(configured_nssai)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [configured_nssai]"); + goto end; + } + + configured_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(configured_nssai_local_nonprimitive, configured_nssai ) { + if (!cJSON_IsObject(configured_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [configured_nssai]"); + goto end; + } + OpenAPI_configured_snssai_t *configured_nssaiItem = OpenAPI_configured_snssai_parseFromJSON(configured_nssai_local_nonprimitive); + + OpenAPI_list_add(configured_nssaiList, configured_nssaiItem); + } + } + + cJSON *target_amf_set = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "targetAmfSet"); + + if (target_amf_set) { + if (!cJSON_IsString(target_amf_set)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [target_amf_set]"); + goto end; + } + } + + cJSON *candidate_amf_list = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "candidateAmfList"); + + OpenAPI_list_t *candidate_amf_listList; + if (candidate_amf_list) { + cJSON *candidate_amf_list_local; + if (!cJSON_IsArray(candidate_amf_list)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [candidate_amf_list]"); + goto end; + } + candidate_amf_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(candidate_amf_list_local, candidate_amf_list) { + if (!cJSON_IsString(candidate_amf_list_local)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [candidate_amf_list]"); + goto end; + } + OpenAPI_list_add(candidate_amf_listList, ogs_strdup(candidate_amf_list_local->valuestring)); + } + } + + cJSON *rejected_nssai_in_plmn = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "rejectedNssaiInPlmn"); + + OpenAPI_list_t *rejected_nssai_in_plmnList; + if (rejected_nssai_in_plmn) { + cJSON *rejected_nssai_in_plmn_local_nonprimitive; + if (!cJSON_IsArray(rejected_nssai_in_plmn)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + + rejected_nssai_in_plmnList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rejected_nssai_in_plmn_local_nonprimitive, rejected_nssai_in_plmn ) { + if (!cJSON_IsObject(rejected_nssai_in_plmn_local_nonprimitive)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_plmn]"); + goto end; + } + OpenAPI_snssai_t *rejected_nssai_in_plmnItem = OpenAPI_snssai_parseFromJSON(rejected_nssai_in_plmn_local_nonprimitive); + + OpenAPI_list_add(rejected_nssai_in_plmnList, rejected_nssai_in_plmnItem); + } + } + + cJSON *rejected_nssai_in_ta = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "rejectedNssaiInTa"); + + OpenAPI_list_t *rejected_nssai_in_taList; + if (rejected_nssai_in_ta) { + cJSON *rejected_nssai_in_ta_local_nonprimitive; + if (!cJSON_IsArray(rejected_nssai_in_ta)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + + rejected_nssai_in_taList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rejected_nssai_in_ta_local_nonprimitive, rejected_nssai_in_ta ) { + if (!cJSON_IsObject(rejected_nssai_in_ta_local_nonprimitive)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_ta]"); + goto end; + } + OpenAPI_snssai_t *rejected_nssai_in_taItem = OpenAPI_snssai_parseFromJSON(rejected_nssai_in_ta_local_nonprimitive); + + OpenAPI_list_add(rejected_nssai_in_taList, rejected_nssai_in_taItem); + } + } + + cJSON *nsi_information = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nsiInformation"); + + OpenAPI_nsi_information_t *nsi_information_local_nonprim = NULL; + if (nsi_information) { + nsi_information_local_nonprim = OpenAPI_nsi_information_parseFromJSON(nsi_information); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *nrf_amf_set = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nrfAmfSet"); + + if (nrf_amf_set) { + if (!cJSON_IsString(nrf_amf_set)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nrf_amf_set]"); + goto end; + } + } + + cJSON *nrf_amf_set_nf_mgt_uri = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nrfAmfSetNfMgtUri"); + + if (nrf_amf_set_nf_mgt_uri) { + if (!cJSON_IsString(nrf_amf_set_nf_mgt_uri)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nrf_amf_set_nf_mgt_uri]"); + goto end; + } + } + + cJSON *nrf_amf_set_access_token_uri = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nrfAmfSetAccessTokenUri"); + + if (nrf_amf_set_access_token_uri) { + if (!cJSON_IsString(nrf_amf_set_access_token_uri)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nrf_amf_set_access_token_uri]"); + goto end; + } + } + + cJSON *target_amf_service_set = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "targetAmfServiceSet"); + + if (target_amf_service_set) { + if (!cJSON_IsString(target_amf_service_set)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [target_amf_service_set]"); + goto end; + } + } + + authorized_network_slice_info_local_var = OpenAPI_authorized_network_slice_info_create ( + allowed_nssai_list ? allowed_nssai_listList : NULL, + configured_nssai ? configured_nssaiList : NULL, + target_amf_set ? ogs_strdup(target_amf_set->valuestring) : NULL, + candidate_amf_list ? candidate_amf_listList : NULL, + rejected_nssai_in_plmn ? rejected_nssai_in_plmnList : NULL, + rejected_nssai_in_ta ? rejected_nssai_in_taList : NULL, + nsi_information ? nsi_information_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + nrf_amf_set ? ogs_strdup(nrf_amf_set->valuestring) : NULL, + nrf_amf_set_nf_mgt_uri ? ogs_strdup(nrf_amf_set_nf_mgt_uri->valuestring) : NULL, + nrf_amf_set_access_token_uri ? ogs_strdup(nrf_amf_set_access_token_uri->valuestring) : NULL, + target_amf_service_set ? ogs_strdup(target_amf_service_set->valuestring) : NULL + ); + + return authorized_network_slice_info_local_var; +end: + return NULL; +} + +OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_copy(OpenAPI_authorized_network_slice_info_t *dst, OpenAPI_authorized_network_slice_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authorized_network_slice_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authorized_network_slice_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_authorized_network_slice_info_free(dst); + dst = OpenAPI_authorized_network_slice_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authorized_network_slice_info.h b/lib/sbi/openapi/model/authorized_network_slice_info.h new file mode 100644 index 000000000..1aab0f2e3 --- /dev/null +++ b/lib/sbi/openapi/model/authorized_network_slice_info.h @@ -0,0 +1,64 @@ +/* + * authorized_network_slice_info.h + * + * + */ + +#ifndef _OpenAPI_authorized_network_slice_info_H_ +#define _OpenAPI_authorized_network_slice_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "allowed_nssai.h" +#include "configured_snssai.h" +#include "nsi_information.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_authorized_network_slice_info_s OpenAPI_authorized_network_slice_info_t; +typedef struct OpenAPI_authorized_network_slice_info_s { + OpenAPI_list_t *allowed_nssai_list; + OpenAPI_list_t *configured_nssai; + char *target_amf_set; + OpenAPI_list_t *candidate_amf_list; + OpenAPI_list_t *rejected_nssai_in_plmn; + OpenAPI_list_t *rejected_nssai_in_ta; + struct OpenAPI_nsi_information_s *nsi_information; + char *supported_features; + char *nrf_amf_set; + char *nrf_amf_set_nf_mgt_uri; + char *nrf_amf_set_access_token_uri; + char *target_amf_service_set; +} OpenAPI_authorized_network_slice_info_t; + +OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_create( + OpenAPI_list_t *allowed_nssai_list, + OpenAPI_list_t *configured_nssai, + char *target_amf_set, + OpenAPI_list_t *candidate_amf_list, + OpenAPI_list_t *rejected_nssai_in_plmn, + OpenAPI_list_t *rejected_nssai_in_ta, + OpenAPI_nsi_information_t *nsi_information, + char *supported_features, + char *nrf_amf_set, + char *nrf_amf_set_nf_mgt_uri, + char *nrf_amf_set_access_token_uri, + char *target_amf_service_set + ); +void OpenAPI_authorized_network_slice_info_free(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info); +OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_parseFromJSON(cJSON *authorized_network_slice_infoJSON); +cJSON *OpenAPI_authorized_network_slice_info_convertToJSON(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info); +OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_copy(OpenAPI_authorized_network_slice_info_t *dst, OpenAPI_authorized_network_slice_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_authorized_network_slice_info_H_ */ + diff --git a/lib/sbi/openapi/model/av_eps_aka.c b/lib/sbi/openapi/model/av_eps_aka.c index 8dc18a492..c31c673d7 100644 --- a/lib/sbi/openapi/model/av_eps_aka.c +++ b/lib/sbi/openapi/model/av_eps_aka.c @@ -5,7 +5,7 @@ #include "av_eps_aka.h" OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_create( - OpenAPI_hss_av_type_t *av_type, + OpenAPI_hss_av_type_e av_type, char *rand, char *xres, char *autn, @@ -31,7 +31,6 @@ void OpenAPI_av_eps_aka_free(OpenAPI_av_eps_aka_t *av_eps_aka) return; } OpenAPI_lnode_t *node; - OpenAPI_hss_av_type_free(av_eps_aka->av_type); ogs_free(av_eps_aka->rand); ogs_free(av_eps_aka->xres); ogs_free(av_eps_aka->autn); @@ -53,13 +52,7 @@ cJSON *OpenAPI_av_eps_aka_convertToJSON(OpenAPI_av_eps_aka_t *av_eps_aka) ogs_error("OpenAPI_av_eps_aka_convertToJSON() failed [av_type]"); goto end; } - cJSON *av_type_local_JSON = OpenAPI_hss_av_type_convertToJSON(av_eps_aka->av_type); - if (av_type_local_JSON == NULL) { - ogs_error("OpenAPI_av_eps_aka_convertToJSON() failed [av_type]"); - goto end; - } - cJSON_AddItemToObject(item, "avType", av_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "avType", OpenAPI_hss_av_type_ToString(av_eps_aka->av_type)) == NULL) { ogs_error("OpenAPI_av_eps_aka_convertToJSON() failed [av_type]"); goto end; } @@ -113,9 +106,13 @@ OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_parseFromJSON(cJSON *av_eps_akaJSON) goto end; } - OpenAPI_hss_av_type_t *av_type_local_nonprim = NULL; + OpenAPI_hss_av_type_e av_typeVariable; - av_type_local_nonprim = OpenAPI_hss_av_type_parseFromJSON(av_type); + if (!cJSON_IsString(av_type)) { + ogs_error("OpenAPI_av_eps_aka_parseFromJSON() failed [av_type]"); + goto end; + } + av_typeVariable = OpenAPI_hss_av_type_FromString(av_type->valuestring); cJSON *rand = cJSON_GetObjectItemCaseSensitive(av_eps_akaJSON, "rand"); if (!rand) { @@ -166,7 +163,7 @@ OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_parseFromJSON(cJSON *av_eps_akaJSON) } av_eps_aka_local_var = OpenAPI_av_eps_aka_create ( - av_type_local_nonprim, + av_typeVariable, ogs_strdup(rand->valuestring), ogs_strdup(xres->valuestring), ogs_strdup(autn->valuestring), diff --git a/lib/sbi/openapi/model/av_eps_aka.h b/lib/sbi/openapi/model/av_eps_aka.h index e7ad906e8..359f0cce2 100644 --- a/lib/sbi/openapi/model/av_eps_aka.h +++ b/lib/sbi/openapi/model/av_eps_aka.h @@ -20,7 +20,7 @@ extern "C" { typedef struct OpenAPI_av_eps_aka_s OpenAPI_av_eps_aka_t; typedef struct OpenAPI_av_eps_aka_s { - struct OpenAPI_hss_av_type_s *av_type; + OpenAPI_hss_av_type_e av_type; char *rand; char *xres; char *autn; @@ -28,7 +28,7 @@ typedef struct OpenAPI_av_eps_aka_s { } OpenAPI_av_eps_aka_t; OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_create( - OpenAPI_hss_av_type_t *av_type, + OpenAPI_hss_av_type_e av_type, char *rand, char *xres, char *autn, diff --git a/lib/sbi/openapi/model/av_ims_gba_eap_aka.c b/lib/sbi/openapi/model/av_ims_gba_eap_aka.c index 3b524efe4..b38b37d12 100644 --- a/lib/sbi/openapi/model/av_ims_gba_eap_aka.c +++ b/lib/sbi/openapi/model/av_ims_gba_eap_aka.c @@ -5,7 +5,7 @@ #include "av_ims_gba_eap_aka.h" OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_create( - OpenAPI_hss_av_type_t *av_type, + OpenAPI_hss_av_type_e av_type, char *rand, char *xres, char *autn, @@ -33,7 +33,6 @@ void OpenAPI_av_ims_gba_eap_aka_free(OpenAPI_av_ims_gba_eap_aka_t *av_ims_gba_ea return; } OpenAPI_lnode_t *node; - OpenAPI_hss_av_type_free(av_ims_gba_eap_aka->av_type); ogs_free(av_ims_gba_eap_aka->rand); ogs_free(av_ims_gba_eap_aka->xres); ogs_free(av_ims_gba_eap_aka->autn); @@ -56,13 +55,7 @@ cJSON *OpenAPI_av_ims_gba_eap_aka_convertToJSON(OpenAPI_av_ims_gba_eap_aka_t *av ogs_error("OpenAPI_av_ims_gba_eap_aka_convertToJSON() failed [av_type]"); goto end; } - cJSON *av_type_local_JSON = OpenAPI_hss_av_type_convertToJSON(av_ims_gba_eap_aka->av_type); - if (av_type_local_JSON == NULL) { - ogs_error("OpenAPI_av_ims_gba_eap_aka_convertToJSON() failed [av_type]"); - goto end; - } - cJSON_AddItemToObject(item, "avType", av_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "avType", OpenAPI_hss_av_type_ToString(av_ims_gba_eap_aka->av_type)) == NULL) { ogs_error("OpenAPI_av_ims_gba_eap_aka_convertToJSON() failed [av_type]"); goto end; } @@ -125,9 +118,13 @@ OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_parseFromJSON(cJSON *av goto end; } - OpenAPI_hss_av_type_t *av_type_local_nonprim = NULL; + OpenAPI_hss_av_type_e av_typeVariable; - av_type_local_nonprim = OpenAPI_hss_av_type_parseFromJSON(av_type); + if (!cJSON_IsString(av_type)) { + ogs_error("OpenAPI_av_ims_gba_eap_aka_parseFromJSON() failed [av_type]"); + goto end; + } + av_typeVariable = OpenAPI_hss_av_type_FromString(av_type->valuestring); cJSON *rand = cJSON_GetObjectItemCaseSensitive(av_ims_gba_eap_akaJSON, "rand"); if (!rand) { @@ -190,7 +187,7 @@ OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_parseFromJSON(cJSON *av } av_ims_gba_eap_aka_local_var = OpenAPI_av_ims_gba_eap_aka_create ( - av_type_local_nonprim, + av_typeVariable, ogs_strdup(rand->valuestring), ogs_strdup(xres->valuestring), ogs_strdup(autn->valuestring), diff --git a/lib/sbi/openapi/model/av_ims_gba_eap_aka.h b/lib/sbi/openapi/model/av_ims_gba_eap_aka.h index 9804c3c6e..622bead8f 100644 --- a/lib/sbi/openapi/model/av_ims_gba_eap_aka.h +++ b/lib/sbi/openapi/model/av_ims_gba_eap_aka.h @@ -20,7 +20,7 @@ extern "C" { typedef struct OpenAPI_av_ims_gba_eap_aka_s OpenAPI_av_ims_gba_eap_aka_t; typedef struct OpenAPI_av_ims_gba_eap_aka_s { - struct OpenAPI_hss_av_type_s *av_type; + OpenAPI_hss_av_type_e av_type; char *rand; char *xres; char *autn; @@ -29,7 +29,7 @@ typedef struct OpenAPI_av_ims_gba_eap_aka_s { } OpenAPI_av_ims_gba_eap_aka_t; OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_create( - OpenAPI_hss_av_type_t *av_type, + OpenAPI_hss_av_type_e av_type, char *rand, char *xres, char *autn, diff --git a/lib/sbi/openapi/model/cause.c b/lib/sbi/openapi/model/cause.c index 9279e0e4c..98be1feee 100644 --- a/lib/sbi/openapi/model/cause.c +++ b/lib/sbi/openapi/model/cause.c @@ -6,7 +6,7 @@ char* OpenAPI_cause_ToString(OpenAPI_cause_e cause) { - const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS" }; + const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF" }; size_t sizeofArray = sizeof(causeArray) / sizeof(causeArray[0]); if (cause < sizeofArray) return (char *)causeArray[cause]; @@ -17,7 +17,7 @@ char* OpenAPI_cause_ToString(OpenAPI_cause_e cause) OpenAPI_cause_e OpenAPI_cause_FromString(char* cause) { int stringToReturn = 0; - const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS" }; + const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF" }; size_t sizeofArray = sizeof(causeArray) / sizeof(causeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(cause, causeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/cause.h b/lib/sbi/openapi/model/cause.h index d68fb78c9..37db3a1a1 100644 --- a/lib/sbi/openapi/model/cause.h +++ b/lib/sbi/openapi/model/cause.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_cause_NULL = 0, OpenAPI_cause_REL_DUE_TO_HO, OpenAPI_cause_EPS_FALLBACK, OpenAPI_cause_REL_DUE_TO_UP_SEC, OpenAPI_cause_DNN_CONGESTION, OpenAPI_cause_S_NSSAI_CONGESTION, OpenAPI_cause_REL_DUE_TO_REACTIVATION, OpenAPI_cause__5G_AN_NOT_RESPONDING, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AVAILABLE, OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID, OpenAPI_cause_PDU_SESSION_STATUS_MISMATCH, OpenAPI_cause_HO_FAILURE, OpenAPI_cause_INSUFFICIENT_UP_RESOURCES, OpenAPI_cause_PDU_SESSION_HANDED_OVER, OpenAPI_cause_PDU_SESSION_RESUMED, OpenAPI_cause_CN_ASSISTED_RAN_PARAMETER_TUNING, OpenAPI_cause_ISMF_CONTEXT_TRANSFER, OpenAPI_cause_SMF_CONTEXT_TRANSFER, OpenAPI_cause_REL_DUE_TO_PS_TO_CS_HO, OpenAPI_cause_REL_DUE_TO_SUBSCRIPTION_CHANGE, OpenAPI_cause_HO_CANCEL, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AUTHORIZED, OpenAPI_cause_PDU_SESSION_HAND_OVER_FAILURE, OpenAPI_cause_DDN_FAILURE_STATUS } OpenAPI_cause_e; +typedef enum { OpenAPI_cause_NULL = 0, OpenAPI_cause_REL_DUE_TO_HO, OpenAPI_cause_EPS_FALLBACK, OpenAPI_cause_REL_DUE_TO_UP_SEC, OpenAPI_cause_DNN_CONGESTION, OpenAPI_cause_S_NSSAI_CONGESTION, OpenAPI_cause_REL_DUE_TO_REACTIVATION, OpenAPI_cause__5G_AN_NOT_RESPONDING, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AVAILABLE, OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID, OpenAPI_cause_PDU_SESSION_STATUS_MISMATCH, OpenAPI_cause_HO_FAILURE, OpenAPI_cause_INSUFFICIENT_UP_RESOURCES, OpenAPI_cause_PDU_SESSION_HANDED_OVER, OpenAPI_cause_PDU_SESSION_RESUMED, OpenAPI_cause_CN_ASSISTED_RAN_PARAMETER_TUNING, OpenAPI_cause_ISMF_CONTEXT_TRANSFER, OpenAPI_cause_SMF_CONTEXT_TRANSFER, OpenAPI_cause_REL_DUE_TO_PS_TO_CS_HO, OpenAPI_cause_REL_DUE_TO_SUBSCRIPTION_CHANGE, OpenAPI_cause_HO_CANCEL, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AUTHORIZED, OpenAPI_cause_PDU_SESSION_HAND_OVER_FAILURE, OpenAPI_cause_DDN_FAILURE_STATUS, OpenAPI_cause_REL_DUE_TO_CP_ONLY_NOT_APPLICABLE, OpenAPI_cause_NOT_SUPPORTED_WITH_ISMF } OpenAPI_cause_e; char* OpenAPI_cause_ToString(OpenAPI_cause_e cause); diff --git a/lib/sbi/openapi/model/cm_info_report.c b/lib/sbi/openapi/model/cm_info_report.c deleted file mode 100644 index ade221151..000000000 --- a/lib/sbi/openapi/model/cm_info_report.c +++ /dev/null @@ -1,190 +0,0 @@ - -#include -#include -#include -#include "cm_info_report.h" - -OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_create( - OpenAPI_list_t *old_cm_info_list, - OpenAPI_list_t *new_cm_info_list - ) -{ - OpenAPI_cm_info_report_t *cm_info_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_cm_info_report_t)); - if (!cm_info_report_local_var) { - return NULL; - } - cm_info_report_local_var->old_cm_info_list = old_cm_info_list; - cm_info_report_local_var->new_cm_info_list = new_cm_info_list; - - return cm_info_report_local_var; -} - -void OpenAPI_cm_info_report_free(OpenAPI_cm_info_report_t *cm_info_report) -{ - if (NULL == cm_info_report) { - return; - } - OpenAPI_lnode_t *node; - OpenAPI_list_for_each(cm_info_report->old_cm_info_list, node) { - OpenAPI_cm_info_free(node->data); - } - OpenAPI_list_free(cm_info_report->old_cm_info_list); - OpenAPI_list_for_each(cm_info_report->new_cm_info_list, node) { - OpenAPI_cm_info_free(node->data); - } - OpenAPI_list_free(cm_info_report->new_cm_info_list); - ogs_free(cm_info_report); -} - -cJSON *OpenAPI_cm_info_report_convertToJSON(OpenAPI_cm_info_report_t *cm_info_report) -{ - cJSON *item = NULL; - - if (cm_info_report == NULL) { - ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [CmInfoReport]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (cm_info_report->old_cm_info_list) { - cJSON *old_cm_info_listList = cJSON_AddArrayToObject(item, "oldCmInfoList"); - if (old_cm_info_listList == NULL) { - ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [old_cm_info_list]"); - goto end; - } - - OpenAPI_lnode_t *old_cm_info_list_node; - if (cm_info_report->old_cm_info_list) { - OpenAPI_list_for_each(cm_info_report->old_cm_info_list, old_cm_info_list_node) { - cJSON *itemLocal = OpenAPI_cm_info_convertToJSON(old_cm_info_list_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [old_cm_info_list]"); - goto end; - } - cJSON_AddItemToArray(old_cm_info_listList, itemLocal); - } - } - } - - if (!cm_info_report->new_cm_info_list) { - ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [new_cm_info_list]"); - goto end; - } - cJSON *new_cm_info_listList = cJSON_AddArrayToObject(item, "newCmInfoList"); - if (new_cm_info_listList == NULL) { - ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [new_cm_info_list]"); - goto end; - } - - OpenAPI_lnode_t *new_cm_info_list_node; - if (cm_info_report->new_cm_info_list) { - OpenAPI_list_for_each(cm_info_report->new_cm_info_list, new_cm_info_list_node) { - cJSON *itemLocal = OpenAPI_cm_info_convertToJSON(new_cm_info_list_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [new_cm_info_list]"); - goto end; - } - cJSON_AddItemToArray(new_cm_info_listList, itemLocal); - } - } - -end: - return item; -} - -OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_parseFromJSON(cJSON *cm_info_reportJSON) -{ - OpenAPI_cm_info_report_t *cm_info_report_local_var = NULL; - cJSON *old_cm_info_list = cJSON_GetObjectItemCaseSensitive(cm_info_reportJSON, "oldCmInfoList"); - - OpenAPI_list_t *old_cm_info_listList; - if (old_cm_info_list) { - cJSON *old_cm_info_list_local_nonprimitive; - if (!cJSON_IsArray(old_cm_info_list)) { - ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [old_cm_info_list]"); - goto end; - } - - old_cm_info_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(old_cm_info_list_local_nonprimitive, old_cm_info_list ) { - if (!cJSON_IsObject(old_cm_info_list_local_nonprimitive)) { - ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [old_cm_info_list]"); - goto end; - } - OpenAPI_cm_info_t *old_cm_info_listItem = OpenAPI_cm_info_parseFromJSON(old_cm_info_list_local_nonprimitive); - - OpenAPI_list_add(old_cm_info_listList, old_cm_info_listItem); - } - } - - cJSON *new_cm_info_list = cJSON_GetObjectItemCaseSensitive(cm_info_reportJSON, "newCmInfoList"); - if (!new_cm_info_list) { - ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [new_cm_info_list]"); - goto end; - } - - OpenAPI_list_t *new_cm_info_listList; - - cJSON *new_cm_info_list_local_nonprimitive; - if (!cJSON_IsArray(new_cm_info_list)) { - ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [new_cm_info_list]"); - goto end; - } - - new_cm_info_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(new_cm_info_list_local_nonprimitive, new_cm_info_list ) { - if (!cJSON_IsObject(new_cm_info_list_local_nonprimitive)) { - ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [new_cm_info_list]"); - goto end; - } - OpenAPI_cm_info_t *new_cm_info_listItem = OpenAPI_cm_info_parseFromJSON(new_cm_info_list_local_nonprimitive); - - OpenAPI_list_add(new_cm_info_listList, new_cm_info_listItem); - } - - cm_info_report_local_var = OpenAPI_cm_info_report_create ( - old_cm_info_list ? old_cm_info_listList : NULL, - new_cm_info_listList - ); - - return cm_info_report_local_var; -end: - return NULL; -} - -OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_copy(OpenAPI_cm_info_report_t *dst, OpenAPI_cm_info_report_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_cm_info_report_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_cm_info_report_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_cm_info_report_free(dst); - dst = OpenAPI_cm_info_report_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/cm_info_report.h b/lib/sbi/openapi/model/cm_info_report.h deleted file mode 100644 index 035b75faa..000000000 --- a/lib/sbi/openapi/model/cm_info_report.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * cm_info_report.h - * - * - */ - -#ifndef _OpenAPI_cm_info_report_H_ -#define _OpenAPI_cm_info_report_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "cm_info.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_cm_info_report_s OpenAPI_cm_info_report_t; -typedef struct OpenAPI_cm_info_report_s { - OpenAPI_list_t *old_cm_info_list; - OpenAPI_list_t *new_cm_info_list; -} OpenAPI_cm_info_report_t; - -OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_create( - OpenAPI_list_t *old_cm_info_list, - OpenAPI_list_t *new_cm_info_list - ); -void OpenAPI_cm_info_report_free(OpenAPI_cm_info_report_t *cm_info_report); -OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_parseFromJSON(cJSON *cm_info_reportJSON); -cJSON *OpenAPI_cm_info_report_convertToJSON(OpenAPI_cm_info_report_t *cm_info_report); -OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_copy(OpenAPI_cm_info_report_t *dst, OpenAPI_cm_info_report_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_cm_info_report_H_ */ - diff --git a/lib/sbi/openapi/model/collection_period_rmm_lte_mdt.c b/lib/sbi/openapi/model/collection_period_rmm_lte_mdt.c new file mode 100644 index 000000000..1f335626b --- /dev/null +++ b/lib/sbi/openapi/model/collection_period_rmm_lte_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "collection_period_rmm_lte_mdt.h" + +char* OpenAPI_collection_period_rmm_lte_mdt_ToString(OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lte_mdt) +{ + const char *collection_period_rmm_lte_mdtArray[] = { "NULL", "_1024", "_1280", "_2048", "_2560", "_5120", "_10240", "_60000" }; + size_t sizeofArray = sizeof(collection_period_rmm_lte_mdtArray) / sizeof(collection_period_rmm_lte_mdtArray[0]); + if (collection_period_rmm_lte_mdt < sizeofArray) + return (char *)collection_period_rmm_lte_mdtArray[collection_period_rmm_lte_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_collection_period_rmm_lte_mdt_e OpenAPI_collection_period_rmm_lte_mdt_FromString(char* collection_period_rmm_lte_mdt) +{ + int stringToReturn = 0; + const char *collection_period_rmm_lte_mdtArray[] = { "NULL", "_1024", "_1280", "_2048", "_2560", "_5120", "_10240", "_60000" }; + size_t sizeofArray = sizeof(collection_period_rmm_lte_mdtArray) / sizeof(collection_period_rmm_lte_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(collection_period_rmm_lte_mdt, collection_period_rmm_lte_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/collection_period_rmm_lte_mdt.h b/lib/sbi/openapi/model/collection_period_rmm_lte_mdt.h new file mode 100644 index 000000000..457907721 --- /dev/null +++ b/lib/sbi/openapi/model/collection_period_rmm_lte_mdt.h @@ -0,0 +1,31 @@ +/* + * collection_period_rmm_lte_mdt.h + * + * + */ + +#ifndef _OpenAPI_collection_period_rmm_lte_mdt_H_ +#define _OpenAPI_collection_period_rmm_lte_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_collection_period_rmm_lte_mdt_NULL = 0, OpenAPI_collection_period_rmm_lte_mdt__1024, OpenAPI_collection_period_rmm_lte_mdt__1280, OpenAPI_collection_period_rmm_lte_mdt__2048, OpenAPI_collection_period_rmm_lte_mdt__2560, OpenAPI_collection_period_rmm_lte_mdt__5120, OpenAPI_collection_period_rmm_lte_mdt__10240, OpenAPI_collection_period_rmm_lte_mdt__60000 } OpenAPI_collection_period_rmm_lte_mdt_e; + +char* OpenAPI_collection_period_rmm_lte_mdt_ToString(OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lte_mdt); + +OpenAPI_collection_period_rmm_lte_mdt_e OpenAPI_collection_period_rmm_lte_mdt_FromString(char* collection_period_rmm_lte_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_collection_period_rmm_lte_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/collection_period_rmm_nr_mdt.c b/lib/sbi/openapi/model/collection_period_rmm_nr_mdt.c new file mode 100644 index 000000000..bc5be6288 --- /dev/null +++ b/lib/sbi/openapi/model/collection_period_rmm_nr_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "collection_period_rmm_nr_mdt.h" + +char* OpenAPI_collection_period_rmm_nr_mdt_ToString(OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nr_mdt) +{ + const char *collection_period_rmm_nr_mdtArray[] = { "NULL", "_1024", "_2048", "_5120", "_10240", "_60000" }; + size_t sizeofArray = sizeof(collection_period_rmm_nr_mdtArray) / sizeof(collection_period_rmm_nr_mdtArray[0]); + if (collection_period_rmm_nr_mdt < sizeofArray) + return (char *)collection_period_rmm_nr_mdtArray[collection_period_rmm_nr_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_collection_period_rmm_nr_mdt_e OpenAPI_collection_period_rmm_nr_mdt_FromString(char* collection_period_rmm_nr_mdt) +{ + int stringToReturn = 0; + const char *collection_period_rmm_nr_mdtArray[] = { "NULL", "_1024", "_2048", "_5120", "_10240", "_60000" }; + size_t sizeofArray = sizeof(collection_period_rmm_nr_mdtArray) / sizeof(collection_period_rmm_nr_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(collection_period_rmm_nr_mdt, collection_period_rmm_nr_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/collection_period_rmm_nr_mdt.h b/lib/sbi/openapi/model/collection_period_rmm_nr_mdt.h new file mode 100644 index 000000000..3848f9ab3 --- /dev/null +++ b/lib/sbi/openapi/model/collection_period_rmm_nr_mdt.h @@ -0,0 +1,31 @@ +/* + * collection_period_rmm_nr_mdt.h + * + * + */ + +#ifndef _OpenAPI_collection_period_rmm_nr_mdt_H_ +#define _OpenAPI_collection_period_rmm_nr_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_collection_period_rmm_nr_mdt_NULL = 0, OpenAPI_collection_period_rmm_nr_mdt__1024, OpenAPI_collection_period_rmm_nr_mdt__2048, OpenAPI_collection_period_rmm_nr_mdt__5120, OpenAPI_collection_period_rmm_nr_mdt__10240, OpenAPI_collection_period_rmm_nr_mdt__60000 } OpenAPI_collection_period_rmm_nr_mdt_e; + +char* OpenAPI_collection_period_rmm_nr_mdt_ToString(OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nr_mdt); + +OpenAPI_collection_period_rmm_nr_mdt_e OpenAPI_collection_period_rmm_nr_mdt_FromString(char* collection_period_rmm_nr_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_collection_period_rmm_nr_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/condition_event_type.c b/lib/sbi/openapi/model/condition_event_type.c new file mode 100644 index 000000000..654bc1ac9 --- /dev/null +++ b/lib/sbi/openapi/model/condition_event_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "condition_event_type.h" + +char* OpenAPI_condition_event_type_ToString(OpenAPI_condition_event_type_e condition_event_type) +{ + const char *condition_event_typeArray[] = { "NULL", "NF_ADDED", "NF_REMOVED" }; + size_t sizeofArray = sizeof(condition_event_typeArray) / sizeof(condition_event_typeArray[0]); + if (condition_event_type < sizeofArray) + return (char *)condition_event_typeArray[condition_event_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_condition_event_type_e OpenAPI_condition_event_type_FromString(char* condition_event_type) +{ + int stringToReturn = 0; + const char *condition_event_typeArray[] = { "NULL", "NF_ADDED", "NF_REMOVED" }; + size_t sizeofArray = sizeof(condition_event_typeArray) / sizeof(condition_event_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(condition_event_type, condition_event_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/condition_event_type.h b/lib/sbi/openapi/model/condition_event_type.h new file mode 100644 index 000000000..bf4644801 --- /dev/null +++ b/lib/sbi/openapi/model/condition_event_type.h @@ -0,0 +1,31 @@ +/* + * condition_event_type.h + * + * + */ + +#ifndef _OpenAPI_condition_event_type_H_ +#define _OpenAPI_condition_event_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_condition_event_type_NULL = 0, OpenAPI_condition_event_type_NF_ADDED, OpenAPI_condition_event_type_NF_REMOVED } OpenAPI_condition_event_type_e; + +char* OpenAPI_condition_event_type_ToString(OpenAPI_condition_event_type_e condition_event_type); + +OpenAPI_condition_event_type_e OpenAPI_condition_event_type_FromString(char* condition_event_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_condition_event_type_H_ */ + diff --git a/lib/sbi/openapi/model/context_data_set_name.c b/lib/sbi/openapi/model/context_data_set_name.c index a3ca41c96..203138fd9 100644 --- a/lib/sbi/openapi/model/context_data_set_name.c +++ b/lib/sbi/openapi/model/context_data_set_name.c @@ -4,82 +4,27 @@ #include #include "context_data_set_name.h" -OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_create( - ) +char* OpenAPI_context_data_set_name_ToString(OpenAPI_context_data_set_name_e context_data_set_name) { - OpenAPI_context_data_set_name_t *context_data_set_name_local_var = OpenAPI_malloc(sizeof(OpenAPI_context_data_set_name_t)); - if (!context_data_set_name_local_var) { - return NULL; - } - - return context_data_set_name_local_var; + const char *context_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SDM_SUBSCRIPTIONS", "EE_SUBSCRIPTIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "SUBS_TO_NOTIFY", "SMF_REG", "IP_SM_GW" }; + size_t sizeofArray = sizeof(context_data_set_nameArray) / sizeof(context_data_set_nameArray[0]); + if (context_data_set_name < sizeofArray) + return (char *)context_data_set_nameArray[context_data_set_name]; + else + return (char *)"Unknown"; } -void OpenAPI_context_data_set_name_free(OpenAPI_context_data_set_name_t *context_data_set_name) +OpenAPI_context_data_set_name_e OpenAPI_context_data_set_name_FromString(char* context_data_set_name) { - if (NULL == context_data_set_name) { - return; + int stringToReturn = 0; + const char *context_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SDM_SUBSCRIPTIONS", "EE_SUBSCRIPTIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "SUBS_TO_NOTIFY", "SMF_REG", "IP_SM_GW" }; + size_t sizeofArray = sizeof(context_data_set_nameArray) / sizeof(context_data_set_nameArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(context_data_set_name, context_data_set_nameArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(context_data_set_name); -} - -cJSON *OpenAPI_context_data_set_name_convertToJSON(OpenAPI_context_data_set_name_t *context_data_set_name) -{ - cJSON *item = NULL; - - if (context_data_set_name == NULL) { - ogs_error("OpenAPI_context_data_set_name_convertToJSON() failed [ContextDataSetName]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_parseFromJSON(cJSON *context_data_set_nameJSON) -{ - OpenAPI_context_data_set_name_t *context_data_set_name_local_var = NULL; - context_data_set_name_local_var = OpenAPI_context_data_set_name_create ( - ); - - return context_data_set_name_local_var; -end: - return NULL; -} - -OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_copy(OpenAPI_context_data_set_name_t *dst, OpenAPI_context_data_set_name_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_context_data_set_name_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_context_data_set_name_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_context_data_set_name_free(dst); - dst = OpenAPI_context_data_set_name_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/context_data_set_name.h b/lib/sbi/openapi/model/context_data_set_name.h index dcb355d12..3899fd8f1 100644 --- a/lib/sbi/openapi/model/context_data_set_name.h +++ b/lib/sbi/openapi/model/context_data_set_name.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_context_data_set_name_s OpenAPI_context_data_set_name_t; -typedef struct OpenAPI_context_data_set_name_s { -} OpenAPI_context_data_set_name_t; +typedef enum { OpenAPI_context_data_set_name_NULL = 0, OpenAPI_context_data_set_name_AMF_3GPP, OpenAPI_context_data_set_name_AMF_NON_3GPP, OpenAPI_context_data_set_name_SDM_SUBSCRIPTIONS, OpenAPI_context_data_set_name_EE_SUBSCRIPTIONS, OpenAPI_context_data_set_name_SMSF_3GPP, OpenAPI_context_data_set_name_SMSF_NON_3GPP, OpenAPI_context_data_set_name_SUBS_TO_NOTIFY, OpenAPI_context_data_set_name_SMF_REG, OpenAPI_context_data_set_name_IP_SM_GW } OpenAPI_context_data_set_name_e; -OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_create( - ); -void OpenAPI_context_data_set_name_free(OpenAPI_context_data_set_name_t *context_data_set_name); -OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_parseFromJSON(cJSON *context_data_set_nameJSON); -cJSON *OpenAPI_context_data_set_name_convertToJSON(OpenAPI_context_data_set_name_t *context_data_set_name); -OpenAPI_context_data_set_name_t *OpenAPI_context_data_set_name_copy(OpenAPI_context_data_set_name_t *dst, OpenAPI_context_data_set_name_t *src); +char* OpenAPI_context_data_set_name_ToString(OpenAPI_context_data_set_name_e context_data_set_name); + +OpenAPI_context_data_set_name_e OpenAPI_context_data_set_name_FromString(char* context_data_set_name); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/context_data_sets.c b/lib/sbi/openapi/model/context_data_sets.c index a442b8512..43041899a 100644 --- a/lib/sbi/openapi/model/context_data_sets.c +++ b/lib/sbi/openapi/model/context_data_sets.c @@ -12,7 +12,8 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( OpenAPI_smsf_registration_t *smsf3_gpp_access, OpenAPI_smsf_registration_t *smsf_non3_gpp_access, OpenAPI_list_t *subscription_data_subscriptions, - OpenAPI_list_t *smf_registrations + OpenAPI_list_t *smf_registrations, + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw ) { OpenAPI_context_data_sets_t *context_data_sets_local_var = OpenAPI_malloc(sizeof(OpenAPI_context_data_sets_t)); @@ -27,6 +28,7 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( context_data_sets_local_var->smsf_non3_gpp_access = smsf_non3_gpp_access; context_data_sets_local_var->subscription_data_subscriptions = subscription_data_subscriptions; context_data_sets_local_var->smf_registrations = smf_registrations; + context_data_sets_local_var->ip_sm_gw = ip_sm_gw; return context_data_sets_local_var; } @@ -57,6 +59,7 @@ void OpenAPI_context_data_sets_free(OpenAPI_context_data_sets_t *context_data_se OpenAPI_smf_registration_free(node->data); } OpenAPI_list_free(context_data_sets->smf_registrations); + OpenAPI_ip_sm_gw_registration_free(context_data_sets->ip_sm_gw); ogs_free(context_data_sets); } @@ -202,6 +205,19 @@ cJSON *OpenAPI_context_data_sets_convertToJSON(OpenAPI_context_data_sets_t *cont } } + if (context_data_sets->ip_sm_gw) { + cJSON *ip_sm_gw_local_JSON = OpenAPI_ip_sm_gw_registration_convertToJSON(context_data_sets->ip_sm_gw); + if (ip_sm_gw_local_JSON == NULL) { + ogs_error("OpenAPI_context_data_sets_convertToJSON() failed [ip_sm_gw]"); + goto end; + } + cJSON_AddItemToObject(item, "ipSmGw", ip_sm_gw_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_context_data_sets_convertToJSON() failed [ip_sm_gw]"); + goto end; + } + } + end: return item; } @@ -329,6 +345,13 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *cont } } + cJSON *ip_sm_gw = cJSON_GetObjectItemCaseSensitive(context_data_setsJSON, "ipSmGw"); + + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_local_nonprim = NULL; + if (ip_sm_gw) { + ip_sm_gw_local_nonprim = OpenAPI_ip_sm_gw_registration_parseFromJSON(ip_sm_gw); + } + context_data_sets_local_var = OpenAPI_context_data_sets_create ( amf3_gpp ? amf3_gpp_local_nonprim : NULL, amf_non3_gpp ? amf_non3_gpp_local_nonprim : NULL, @@ -337,7 +360,8 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *cont smsf3_gpp_access ? smsf3_gpp_access_local_nonprim : NULL, smsf_non3_gpp_access ? smsf_non3_gpp_access_local_nonprim : NULL, subscription_data_subscriptions ? subscription_data_subscriptionsList : NULL, - smf_registrations ? smf_registrationsList : NULL + smf_registrations ? smf_registrationsList : NULL, + ip_sm_gw ? ip_sm_gw_local_nonprim : NULL ); return context_data_sets_local_var; diff --git a/lib/sbi/openapi/model/context_data_sets.h b/lib/sbi/openapi/model/context_data_sets.h index 3eea7912e..fd7080c3f 100644 --- a/lib/sbi/openapi/model/context_data_sets.h +++ b/lib/sbi/openapi/model/context_data_sets.h @@ -15,6 +15,7 @@ #include "amf3_gpp_access_registration.h" #include "amf_non3_gpp_access_registration.h" #include "ee_subscription.h" +#include "ip_sm_gw_registration.h" #include "sdm_subscription.h" #include "smf_registration.h" #include "smsf_registration.h" @@ -34,6 +35,7 @@ typedef struct OpenAPI_context_data_sets_s { struct OpenAPI_smsf_registration_s *smsf_non3_gpp_access; OpenAPI_list_t *subscription_data_subscriptions; OpenAPI_list_t *smf_registrations; + struct OpenAPI_ip_sm_gw_registration_s *ip_sm_gw; } OpenAPI_context_data_sets_t; OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( @@ -44,7 +46,8 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( OpenAPI_smsf_registration_t *smsf3_gpp_access, OpenAPI_smsf_registration_t *smsf_non3_gpp_access, OpenAPI_list_t *subscription_data_subscriptions, - OpenAPI_list_t *smf_registrations + OpenAPI_list_t *smf_registrations, + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw ); void OpenAPI_context_data_sets_free(OpenAPI_context_data_sets_t *context_data_sets); OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *context_data_setsJSON); diff --git a/lib/sbi/openapi/model/context_info.c b/lib/sbi/openapi/model/context_info.c new file mode 100644 index 000000000..82c854787 --- /dev/null +++ b/lib/sbi/openapi/model/context_info.c @@ -0,0 +1,128 @@ + +#include +#include +#include +#include "context_info.h" + +OpenAPI_context_info_t *OpenAPI_context_info_create( + OpenAPI_list_t *orig_headers + ) +{ + OpenAPI_context_info_t *context_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_context_info_t)); + if (!context_info_local_var) { + return NULL; + } + context_info_local_var->orig_headers = orig_headers; + + return context_info_local_var; +} + +void OpenAPI_context_info_free(OpenAPI_context_info_t *context_info) +{ + if (NULL == context_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(context_info->orig_headers, node) { + ogs_free(node->data); + } + OpenAPI_list_free(context_info->orig_headers); + ogs_free(context_info); +} + +cJSON *OpenAPI_context_info_convertToJSON(OpenAPI_context_info_t *context_info) +{ + cJSON *item = NULL; + + if (context_info == NULL) { + ogs_error("OpenAPI_context_info_convertToJSON() failed [ContextInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (context_info->orig_headers) { + cJSON *orig_headers = cJSON_AddArrayToObject(item, "origHeaders"); + if (orig_headers == NULL) { + ogs_error("OpenAPI_context_info_convertToJSON() failed [orig_headers]"); + goto end; + } + + OpenAPI_lnode_t *orig_headers_node; + OpenAPI_list_for_each(context_info->orig_headers, orig_headers_node) { + if (cJSON_AddStringToObject(orig_headers, "", (char*)orig_headers_node->data) == NULL) { + ogs_error("OpenAPI_context_info_convertToJSON() failed [orig_headers]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJSON) +{ + OpenAPI_context_info_t *context_info_local_var = NULL; + cJSON *orig_headers = cJSON_GetObjectItemCaseSensitive(context_infoJSON, "origHeaders"); + + OpenAPI_list_t *orig_headersList; + if (orig_headers) { + cJSON *orig_headers_local; + if (!cJSON_IsArray(orig_headers)) { + ogs_error("OpenAPI_context_info_parseFromJSON() failed [orig_headers]"); + goto end; + } + orig_headersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(orig_headers_local, orig_headers) { + if (!cJSON_IsString(orig_headers_local)) { + ogs_error("OpenAPI_context_info_parseFromJSON() failed [orig_headers]"); + goto end; + } + OpenAPI_list_add(orig_headersList, ogs_strdup(orig_headers_local->valuestring)); + } + } + + context_info_local_var = OpenAPI_context_info_create ( + orig_headers ? orig_headersList : NULL + ); + + return context_info_local_var; +end: + return NULL; +} + +OpenAPI_context_info_t *OpenAPI_context_info_copy(OpenAPI_context_info_t *dst, OpenAPI_context_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_context_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_context_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_context_info_free(dst); + dst = OpenAPI_context_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/context_info.h b/lib/sbi/openapi/model/context_info.h new file mode 100644 index 000000000..3b08ac6a6 --- /dev/null +++ b/lib/sbi/openapi/model/context_info.h @@ -0,0 +1,38 @@ +/* + * context_info.h + * + * + */ + +#ifndef _OpenAPI_context_info_H_ +#define _OpenAPI_context_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_context_info_s OpenAPI_context_info_t; +typedef struct OpenAPI_context_info_s { + OpenAPI_list_t *orig_headers; +} OpenAPI_context_info_t; + +OpenAPI_context_info_t *OpenAPI_context_info_create( + OpenAPI_list_t *orig_headers + ); +void OpenAPI_context_info_free(OpenAPI_context_info_t *context_info); +OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJSON); +cJSON *OpenAPI_context_info_convertToJSON(OpenAPI_context_info_t *context_info); +OpenAPI_context_info_t *OpenAPI_context_info_copy(OpenAPI_context_info_t *dst, OpenAPI_context_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_context_info_H_ */ + diff --git a/lib/sbi/openapi/model/data_set_name.c b/lib/sbi/openapi/model/data_set_name.c index f4e5af02a..fdfae5280 100644 --- a/lib/sbi/openapi/model/data_set_name.c +++ b/lib/sbi/openapi/model/data_set_name.c @@ -4,82 +4,27 @@ #include #include "data_set_name.h" -OpenAPI_data_set_name_t *OpenAPI_data_set_name_create( - ) +char* OpenAPI_data_set_name_ToString(OpenAPI_data_set_name_e data_set_name) { - OpenAPI_data_set_name_t *data_set_name_local_var = OpenAPI_malloc(sizeof(OpenAPI_data_set_name_t)); - if (!data_set_name_local_var) { - return NULL; - } - - return data_set_name_local_var; + const char *data_set_nameArray[] = { "NULL", "AM", "SMF_SEL", "SMS_SUB", "SM", "TRACE", "SMS_MNG", "LCS_PRIVACY", "LCS_MO", "LCS_BCA", "V2X" }; + size_t sizeofArray = sizeof(data_set_nameArray) / sizeof(data_set_nameArray[0]); + if (data_set_name < sizeofArray) + return (char *)data_set_nameArray[data_set_name]; + else + return (char *)"Unknown"; } -void OpenAPI_data_set_name_free(OpenAPI_data_set_name_t *data_set_name) +OpenAPI_data_set_name_e OpenAPI_data_set_name_FromString(char* data_set_name) { - if (NULL == data_set_name) { - return; + int stringToReturn = 0; + const char *data_set_nameArray[] = { "NULL", "AM", "SMF_SEL", "SMS_SUB", "SM", "TRACE", "SMS_MNG", "LCS_PRIVACY", "LCS_MO", "LCS_BCA", "V2X" }; + size_t sizeofArray = sizeof(data_set_nameArray) / sizeof(data_set_nameArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(data_set_name, data_set_nameArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(data_set_name); -} - -cJSON *OpenAPI_data_set_name_convertToJSON(OpenAPI_data_set_name_t *data_set_name) -{ - cJSON *item = NULL; - - if (data_set_name == NULL) { - ogs_error("OpenAPI_data_set_name_convertToJSON() failed [DataSetName]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_data_set_name_t *OpenAPI_data_set_name_parseFromJSON(cJSON *data_set_nameJSON) -{ - OpenAPI_data_set_name_t *data_set_name_local_var = NULL; - data_set_name_local_var = OpenAPI_data_set_name_create ( - ); - - return data_set_name_local_var; -end: - return NULL; -} - -OpenAPI_data_set_name_t *OpenAPI_data_set_name_copy(OpenAPI_data_set_name_t *dst, OpenAPI_data_set_name_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_data_set_name_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_data_set_name_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_data_set_name_free(dst); - dst = OpenAPI_data_set_name_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/data_set_name.h b/lib/sbi/openapi/model/data_set_name.h index d7f64979b..b4b6f66cf 100644 --- a/lib/sbi/openapi/model/data_set_name.h +++ b/lib/sbi/openapi/model/data_set_name.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_data_set_name_s OpenAPI_data_set_name_t; -typedef struct OpenAPI_data_set_name_s { -} OpenAPI_data_set_name_t; +typedef enum { OpenAPI_data_set_name_NULL = 0, OpenAPI_data_set_name_AM, OpenAPI_data_set_name_SMF_SEL, OpenAPI_data_set_name_SMS_SUB, OpenAPI_data_set_name_SM, OpenAPI_data_set_name_TRACE, OpenAPI_data_set_name_SMS_MNG, OpenAPI_data_set_name_LCS_PRIVACY, OpenAPI_data_set_name_LCS_MO, OpenAPI_data_set_name_LCS_BCA, OpenAPI_data_set_name_V2X } OpenAPI_data_set_name_e; -OpenAPI_data_set_name_t *OpenAPI_data_set_name_create( - ); -void OpenAPI_data_set_name_free(OpenAPI_data_set_name_t *data_set_name); -OpenAPI_data_set_name_t *OpenAPI_data_set_name_parseFromJSON(cJSON *data_set_nameJSON); -cJSON *OpenAPI_data_set_name_convertToJSON(OpenAPI_data_set_name_t *data_set_name); -OpenAPI_data_set_name_t *OpenAPI_data_set_name_copy(OpenAPI_data_set_name_t *dst, OpenAPI_data_set_name_t *src); +char* OpenAPI_data_set_name_ToString(OpenAPI_data_set_name_e data_set_name); + +OpenAPI_data_set_name_e OpenAPI_data_set_name_FromString(char* data_set_name); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/datalink_reporting_configuration.c b/lib/sbi/openapi/model/datalink_reporting_configuration.c index fe77deccf..120c822f6 100644 --- a/lib/sbi/openapi/model/datalink_reporting_configuration.c +++ b/lib/sbi/openapi/model/datalink_reporting_configuration.c @@ -35,9 +35,6 @@ void OpenAPI_datalink_reporting_configuration_free(OpenAPI_datalink_reporting_co OpenAPI_list_free(datalink_reporting_configuration->ddd_traffic_des); ogs_free(datalink_reporting_configuration->dnn); OpenAPI_snssai_free(datalink_reporting_configuration->slice); - OpenAPI_list_for_each(datalink_reporting_configuration->ddd_status_list, node) { - OpenAPI_dl_data_delivery_status_free(node->data); - } OpenAPI_list_free(datalink_reporting_configuration->ddd_status_list); ogs_free(datalink_reporting_configuration); } @@ -93,21 +90,16 @@ cJSON *OpenAPI_datalink_reporting_configuration_convertToJSON(OpenAPI_datalink_r } if (datalink_reporting_configuration->ddd_status_list) { - cJSON *ddd_status_listList = cJSON_AddArrayToObject(item, "dddStatusList"); - if (ddd_status_listList == NULL) { + cJSON *ddd_status_list = cJSON_AddArrayToObject(item, "dddStatusList"); + if (ddd_status_list == NULL) { ogs_error("OpenAPI_datalink_reporting_configuration_convertToJSON() failed [ddd_status_list]"); goto end; } - OpenAPI_lnode_t *ddd_status_list_node; - if (datalink_reporting_configuration->ddd_status_list) { - OpenAPI_list_for_each(datalink_reporting_configuration->ddd_status_list, ddd_status_list_node) { - cJSON *itemLocal = OpenAPI_dl_data_delivery_status_convertToJSON(ddd_status_list_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_datalink_reporting_configuration_convertToJSON() failed [ddd_status_list]"); - goto end; - } - cJSON_AddItemToArray(ddd_status_listList, itemLocal); + OpenAPI_list_for_each(datalink_reporting_configuration->ddd_status_list, ddd_status_list_node) { + if (cJSON_AddStringToObject(ddd_status_list, "", OpenAPI_dl_data_delivery_status_ToString((OpenAPI_dl_data_delivery_status_e)ddd_status_list_node->data)) == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_convertToJSON() failed [ddd_status_list]"); + goto end; } } } @@ -171,13 +163,12 @@ OpenAPI_datalink_reporting_configuration_t *OpenAPI_datalink_reporting_configura ddd_status_listList = OpenAPI_list_create(); cJSON_ArrayForEach(ddd_status_list_local_nonprimitive, ddd_status_list ) { - if (!cJSON_IsObject(ddd_status_list_local_nonprimitive)) { + if (!cJSON_IsString(ddd_status_list_local_nonprimitive)) { ogs_error("OpenAPI_datalink_reporting_configuration_parseFromJSON() failed [ddd_status_list]"); goto end; } - OpenAPI_dl_data_delivery_status_t *ddd_status_listItem = OpenAPI_dl_data_delivery_status_parseFromJSON(ddd_status_list_local_nonprimitive); - OpenAPI_list_add(ddd_status_listList, ddd_status_listItem); + OpenAPI_list_add(ddd_status_listList, (void *)OpenAPI_dl_data_delivery_status_FromString(ddd_status_list_local_nonprimitive->valuestring)); } } diff --git a/lib/sbi/openapi/model/ddn_failure_sub_info.c b/lib/sbi/openapi/model/ddn_failure_sub_info.c new file mode 100644 index 000000000..c5d8dd0c0 --- /dev/null +++ b/lib/sbi/openapi/model/ddn_failure_sub_info.c @@ -0,0 +1,160 @@ + +#include +#include +#include +#include "ddn_failure_sub_info.h" + +OpenAPI_ddn_failure_sub_info_t *OpenAPI_ddn_failure_sub_info_create( + char *notify_correlation_id, + OpenAPI_list_t *ddd_traffic_descriptor_list + ) +{ + OpenAPI_ddn_failure_sub_info_t *ddn_failure_sub_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_ddn_failure_sub_info_t)); + if (!ddn_failure_sub_info_local_var) { + return NULL; + } + ddn_failure_sub_info_local_var->notify_correlation_id = notify_correlation_id; + ddn_failure_sub_info_local_var->ddd_traffic_descriptor_list = ddd_traffic_descriptor_list; + + return ddn_failure_sub_info_local_var; +} + +void OpenAPI_ddn_failure_sub_info_free(OpenAPI_ddn_failure_sub_info_t *ddn_failure_sub_info) +{ + if (NULL == ddn_failure_sub_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ddn_failure_sub_info->notify_correlation_id); + OpenAPI_list_for_each(ddn_failure_sub_info->ddd_traffic_descriptor_list, node) { + OpenAPI_ddd_traffic_descriptor_free(node->data); + } + OpenAPI_list_free(ddn_failure_sub_info->ddd_traffic_descriptor_list); + ogs_free(ddn_failure_sub_info); +} + +cJSON *OpenAPI_ddn_failure_sub_info_convertToJSON(OpenAPI_ddn_failure_sub_info_t *ddn_failure_sub_info) +{ + cJSON *item = NULL; + + if (ddn_failure_sub_info == NULL) { + ogs_error("OpenAPI_ddn_failure_sub_info_convertToJSON() failed [DdnFailureSubInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ddn_failure_sub_info->notify_correlation_id) { + ogs_error("OpenAPI_ddn_failure_sub_info_convertToJSON() failed [notify_correlation_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "notifyCorrelationId", ddn_failure_sub_info->notify_correlation_id) == NULL) { + ogs_error("OpenAPI_ddn_failure_sub_info_convertToJSON() failed [notify_correlation_id]"); + goto end; + } + + if (ddn_failure_sub_info->ddd_traffic_descriptor_list) { + cJSON *ddd_traffic_descriptor_listList = cJSON_AddArrayToObject(item, "dddTrafficDescriptorList"); + if (ddd_traffic_descriptor_listList == NULL) { + ogs_error("OpenAPI_ddn_failure_sub_info_convertToJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + + OpenAPI_lnode_t *ddd_traffic_descriptor_list_node; + if (ddn_failure_sub_info->ddd_traffic_descriptor_list) { + OpenAPI_list_for_each(ddn_failure_sub_info->ddd_traffic_descriptor_list, ddd_traffic_descriptor_list_node) { + cJSON *itemLocal = OpenAPI_ddd_traffic_descriptor_convertToJSON(ddd_traffic_descriptor_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ddn_failure_sub_info_convertToJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + cJSON_AddItemToArray(ddd_traffic_descriptor_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_ddn_failure_sub_info_t *OpenAPI_ddn_failure_sub_info_parseFromJSON(cJSON *ddn_failure_sub_infoJSON) +{ + OpenAPI_ddn_failure_sub_info_t *ddn_failure_sub_info_local_var = NULL; + cJSON *notify_correlation_id = cJSON_GetObjectItemCaseSensitive(ddn_failure_sub_infoJSON, "notifyCorrelationId"); + if (!notify_correlation_id) { + ogs_error("OpenAPI_ddn_failure_sub_info_parseFromJSON() failed [notify_correlation_id]"); + goto end; + } + + + if (!cJSON_IsString(notify_correlation_id)) { + ogs_error("OpenAPI_ddn_failure_sub_info_parseFromJSON() failed [notify_correlation_id]"); + goto end; + } + + cJSON *ddd_traffic_descriptor_list = cJSON_GetObjectItemCaseSensitive(ddn_failure_sub_infoJSON, "dddTrafficDescriptorList"); + + OpenAPI_list_t *ddd_traffic_descriptor_listList; + if (ddd_traffic_descriptor_list) { + cJSON *ddd_traffic_descriptor_list_local_nonprimitive; + if (!cJSON_IsArray(ddd_traffic_descriptor_list)) { + ogs_error("OpenAPI_ddn_failure_sub_info_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + + ddd_traffic_descriptor_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ddd_traffic_descriptor_list_local_nonprimitive, ddd_traffic_descriptor_list ) { + if (!cJSON_IsObject(ddd_traffic_descriptor_list_local_nonprimitive)) { + ogs_error("OpenAPI_ddn_failure_sub_info_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + goto end; + } + OpenAPI_ddd_traffic_descriptor_t *ddd_traffic_descriptor_listItem = OpenAPI_ddd_traffic_descriptor_parseFromJSON(ddd_traffic_descriptor_list_local_nonprimitive); + + OpenAPI_list_add(ddd_traffic_descriptor_listList, ddd_traffic_descriptor_listItem); + } + } + + ddn_failure_sub_info_local_var = OpenAPI_ddn_failure_sub_info_create ( + ogs_strdup(notify_correlation_id->valuestring), + ddd_traffic_descriptor_list ? ddd_traffic_descriptor_listList : NULL + ); + + return ddn_failure_sub_info_local_var; +end: + return NULL; +} + +OpenAPI_ddn_failure_sub_info_t *OpenAPI_ddn_failure_sub_info_copy(OpenAPI_ddn_failure_sub_info_t *dst, OpenAPI_ddn_failure_sub_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ddn_failure_sub_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ddn_failure_sub_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_ddn_failure_sub_info_free(dst); + dst = OpenAPI_ddn_failure_sub_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ddn_failure_sub_info.h b/lib/sbi/openapi/model/ddn_failure_sub_info.h new file mode 100644 index 000000000..0809b45a1 --- /dev/null +++ b/lib/sbi/openapi/model/ddn_failure_sub_info.h @@ -0,0 +1,41 @@ +/* + * ddn_failure_sub_info.h + * + * + */ + +#ifndef _OpenAPI_ddn_failure_sub_info_H_ +#define _OpenAPI_ddn_failure_sub_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ddd_traffic_descriptor.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ddn_failure_sub_info_s OpenAPI_ddn_failure_sub_info_t; +typedef struct OpenAPI_ddn_failure_sub_info_s { + char *notify_correlation_id; + OpenAPI_list_t *ddd_traffic_descriptor_list; +} OpenAPI_ddn_failure_sub_info_t; + +OpenAPI_ddn_failure_sub_info_t *OpenAPI_ddn_failure_sub_info_create( + char *notify_correlation_id, + OpenAPI_list_t *ddd_traffic_descriptor_list + ); +void OpenAPI_ddn_failure_sub_info_free(OpenAPI_ddn_failure_sub_info_t *ddn_failure_sub_info); +OpenAPI_ddn_failure_sub_info_t *OpenAPI_ddn_failure_sub_info_parseFromJSON(cJSON *ddn_failure_sub_infoJSON); +cJSON *OpenAPI_ddn_failure_sub_info_convertToJSON(OpenAPI_ddn_failure_sub_info_t *ddn_failure_sub_info); +OpenAPI_ddn_failure_sub_info_t *OpenAPI_ddn_failure_sub_info_copy(OpenAPI_ddn_failure_sub_info_t *dst, OpenAPI_ddn_failure_sub_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ddn_failure_sub_info_H_ */ + diff --git a/lib/sbi/openapi/model/ddn_failure_subs.c b/lib/sbi/openapi/model/ddn_failure_subs.c index 5c51569d9..808f2b241 100644 --- a/lib/sbi/openapi/model/ddn_failure_subs.c +++ b/lib/sbi/openapi/model/ddn_failure_subs.c @@ -6,7 +6,7 @@ OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_create( int ddn_failure_subs_ind, - OpenAPI_list_t *ddd_traffic_descriptor_list + OpenAPI_list_t *ddn_failure_subs_info_list ) { OpenAPI_ddn_failure_subs_t *ddn_failure_subs_local_var = OpenAPI_malloc(sizeof(OpenAPI_ddn_failure_subs_t)); @@ -14,7 +14,7 @@ OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_create( return NULL; } ddn_failure_subs_local_var->ddn_failure_subs_ind = ddn_failure_subs_ind; - ddn_failure_subs_local_var->ddd_traffic_descriptor_list = ddd_traffic_descriptor_list; + ddn_failure_subs_local_var->ddn_failure_subs_info_list = ddn_failure_subs_info_list; return ddn_failure_subs_local_var; } @@ -25,10 +25,10 @@ void OpenAPI_ddn_failure_subs_free(OpenAPI_ddn_failure_subs_t *ddn_failure_subs) return; } OpenAPI_lnode_t *node; - OpenAPI_list_for_each(ddn_failure_subs->ddd_traffic_descriptor_list, node) { - OpenAPI_ddd_traffic_descriptor_free(node->data); + OpenAPI_list_for_each(ddn_failure_subs->ddn_failure_subs_info_list, node) { + OpenAPI_ddn_failure_sub_info_free(node->data); } - OpenAPI_list_free(ddn_failure_subs->ddd_traffic_descriptor_list); + OpenAPI_list_free(ddn_failure_subs->ddn_failure_subs_info_list); ogs_free(ddn_failure_subs); } @@ -49,22 +49,22 @@ cJSON *OpenAPI_ddn_failure_subs_convertToJSON(OpenAPI_ddn_failure_subs_t *ddn_fa } } - if (ddn_failure_subs->ddd_traffic_descriptor_list) { - cJSON *ddd_traffic_descriptor_listList = cJSON_AddArrayToObject(item, "dddTrafficDescriptorList"); - if (ddd_traffic_descriptor_listList == NULL) { - ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [ddd_traffic_descriptor_list]"); + if (ddn_failure_subs->ddn_failure_subs_info_list) { + cJSON *ddn_failure_subs_info_listList = cJSON_AddArrayToObject(item, "ddnFailureSubsInfoList"); + if (ddn_failure_subs_info_listList == NULL) { + ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [ddn_failure_subs_info_list]"); goto end; } - OpenAPI_lnode_t *ddd_traffic_descriptor_list_node; - if (ddn_failure_subs->ddd_traffic_descriptor_list) { - OpenAPI_list_for_each(ddn_failure_subs->ddd_traffic_descriptor_list, ddd_traffic_descriptor_list_node) { - cJSON *itemLocal = OpenAPI_ddd_traffic_descriptor_convertToJSON(ddd_traffic_descriptor_list_node->data); + OpenAPI_lnode_t *ddn_failure_subs_info_list_node; + if (ddn_failure_subs->ddn_failure_subs_info_list) { + OpenAPI_list_for_each(ddn_failure_subs->ddn_failure_subs_info_list, ddn_failure_subs_info_list_node) { + cJSON *itemLocal = OpenAPI_ddn_failure_sub_info_convertToJSON(ddn_failure_subs_info_list_node->data); if (itemLocal == NULL) { - ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [ddd_traffic_descriptor_list]"); + ogs_error("OpenAPI_ddn_failure_subs_convertToJSON() failed [ddn_failure_subs_info_list]"); goto end; } - cJSON_AddItemToArray(ddd_traffic_descriptor_listList, itemLocal); + cJSON_AddItemToArray(ddn_failure_subs_info_listList, itemLocal); } } } @@ -85,32 +85,32 @@ OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_parseFromJSON(cJSON *ddn_fa } } - cJSON *ddd_traffic_descriptor_list = cJSON_GetObjectItemCaseSensitive(ddn_failure_subsJSON, "dddTrafficDescriptorList"); + cJSON *ddn_failure_subs_info_list = cJSON_GetObjectItemCaseSensitive(ddn_failure_subsJSON, "ddnFailureSubsInfoList"); - OpenAPI_list_t *ddd_traffic_descriptor_listList; - if (ddd_traffic_descriptor_list) { - cJSON *ddd_traffic_descriptor_list_local_nonprimitive; - if (!cJSON_IsArray(ddd_traffic_descriptor_list)) { - ogs_error("OpenAPI_ddn_failure_subs_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + OpenAPI_list_t *ddn_failure_subs_info_listList; + if (ddn_failure_subs_info_list) { + cJSON *ddn_failure_subs_info_list_local_nonprimitive; + if (!cJSON_IsArray(ddn_failure_subs_info_list)) { + ogs_error("OpenAPI_ddn_failure_subs_parseFromJSON() failed [ddn_failure_subs_info_list]"); goto end; } - ddd_traffic_descriptor_listList = OpenAPI_list_create(); + ddn_failure_subs_info_listList = OpenAPI_list_create(); - cJSON_ArrayForEach(ddd_traffic_descriptor_list_local_nonprimitive, ddd_traffic_descriptor_list ) { - if (!cJSON_IsObject(ddd_traffic_descriptor_list_local_nonprimitive)) { - ogs_error("OpenAPI_ddn_failure_subs_parseFromJSON() failed [ddd_traffic_descriptor_list]"); + cJSON_ArrayForEach(ddn_failure_subs_info_list_local_nonprimitive, ddn_failure_subs_info_list ) { + if (!cJSON_IsObject(ddn_failure_subs_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_ddn_failure_subs_parseFromJSON() failed [ddn_failure_subs_info_list]"); goto end; } - OpenAPI_ddd_traffic_descriptor_t *ddd_traffic_descriptor_listItem = OpenAPI_ddd_traffic_descriptor_parseFromJSON(ddd_traffic_descriptor_list_local_nonprimitive); + OpenAPI_ddn_failure_sub_info_t *ddn_failure_subs_info_listItem = OpenAPI_ddn_failure_sub_info_parseFromJSON(ddn_failure_subs_info_list_local_nonprimitive); - OpenAPI_list_add(ddd_traffic_descriptor_listList, ddd_traffic_descriptor_listItem); + OpenAPI_list_add(ddn_failure_subs_info_listList, ddn_failure_subs_info_listItem); } } ddn_failure_subs_local_var = OpenAPI_ddn_failure_subs_create ( ddn_failure_subs_ind ? ddn_failure_subs_ind->valueint : 0, - ddd_traffic_descriptor_list ? ddd_traffic_descriptor_listList : NULL + ddn_failure_subs_info_list ? ddn_failure_subs_info_listList : NULL ); return ddn_failure_subs_local_var; diff --git a/lib/sbi/openapi/model/ddn_failure_subs.h b/lib/sbi/openapi/model/ddn_failure_subs.h index 7c2d9f645..aa4cfc8a6 100644 --- a/lib/sbi/openapi/model/ddn_failure_subs.h +++ b/lib/sbi/openapi/model/ddn_failure_subs.h @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "ddd_traffic_descriptor.h" +#include "ddn_failure_sub_info.h" #ifdef __cplusplus extern "C" { @@ -21,12 +21,12 @@ extern "C" { typedef struct OpenAPI_ddn_failure_subs_s OpenAPI_ddn_failure_subs_t; typedef struct OpenAPI_ddn_failure_subs_s { int ddn_failure_subs_ind; - OpenAPI_list_t *ddd_traffic_descriptor_list; + OpenAPI_list_t *ddn_failure_subs_info_list; } OpenAPI_ddn_failure_subs_t; OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_create( int ddn_failure_subs_ind, - OpenAPI_list_t *ddd_traffic_descriptor_list + OpenAPI_list_t *ddn_failure_subs_info_list ); void OpenAPI_ddn_failure_subs_free(OpenAPI_ddn_failure_subs_t *ddn_failure_subs); OpenAPI_ddn_failure_subs_t *OpenAPI_ddn_failure_subs_parseFromJSON(cJSON *ddn_failure_subsJSON); diff --git a/lib/sbi/openapi/model/default_notification_subscription.c b/lib/sbi/openapi/model/default_notification_subscription.c index 0a4d39d24..04565e6b9 100644 --- a/lib/sbi/openapi/model/default_notification_subscription.c +++ b/lib/sbi/openapi/model/default_notification_subscription.c @@ -9,7 +9,8 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr char *callback_uri, OpenAPI_n1_message_class_e n1_message_class, OpenAPI_n2_information_class_e n2_information_class, - OpenAPI_list_t *versions + OpenAPI_list_t *versions, + char *binding ) { OpenAPI_default_notification_subscription_t *default_notification_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_default_notification_subscription_t)); @@ -21,6 +22,7 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr default_notification_subscription_local_var->n1_message_class = n1_message_class; default_notification_subscription_local_var->n2_information_class = n2_information_class; default_notification_subscription_local_var->versions = versions; + default_notification_subscription_local_var->binding = binding; return default_notification_subscription_local_var; } @@ -36,6 +38,7 @@ void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification ogs_free(node->data); } OpenAPI_list_free(default_notification_subscription->versions); + ogs_free(default_notification_subscription->binding); ogs_free(default_notification_subscription); } @@ -97,6 +100,13 @@ cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_n } } + if (default_notification_subscription->binding) { + if (cJSON_AddStringToObject(item, "binding", default_notification_subscription->binding) == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [binding]"); + goto end; + } + } + end: return item; } @@ -172,12 +182,22 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr } } + cJSON *binding = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "binding"); + + if (binding) { + if (!cJSON_IsString(binding)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [binding]"); + goto end; + } + } + default_notification_subscription_local_var = OpenAPI_default_notification_subscription_create ( notification_typeVariable, ogs_strdup(callback_uri->valuestring), n1_message_class ? n1_message_classVariable : 0, n2_information_class ? n2_information_classVariable : 0, - versions ? versionsList : NULL + versions ? versionsList : NULL, + binding ? ogs_strdup(binding->valuestring) : NULL ); return default_notification_subscription_local_var; diff --git a/lib/sbi/openapi/model/default_notification_subscription.h b/lib/sbi/openapi/model/default_notification_subscription.h index 9f35bcba3..6359b7bf0 100644 --- a/lib/sbi/openapi/model/default_notification_subscription.h +++ b/lib/sbi/openapi/model/default_notification_subscription.h @@ -27,6 +27,7 @@ typedef struct OpenAPI_default_notification_subscription_s { OpenAPI_n1_message_class_e n1_message_class; OpenAPI_n2_information_class_e n2_information_class; OpenAPI_list_t *versions; + char *binding; } OpenAPI_default_notification_subscription_t; OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_create( @@ -34,7 +35,8 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr char *callback_uri, OpenAPI_n1_message_class_e n1_message_class, OpenAPI_n2_information_class_e n2_information_class, - OpenAPI_list_t *versions + OpenAPI_list_t *versions, + char *binding ); void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification_subscription_t *default_notification_subscription); OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_parseFromJSON(cJSON *default_notification_subscriptionJSON); diff --git a/lib/sbi/openapi/model/default_unrelated_class.c b/lib/sbi/openapi/model/default_unrelated_class.c new file mode 100644 index 000000000..292577bac --- /dev/null +++ b/lib/sbi/openapi/model/default_unrelated_class.c @@ -0,0 +1,244 @@ + +#include +#include +#include +#include "default_unrelated_class.h" + +OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_create( + OpenAPI_list_t *allowed_geographic_area, + OpenAPI_privacy_check_related_action_e privacy_check_related_action, + OpenAPI_code_word_ind_e code_word_ind, + OpenAPI_valid_time_period_t *valid_time_period, + OpenAPI_list_t *code_word_list + ) +{ + OpenAPI_default_unrelated_class_t *default_unrelated_class_local_var = OpenAPI_malloc(sizeof(OpenAPI_default_unrelated_class_t)); + if (!default_unrelated_class_local_var) { + return NULL; + } + default_unrelated_class_local_var->allowed_geographic_area = allowed_geographic_area; + default_unrelated_class_local_var->privacy_check_related_action = privacy_check_related_action; + default_unrelated_class_local_var->code_word_ind = code_word_ind; + default_unrelated_class_local_var->valid_time_period = valid_time_period; + default_unrelated_class_local_var->code_word_list = code_word_list; + + return default_unrelated_class_local_var; +} + +void OpenAPI_default_unrelated_class_free(OpenAPI_default_unrelated_class_t *default_unrelated_class) +{ + if (NULL == default_unrelated_class) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(default_unrelated_class->allowed_geographic_area, node) { + OpenAPI_geographic_area_free(node->data); + } + OpenAPI_list_free(default_unrelated_class->allowed_geographic_area); + OpenAPI_valid_time_period_free(default_unrelated_class->valid_time_period); + OpenAPI_list_for_each(default_unrelated_class->code_word_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(default_unrelated_class->code_word_list); + ogs_free(default_unrelated_class); +} + +cJSON *OpenAPI_default_unrelated_class_convertToJSON(OpenAPI_default_unrelated_class_t *default_unrelated_class) +{ + cJSON *item = NULL; + + if (default_unrelated_class == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [DefaultUnrelatedClass]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (default_unrelated_class->allowed_geographic_area) { + cJSON *allowed_geographic_areaList = cJSON_AddArrayToObject(item, "allowedGeographicArea"); + if (allowed_geographic_areaList == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [allowed_geographic_area]"); + goto end; + } + + OpenAPI_lnode_t *allowed_geographic_area_node; + if (default_unrelated_class->allowed_geographic_area) { + OpenAPI_list_for_each(default_unrelated_class->allowed_geographic_area, allowed_geographic_area_node) { + cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(allowed_geographic_area_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [allowed_geographic_area]"); + goto end; + } + cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal); + } + } + } + + if (default_unrelated_class->privacy_check_related_action) { + if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(default_unrelated_class->privacy_check_related_action)) == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [privacy_check_related_action]"); + goto end; + } + } + + if (default_unrelated_class->code_word_ind) { + if (cJSON_AddStringToObject(item, "codeWordInd", OpenAPI_code_word_ind_ToString(default_unrelated_class->code_word_ind)) == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [code_word_ind]"); + goto end; + } + } + + if (default_unrelated_class->valid_time_period) { + cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_convertToJSON(default_unrelated_class->valid_time_period); + if (valid_time_period_local_JSON == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [valid_time_period]"); + goto end; + } + cJSON_AddItemToObject(item, "validTimePeriod", valid_time_period_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [valid_time_period]"); + goto end; + } + } + + if (default_unrelated_class->code_word_list) { + cJSON *code_word_list = cJSON_AddArrayToObject(item, "codeWordList"); + if (code_word_list == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [code_word_list]"); + goto end; + } + + OpenAPI_lnode_t *code_word_list_node; + OpenAPI_list_for_each(default_unrelated_class->code_word_list, code_word_list_node) { + if (cJSON_AddStringToObject(code_word_list, "", (char*)code_word_list_node->data) == NULL) { + ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [code_word_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_parseFromJSON(cJSON *default_unrelated_classJSON) +{ + OpenAPI_default_unrelated_class_t *default_unrelated_class_local_var = NULL; + cJSON *allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "allowedGeographicArea"); + + OpenAPI_list_t *allowed_geographic_areaList; + if (allowed_geographic_area) { + cJSON *allowed_geographic_area_local_nonprimitive; + if (!cJSON_IsArray(allowed_geographic_area)) { + ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [allowed_geographic_area]"); + goto end; + } + + allowed_geographic_areaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_geographic_area_local_nonprimitive, allowed_geographic_area ) { + if (!cJSON_IsObject(allowed_geographic_area_local_nonprimitive)) { + ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [allowed_geographic_area]"); + goto end; + } + OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local_nonprimitive); + + OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem); + } + } + + cJSON *privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "privacyCheckRelatedAction"); + + OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable; + if (privacy_check_related_action) { + if (!cJSON_IsString(privacy_check_related_action)) { + ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [privacy_check_related_action]"); + goto end; + } + privacy_check_related_actionVariable = OpenAPI_privacy_check_related_action_FromString(privacy_check_related_action->valuestring); + } + + cJSON *code_word_ind = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "codeWordInd"); + + OpenAPI_code_word_ind_e code_word_indVariable; + if (code_word_ind) { + if (!cJSON_IsString(code_word_ind)) { + ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_ind]"); + goto end; + } + code_word_indVariable = OpenAPI_code_word_ind_FromString(code_word_ind->valuestring); + } + + cJSON *valid_time_period = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "validTimePeriod"); + + OpenAPI_valid_time_period_t *valid_time_period_local_nonprim = NULL; + if (valid_time_period) { + valid_time_period_local_nonprim = OpenAPI_valid_time_period_parseFromJSON(valid_time_period); + } + + cJSON *code_word_list = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "codeWordList"); + + OpenAPI_list_t *code_word_listList; + if (code_word_list) { + cJSON *code_word_list_local; + if (!cJSON_IsArray(code_word_list)) { + ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_list]"); + goto end; + } + code_word_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(code_word_list_local, code_word_list) { + if (!cJSON_IsString(code_word_list_local)) { + ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_list]"); + goto end; + } + OpenAPI_list_add(code_word_listList, ogs_strdup(code_word_list_local->valuestring)); + } + } + + default_unrelated_class_local_var = OpenAPI_default_unrelated_class_create ( + allowed_geographic_area ? allowed_geographic_areaList : NULL, + privacy_check_related_action ? privacy_check_related_actionVariable : 0, + code_word_ind ? code_word_indVariable : 0, + valid_time_period ? valid_time_period_local_nonprim : NULL, + code_word_list ? code_word_listList : NULL + ); + + return default_unrelated_class_local_var; +end: + return NULL; +} + +OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_copy(OpenAPI_default_unrelated_class_t *dst, OpenAPI_default_unrelated_class_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_default_unrelated_class_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_default_unrelated_class_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_default_unrelated_class_free(dst); + dst = OpenAPI_default_unrelated_class_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/default_unrelated_class.h b/lib/sbi/openapi/model/default_unrelated_class.h new file mode 100644 index 000000000..54c401bbb --- /dev/null +++ b/lib/sbi/openapi/model/default_unrelated_class.h @@ -0,0 +1,50 @@ +/* + * default_unrelated_class.h + * + * + */ + +#ifndef _OpenAPI_default_unrelated_class_H_ +#define _OpenAPI_default_unrelated_class_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "code_word_ind.h" +#include "geographic_area.h" +#include "privacy_check_related_action.h" +#include "valid_time_period.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_default_unrelated_class_s OpenAPI_default_unrelated_class_t; +typedef struct OpenAPI_default_unrelated_class_s { + OpenAPI_list_t *allowed_geographic_area; + OpenAPI_privacy_check_related_action_e privacy_check_related_action; + OpenAPI_code_word_ind_e code_word_ind; + struct OpenAPI_valid_time_period_s *valid_time_period; + OpenAPI_list_t *code_word_list; +} OpenAPI_default_unrelated_class_t; + +OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_create( + OpenAPI_list_t *allowed_geographic_area, + OpenAPI_privacy_check_related_action_e privacy_check_related_action, + OpenAPI_code_word_ind_e code_word_ind, + OpenAPI_valid_time_period_t *valid_time_period, + OpenAPI_list_t *code_word_list + ); +void OpenAPI_default_unrelated_class_free(OpenAPI_default_unrelated_class_t *default_unrelated_class); +OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_parseFromJSON(cJSON *default_unrelated_classJSON); +cJSON *OpenAPI_default_unrelated_class_convertToJSON(OpenAPI_default_unrelated_class_t *default_unrelated_class); +OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_copy(OpenAPI_default_unrelated_class_t *dst, OpenAPI_default_unrelated_class_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_default_unrelated_class_H_ */ + diff --git a/lib/sbi/openapi/model/deregistration_data.c b/lib/sbi/openapi/model/deregistration_data.c index 05de70278..71e2efb21 100644 --- a/lib/sbi/openapi/model/deregistration_data.c +++ b/lib/sbi/openapi/model/deregistration_data.c @@ -59,13 +59,11 @@ cJSON *OpenAPI_deregistration_data_convertToJSON(OpenAPI_deregistration_data_t * goto end; } - if (!deregistration_data->access_type) { - ogs_error("OpenAPI_deregistration_data_convertToJSON() failed [access_type]"); - goto end; - } - if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(deregistration_data->access_type)) == NULL) { - ogs_error("OpenAPI_deregistration_data_convertToJSON() failed [access_type]"); - goto end; + if (deregistration_data->access_type) { + if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(deregistration_data->access_type)) == NULL) { + ogs_error("OpenAPI_deregistration_data_convertToJSON() failed [access_type]"); + goto end; + } } if (deregistration_data->pdu_session_id) { @@ -100,18 +98,15 @@ OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_parseFromJSON(cJSON * dereg_reason_local_nonprim = OpenAPI_deregistration_reason_parseFromJSON(dereg_reason); cJSON *access_type = cJSON_GetObjectItemCaseSensitive(deregistration_dataJSON, "accessType"); - if (!access_type) { - ogs_error("OpenAPI_deregistration_data_parseFromJSON() failed [access_type]"); - goto end; - } OpenAPI_access_type_e access_typeVariable; - - if (!cJSON_IsString(access_type)) { - ogs_error("OpenAPI_deregistration_data_parseFromJSON() failed [access_type]"); - goto end; + if (access_type) { + if (!cJSON_IsString(access_type)) { + ogs_error("OpenAPI_deregistration_data_parseFromJSON() failed [access_type]"); + goto end; + } + access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring); } - access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring); cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(deregistration_dataJSON, "pduSessionId"); @@ -133,7 +128,7 @@ OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_parseFromJSON(cJSON * deregistration_data_local_var = OpenAPI_deregistration_data_create ( dereg_reason_local_nonprim, - access_typeVariable, + access_type ? access_typeVariable : 0, pdu_session_id ? pdu_session_id->valuedouble : 0, new_smf_instance_id ? ogs_strdup(new_smf_instance_id->valuestring) : NULL ); diff --git a/lib/sbi/openapi/model/dl_data_delivery_status.c b/lib/sbi/openapi/model/dl_data_delivery_status.c index 62a147044..4fc3a6105 100644 --- a/lib/sbi/openapi/model/dl_data_delivery_status.c +++ b/lib/sbi/openapi/model/dl_data_delivery_status.c @@ -4,82 +4,27 @@ #include #include "dl_data_delivery_status.h" -OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_create( - ) +char* OpenAPI_dl_data_delivery_status_ToString(OpenAPI_dl_data_delivery_status_e dl_data_delivery_status) { - OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_dl_data_delivery_status_t)); - if (!dl_data_delivery_status_local_var) { - return NULL; - } - - return dl_data_delivery_status_local_var; + const char *dl_data_delivery_statusArray[] = { "NULL", "BUFFERED", "TRANSMITTED", "DISCARDED" }; + size_t sizeofArray = sizeof(dl_data_delivery_statusArray) / sizeof(dl_data_delivery_statusArray[0]); + if (dl_data_delivery_status < sizeofArray) + return (char *)dl_data_delivery_statusArray[dl_data_delivery_status]; + else + return (char *)"Unknown"; } -void OpenAPI_dl_data_delivery_status_free(OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status) +OpenAPI_dl_data_delivery_status_e OpenAPI_dl_data_delivery_status_FromString(char* dl_data_delivery_status) { - if (NULL == dl_data_delivery_status) { - return; + int stringToReturn = 0; + const char *dl_data_delivery_statusArray[] = { "NULL", "BUFFERED", "TRANSMITTED", "DISCARDED" }; + size_t sizeofArray = sizeof(dl_data_delivery_statusArray) / sizeof(dl_data_delivery_statusArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(dl_data_delivery_status, dl_data_delivery_statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(dl_data_delivery_status); -} - -cJSON *OpenAPI_dl_data_delivery_status_convertToJSON(OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status) -{ - cJSON *item = NULL; - - if (dl_data_delivery_status == NULL) { - ogs_error("OpenAPI_dl_data_delivery_status_convertToJSON() failed [DlDataDeliveryStatus]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_parseFromJSON(cJSON *dl_data_delivery_statusJSON) -{ - OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status_local_var = NULL; - dl_data_delivery_status_local_var = OpenAPI_dl_data_delivery_status_create ( - ); - - return dl_data_delivery_status_local_var; -end: - return NULL; -} - -OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_copy(OpenAPI_dl_data_delivery_status_t *dst, OpenAPI_dl_data_delivery_status_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_dl_data_delivery_status_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_dl_data_delivery_status_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_dl_data_delivery_status_free(dst); - dst = OpenAPI_dl_data_delivery_status_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/dl_data_delivery_status.h b/lib/sbi/openapi/model/dl_data_delivery_status.h index 5bf518ef8..dff3f7def 100644 --- a/lib/sbi/openapi/model/dl_data_delivery_status.h +++ b/lib/sbi/openapi/model/dl_data_delivery_status.h @@ -1,7 +1,7 @@ /* * dl_data_delivery_status.h * - * Possible values are - BUFFERED: The first downlink data is buffered with extended buffering matching the source of the downlink traffic. - TRANSMITTED: The first downlink data matching the source of the downlink traffic is transmitted after previous buffering or discarding of corresponding packet(s) because the UE of the PDU Session becomes ACTIVE, and buffered data can be delivered to UE. - DISCARDED: The first downlink data matching the source of the downlink traffic is discarded because the Extended Buffering time, as determined by the SMF, expires or the amount of downlink data to be buffered is exceeded. + * */ #ifndef _OpenAPI_dl_data_delivery_status_H_ @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_dl_data_delivery_status_s OpenAPI_dl_data_delivery_status_t; -typedef struct OpenAPI_dl_data_delivery_status_s { -} OpenAPI_dl_data_delivery_status_t; +typedef enum { OpenAPI_dl_data_delivery_status_NULL = 0, OpenAPI_dl_data_delivery_status_BUFFERED, OpenAPI_dl_data_delivery_status_TRANSMITTED, OpenAPI_dl_data_delivery_status_DISCARDED } OpenAPI_dl_data_delivery_status_e; -OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_create( - ); -void OpenAPI_dl_data_delivery_status_free(OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status); -OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_parseFromJSON(cJSON *dl_data_delivery_statusJSON); -cJSON *OpenAPI_dl_data_delivery_status_convertToJSON(OpenAPI_dl_data_delivery_status_t *dl_data_delivery_status); -OpenAPI_dl_data_delivery_status_t *OpenAPI_dl_data_delivery_status_copy(OpenAPI_dl_data_delivery_status_t *dst, OpenAPI_dl_data_delivery_status_t *src); +char* OpenAPI_dl_data_delivery_status_ToString(OpenAPI_dl_data_delivery_status_e dl_data_delivery_status); + +OpenAPI_dl_data_delivery_status_e OpenAPI_dl_data_delivery_status_FromString(char* dl_data_delivery_status); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/dnn_configuration.c b/lib/sbi/openapi/model/dnn_configuration.c index 19c545fbb..e140c6935 100644 --- a/lib/sbi/openapi/model/dnn_configuration.c +++ b/lib/sbi/openapi/model/dnn_configuration.c @@ -14,14 +14,16 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( OpenAPI_list_t *static_ip_address, OpenAPI_up_security_t *up_security, OpenAPI_pdu_session_continuity_ind_e pdu_session_continuity_ind, - int invoke_nef_selection, char *nidd_nef_id, OpenAPI_nidd_information_t *nidd_info, int redundant_session_allowed, OpenAPI_acs_info_t *acs_info, OpenAPI_list_t *ipv4_frame_route_list, OpenAPI_list_t *ipv6_frame_route_list, - int atsss_allowed + int atsss_allowed, + int secondary_auth, + int dn_aaa_ip_address_allocation, + OpenAPI_ip_address_t *dn_aaa_address ) { OpenAPI_dnn_configuration_t *dnn_configuration_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnn_configuration_t)); @@ -37,7 +39,6 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( dnn_configuration_local_var->static_ip_address = static_ip_address; dnn_configuration_local_var->up_security = up_security; dnn_configuration_local_var->pdu_session_continuity_ind = pdu_session_continuity_ind; - dnn_configuration_local_var->invoke_nef_selection = invoke_nef_selection; dnn_configuration_local_var->nidd_nef_id = nidd_nef_id; dnn_configuration_local_var->nidd_info = nidd_info; dnn_configuration_local_var->redundant_session_allowed = redundant_session_allowed; @@ -45,6 +46,9 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( dnn_configuration_local_var->ipv4_frame_route_list = ipv4_frame_route_list; dnn_configuration_local_var->ipv6_frame_route_list = ipv6_frame_route_list; dnn_configuration_local_var->atsss_allowed = atsss_allowed; + dnn_configuration_local_var->secondary_auth = secondary_auth; + dnn_configuration_local_var->dn_aaa_ip_address_allocation = dn_aaa_ip_address_allocation; + dnn_configuration_local_var->dn_aaa_address = dn_aaa_address; return dnn_configuration_local_var; } @@ -76,6 +80,7 @@ void OpenAPI_dnn_configuration_free(OpenAPI_dnn_configuration_t *dnn_configurati OpenAPI_frame_route_info_free(node->data); } OpenAPI_list_free(dnn_configuration->ipv6_frame_route_list); + OpenAPI_ip_address_free(dnn_configuration->dn_aaa_address); ogs_free(dnn_configuration); } @@ -199,13 +204,6 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } - if (dnn_configuration->invoke_nef_selection) { - if (cJSON_AddBoolToObject(item, "invokeNefSelection", dnn_configuration->invoke_nef_selection) == NULL) { - ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [invoke_nef_selection]"); - goto end; - } - } - if (dnn_configuration->nidd_nef_id) { if (cJSON_AddStringToObject(item, "niddNefId", dnn_configuration->nidd_nef_id) == NULL) { ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [nidd_nef_id]"); @@ -293,6 +291,33 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } + if (dnn_configuration->secondary_auth) { + if (cJSON_AddBoolToObject(item, "secondaryAuth", dnn_configuration->secondary_auth) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [secondary_auth]"); + goto end; + } + } + + if (dnn_configuration->dn_aaa_ip_address_allocation) { + if (cJSON_AddBoolToObject(item, "dnAaaIpAddressAllocation", dnn_configuration->dn_aaa_ip_address_allocation) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [dn_aaa_ip_address_allocation]"); + goto end; + } + } + + if (dnn_configuration->dn_aaa_address) { + cJSON *dn_aaa_address_local_JSON = OpenAPI_ip_address_convertToJSON(dnn_configuration->dn_aaa_address); + if (dn_aaa_address_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + cJSON_AddItemToObject(item, "dnAaaAddress", dn_aaa_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + } + end: return item; } @@ -393,15 +418,6 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ pdu_session_continuity_indVariable = OpenAPI_pdu_session_continuity_ind_FromString(pdu_session_continuity_ind->valuestring); } - cJSON *invoke_nef_selection = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "invokeNefSelection"); - - if (invoke_nef_selection) { - if (!cJSON_IsBool(invoke_nef_selection)) { - ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [invoke_nef_selection]"); - goto end; - } - } - cJSON *nidd_nef_id = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "niddNefId"); if (nidd_nef_id) { @@ -489,6 +505,31 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ } } + cJSON *secondary_auth = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "secondaryAuth"); + + if (secondary_auth) { + if (!cJSON_IsBool(secondary_auth)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [secondary_auth]"); + goto end; + } + } + + cJSON *dn_aaa_ip_address_allocation = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "dnAaaIpAddressAllocation"); + + if (dn_aaa_ip_address_allocation) { + if (!cJSON_IsBool(dn_aaa_ip_address_allocation)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [dn_aaa_ip_address_allocation]"); + goto end; + } + } + + cJSON *dn_aaa_address = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "dnAaaAddress"); + + OpenAPI_ip_address_t *dn_aaa_address_local_nonprim = NULL; + if (dn_aaa_address) { + dn_aaa_address_local_nonprim = OpenAPI_ip_address_parseFromJSON(dn_aaa_address); + } + dnn_configuration_local_var = OpenAPI_dnn_configuration_create ( pdu_session_types_local_nonprim, ssc_modes_local_nonprim, @@ -499,14 +540,16 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ static_ip_address ? static_ip_addressList : NULL, up_security ? up_security_local_nonprim : NULL, pdu_session_continuity_ind ? pdu_session_continuity_indVariable : 0, - invoke_nef_selection ? invoke_nef_selection->valueint : 0, nidd_nef_id ? ogs_strdup(nidd_nef_id->valuestring) : NULL, nidd_info ? nidd_info_local_nonprim : NULL, redundant_session_allowed ? redundant_session_allowed->valueint : 0, acs_info ? acs_info_local_nonprim : NULL, ipv4_frame_route_list ? ipv4_frame_route_listList : NULL, ipv6_frame_route_list ? ipv6_frame_route_listList : NULL, - atsss_allowed ? atsss_allowed->valueint : 0 + atsss_allowed ? atsss_allowed->valueint : 0, + secondary_auth ? secondary_auth->valueint : 0, + dn_aaa_ip_address_allocation ? dn_aaa_ip_address_allocation->valueint : 0, + dn_aaa_address ? dn_aaa_address_local_nonprim : NULL ); return dnn_configuration_local_var; diff --git a/lib/sbi/openapi/model/dnn_configuration.h b/lib/sbi/openapi/model/dnn_configuration.h index e124a640b..5980cade2 100644 --- a/lib/sbi/openapi/model/dnn_configuration.h +++ b/lib/sbi/openapi/model/dnn_configuration.h @@ -38,7 +38,6 @@ typedef struct OpenAPI_dnn_configuration_s { OpenAPI_list_t *static_ip_address; struct OpenAPI_up_security_s *up_security; OpenAPI_pdu_session_continuity_ind_e pdu_session_continuity_ind; - int invoke_nef_selection; char *nidd_nef_id; struct OpenAPI_nidd_information_s *nidd_info; int redundant_session_allowed; @@ -46,6 +45,9 @@ typedef struct OpenAPI_dnn_configuration_s { OpenAPI_list_t *ipv4_frame_route_list; OpenAPI_list_t *ipv6_frame_route_list; int atsss_allowed; + int secondary_auth; + int dn_aaa_ip_address_allocation; + struct OpenAPI_ip_address_s *dn_aaa_address; } OpenAPI_dnn_configuration_t; OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( @@ -58,14 +60,16 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( OpenAPI_list_t *static_ip_address, OpenAPI_up_security_t *up_security, OpenAPI_pdu_session_continuity_ind_e pdu_session_continuity_ind, - int invoke_nef_selection, char *nidd_nef_id, OpenAPI_nidd_information_t *nidd_info, int redundant_session_allowed, OpenAPI_acs_info_t *acs_info, OpenAPI_list_t *ipv4_frame_route_list, OpenAPI_list_t *ipv6_frame_route_list, - int atsss_allowed + int atsss_allowed, + int secondary_auth, + int dn_aaa_ip_address_allocation, + OpenAPI_ip_address_t *dn_aaa_address ); void OpenAPI_dnn_configuration_free(OpenAPI_dnn_configuration_t *dnn_configuration); OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_configurationJSON); diff --git a/lib/sbi/openapi/model/dnn_info.c b/lib/sbi/openapi/model/dnn_info.c index 6c1c0c0d6..9765a5a2f 100644 --- a/lib/sbi/openapi/model/dnn_info.c +++ b/lib/sbi/openapi/model/dnn_info.c @@ -9,7 +9,10 @@ OpenAPI_dnn_info_t *OpenAPI_dnn_info_create( int default_dnn_indicator, int lbo_roaming_allowed, int iwk_eps_ind, - int dnn_barred + int dnn_barred, + int invoke_nef_ind, + OpenAPI_list_t *smf_list, + int same_smf_ind ) { OpenAPI_dnn_info_t *dnn_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnn_info_t)); @@ -21,6 +24,9 @@ OpenAPI_dnn_info_t *OpenAPI_dnn_info_create( dnn_info_local_var->lbo_roaming_allowed = lbo_roaming_allowed; dnn_info_local_var->iwk_eps_ind = iwk_eps_ind; dnn_info_local_var->dnn_barred = dnn_barred; + dnn_info_local_var->invoke_nef_ind = invoke_nef_ind; + dnn_info_local_var->smf_list = smf_list; + dnn_info_local_var->same_smf_ind = same_smf_ind; return dnn_info_local_var; } @@ -32,6 +38,10 @@ void OpenAPI_dnn_info_free(OpenAPI_dnn_info_t *dnn_info) } OpenAPI_lnode_t *node; ogs_free(dnn_info->dnn); + OpenAPI_list_for_each(dnn_info->smf_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_info->smf_list); ogs_free(dnn_info); } @@ -82,6 +92,36 @@ cJSON *OpenAPI_dnn_info_convertToJSON(OpenAPI_dnn_info_t *dnn_info) } } + if (dnn_info->invoke_nef_ind) { + if (cJSON_AddBoolToObject(item, "invokeNefInd", dnn_info->invoke_nef_ind) == NULL) { + ogs_error("OpenAPI_dnn_info_convertToJSON() failed [invoke_nef_ind]"); + goto end; + } + } + + if (dnn_info->smf_list) { + cJSON *smf_list = cJSON_AddArrayToObject(item, "smfList"); + if (smf_list == NULL) { + ogs_error("OpenAPI_dnn_info_convertToJSON() failed [smf_list]"); + goto end; + } + + OpenAPI_lnode_t *smf_list_node; + OpenAPI_list_for_each(dnn_info->smf_list, smf_list_node) { + if (cJSON_AddStringToObject(smf_list, "", (char*)smf_list_node->data) == NULL) { + ogs_error("OpenAPI_dnn_info_convertToJSON() failed [smf_list]"); + goto end; + } + } + } + + if (dnn_info->same_smf_ind) { + if (cJSON_AddBoolToObject(item, "sameSmfInd", dnn_info->same_smf_ind) == NULL) { + ogs_error("OpenAPI_dnn_info_convertToJSON() failed [same_smf_ind]"); + goto end; + } + } + end: return item; } @@ -137,12 +177,53 @@ OpenAPI_dnn_info_t *OpenAPI_dnn_info_parseFromJSON(cJSON *dnn_infoJSON) } } + cJSON *invoke_nef_ind = cJSON_GetObjectItemCaseSensitive(dnn_infoJSON, "invokeNefInd"); + + if (invoke_nef_ind) { + if (!cJSON_IsBool(invoke_nef_ind)) { + ogs_error("OpenAPI_dnn_info_parseFromJSON() failed [invoke_nef_ind]"); + goto end; + } + } + + cJSON *smf_list = cJSON_GetObjectItemCaseSensitive(dnn_infoJSON, "smfList"); + + OpenAPI_list_t *smf_listList; + if (smf_list) { + cJSON *smf_list_local; + if (!cJSON_IsArray(smf_list)) { + ogs_error("OpenAPI_dnn_info_parseFromJSON() failed [smf_list]"); + goto end; + } + smf_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(smf_list_local, smf_list) { + if (!cJSON_IsString(smf_list_local)) { + ogs_error("OpenAPI_dnn_info_parseFromJSON() failed [smf_list]"); + goto end; + } + OpenAPI_list_add(smf_listList, ogs_strdup(smf_list_local->valuestring)); + } + } + + cJSON *same_smf_ind = cJSON_GetObjectItemCaseSensitive(dnn_infoJSON, "sameSmfInd"); + + if (same_smf_ind) { + if (!cJSON_IsBool(same_smf_ind)) { + ogs_error("OpenAPI_dnn_info_parseFromJSON() failed [same_smf_ind]"); + goto end; + } + } + dnn_info_local_var = OpenAPI_dnn_info_create ( ogs_strdup(dnn->valuestring), default_dnn_indicator ? default_dnn_indicator->valueint : 0, lbo_roaming_allowed ? lbo_roaming_allowed->valueint : 0, iwk_eps_ind ? iwk_eps_ind->valueint : 0, - dnn_barred ? dnn_barred->valueint : 0 + dnn_barred ? dnn_barred->valueint : 0, + invoke_nef_ind ? invoke_nef_ind->valueint : 0, + smf_list ? smf_listList : NULL, + same_smf_ind ? same_smf_ind->valueint : 0 ); return dnn_info_local_var; diff --git a/lib/sbi/openapi/model/dnn_info.h b/lib/sbi/openapi/model/dnn_info.h index 2ac901cc4..437cb8d8d 100644 --- a/lib/sbi/openapi/model/dnn_info.h +++ b/lib/sbi/openapi/model/dnn_info.h @@ -24,6 +24,9 @@ typedef struct OpenAPI_dnn_info_s { int lbo_roaming_allowed; int iwk_eps_ind; int dnn_barred; + int invoke_nef_ind; + OpenAPI_list_t *smf_list; + int same_smf_ind; } OpenAPI_dnn_info_t; OpenAPI_dnn_info_t *OpenAPI_dnn_info_create( @@ -31,7 +34,10 @@ OpenAPI_dnn_info_t *OpenAPI_dnn_info_create( int default_dnn_indicator, int lbo_roaming_allowed, int iwk_eps_ind, - int dnn_barred + int dnn_barred, + int invoke_nef_ind, + OpenAPI_list_t *smf_list, + int same_smf_ind ); void OpenAPI_dnn_info_free(OpenAPI_dnn_info_t *dnn_info); OpenAPI_dnn_info_t *OpenAPI_dnn_info_parseFromJSON(cJSON *dnn_infoJSON); diff --git a/lib/sbi/openapi/model/dynamic5_qi.c b/lib/sbi/openapi/model/dynamic5_qi.c index dd890c85d..dc8f3a7b3 100644 --- a/lib/sbi/openapi/model/dynamic5_qi.c +++ b/lib/sbi/openapi/model/dynamic5_qi.c @@ -11,7 +11,10 @@ OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_create( char *packet_err_rate, int aver_window, int max_data_burst_vol, - int ext_max_data_burst_vol + int ext_max_data_burst_vol, + int ext_packet_del_budget, + int cn_packet_delay_budget_dl, + int cn_packet_delay_budget_ul ) { OpenAPI_dynamic5_qi_t *dynamic5_qi_local_var = OpenAPI_malloc(sizeof(OpenAPI_dynamic5_qi_t)); @@ -25,6 +28,9 @@ OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_create( dynamic5_qi_local_var->aver_window = aver_window; dynamic5_qi_local_var->max_data_burst_vol = max_data_burst_vol; dynamic5_qi_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol; + dynamic5_qi_local_var->ext_packet_del_budget = ext_packet_del_budget; + dynamic5_qi_local_var->cn_packet_delay_budget_dl = cn_packet_delay_budget_dl; + dynamic5_qi_local_var->cn_packet_delay_budget_ul = cn_packet_delay_budget_ul; return dynamic5_qi_local_var; } @@ -113,6 +119,27 @@ cJSON *OpenAPI_dynamic5_qi_convertToJSON(OpenAPI_dynamic5_qi_t *dynamic5_qi) } } + if (dynamic5_qi->ext_packet_del_budget) { + if (cJSON_AddNumberToObject(item, "extPacketDelBudget", dynamic5_qi->ext_packet_del_budget) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [ext_packet_del_budget]"); + goto end; + } + } + + if (dynamic5_qi->cn_packet_delay_budget_dl) { + if (cJSON_AddNumberToObject(item, "cnPacketDelayBudgetDl", dynamic5_qi->cn_packet_delay_budget_dl) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [cn_packet_delay_budget_dl]"); + goto end; + } + } + + if (dynamic5_qi->cn_packet_delay_budget_ul) { + if (cJSON_AddNumberToObject(item, "cnPacketDelayBudgetUl", dynamic5_qi->cn_packet_delay_budget_ul) == NULL) { + ogs_error("OpenAPI_dynamic5_qi_convertToJSON() failed [cn_packet_delay_budget_ul]"); + goto end; + } + } + end: return item; } @@ -193,6 +220,33 @@ OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_parseFromJSON(cJSON *dynamic5_qiJSON) } } + cJSON *ext_packet_del_budget = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "extPacketDelBudget"); + + if (ext_packet_del_budget) { + if (!cJSON_IsNumber(ext_packet_del_budget)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [ext_packet_del_budget]"); + goto end; + } + } + + cJSON *cn_packet_delay_budget_dl = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "cnPacketDelayBudgetDl"); + + if (cn_packet_delay_budget_dl) { + if (!cJSON_IsNumber(cn_packet_delay_budget_dl)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [cn_packet_delay_budget_dl]"); + goto end; + } + } + + cJSON *cn_packet_delay_budget_ul = cJSON_GetObjectItemCaseSensitive(dynamic5_qiJSON, "cnPacketDelayBudgetUl"); + + if (cn_packet_delay_budget_ul) { + if (!cJSON_IsNumber(cn_packet_delay_budget_ul)) { + ogs_error("OpenAPI_dynamic5_qi_parseFromJSON() failed [cn_packet_delay_budget_ul]"); + goto end; + } + } + dynamic5_qi_local_var = OpenAPI_dynamic5_qi_create ( resource_type_local_nonprim, priority_level->valuedouble, @@ -200,7 +254,10 @@ OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_parseFromJSON(cJSON *dynamic5_qiJSON) ogs_strdup(packet_err_rate->valuestring), aver_window ? aver_window->valuedouble : 0, max_data_burst_vol ? max_data_burst_vol->valuedouble : 0, - ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0 + ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0, + ext_packet_del_budget ? ext_packet_del_budget->valuedouble : 0, + cn_packet_delay_budget_dl ? cn_packet_delay_budget_dl->valuedouble : 0, + cn_packet_delay_budget_ul ? cn_packet_delay_budget_ul->valuedouble : 0 ); return dynamic5_qi_local_var; diff --git a/lib/sbi/openapi/model/dynamic5_qi.h b/lib/sbi/openapi/model/dynamic5_qi.h index c1f9df527..b8c6681d2 100644 --- a/lib/sbi/openapi/model/dynamic5_qi.h +++ b/lib/sbi/openapi/model/dynamic5_qi.h @@ -27,6 +27,9 @@ typedef struct OpenAPI_dynamic5_qi_s { int aver_window; int max_data_burst_vol; int ext_max_data_burst_vol; + int ext_packet_del_budget; + int cn_packet_delay_budget_dl; + int cn_packet_delay_budget_ul; } OpenAPI_dynamic5_qi_t; OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_create( @@ -36,7 +39,10 @@ OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_create( char *packet_err_rate, int aver_window, int max_data_burst_vol, - int ext_max_data_burst_vol + int ext_max_data_burst_vol, + int ext_packet_del_budget, + int cn_packet_delay_budget_dl, + int cn_packet_delay_budget_ul ); void OpenAPI_dynamic5_qi_free(OpenAPI_dynamic5_qi_t *dynamic5_qi); OpenAPI_dynamic5_qi_t *OpenAPI_dynamic5_qi_parseFromJSON(cJSON *dynamic5_qiJSON); diff --git a/lib/sbi/openapi/model/ec_restriction.c b/lib/sbi/openapi/model/ec_restriction.c index 285a0a701..9a2678342 100644 --- a/lib/sbi/openapi/model/ec_restriction.c +++ b/lib/sbi/openapi/model/ec_restriction.c @@ -7,7 +7,8 @@ OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_create( char *af_instance_id, int reference_id, - OpenAPI_list_t *plmn_ec_infos + OpenAPI_list_t *plmn_ec_infos, + char *mtc_provider_information ) { OpenAPI_ec_restriction_t *ec_restriction_local_var = OpenAPI_malloc(sizeof(OpenAPI_ec_restriction_t)); @@ -17,6 +18,7 @@ OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_create( ec_restriction_local_var->af_instance_id = af_instance_id; ec_restriction_local_var->reference_id = reference_id; ec_restriction_local_var->plmn_ec_infos = plmn_ec_infos; + ec_restriction_local_var->mtc_provider_information = mtc_provider_information; return ec_restriction_local_var; } @@ -32,6 +34,7 @@ void OpenAPI_ec_restriction_free(OpenAPI_ec_restriction_t *ec_restriction) OpenAPI_plmn_ec_info_free(node->data); } OpenAPI_list_free(ec_restriction->plmn_ec_infos); + ogs_free(ec_restriction->mtc_provider_information); ogs_free(ec_restriction); } @@ -83,6 +86,13 @@ cJSON *OpenAPI_ec_restriction_convertToJSON(OpenAPI_ec_restriction_t *ec_restric } } + if (ec_restriction->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", ec_restriction->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_ec_restriction_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -137,10 +147,20 @@ OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_parseFromJSON(cJSON *ec_restric } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(ec_restrictionJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_ec_restriction_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + ec_restriction_local_var = OpenAPI_ec_restriction_create ( ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, - plmn_ec_infos ? plmn_ec_infosList : NULL + plmn_ec_infos ? plmn_ec_infosList : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return ec_restriction_local_var; diff --git a/lib/sbi/openapi/model/ec_restriction.h b/lib/sbi/openapi/model/ec_restriction.h index e91a21315..45130392a 100644 --- a/lib/sbi/openapi/model/ec_restriction.h +++ b/lib/sbi/openapi/model/ec_restriction.h @@ -23,12 +23,14 @@ typedef struct OpenAPI_ec_restriction_s { char *af_instance_id; int reference_id; OpenAPI_list_t *plmn_ec_infos; + char *mtc_provider_information; } OpenAPI_ec_restriction_t; OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_create( char *af_instance_id, int reference_id, - OpenAPI_list_t *plmn_ec_infos + OpenAPI_list_t *plmn_ec_infos, + char *mtc_provider_information ); void OpenAPI_ec_restriction_free(OpenAPI_ec_restriction_t *ec_restriction); OpenAPI_ec_restriction_t *OpenAPI_ec_restriction_parseFromJSON(cJSON *ec_restrictionJSON); diff --git a/lib/sbi/openapi/model/ec_restriction_data.c b/lib/sbi/openapi/model/ec_restriction_data.c deleted file mode 100644 index f140775fa..000000000 --- a/lib/sbi/openapi/model/ec_restriction_data.c +++ /dev/null @@ -1,123 +0,0 @@ - -#include -#include -#include -#include "ec_restriction_data.h" - -OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_create( - int ec_mode_a_restricted, - int ec_mode_b_restricted - ) -{ - OpenAPI_ec_restriction_data_t *ec_restriction_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ec_restriction_data_t)); - if (!ec_restriction_data_local_var) { - return NULL; - } - ec_restriction_data_local_var->ec_mode_a_restricted = ec_mode_a_restricted; - ec_restriction_data_local_var->ec_mode_b_restricted = ec_mode_b_restricted; - - return ec_restriction_data_local_var; -} - -void OpenAPI_ec_restriction_data_free(OpenAPI_ec_restriction_data_t *ec_restriction_data) -{ - if (NULL == ec_restriction_data) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(ec_restriction_data); -} - -cJSON *OpenAPI_ec_restriction_data_convertToJSON(OpenAPI_ec_restriction_data_t *ec_restriction_data) -{ - cJSON *item = NULL; - - if (ec_restriction_data == NULL) { - ogs_error("OpenAPI_ec_restriction_data_convertToJSON() failed [EcRestrictionData]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (ec_restriction_data->ec_mode_a_restricted) { - if (cJSON_AddBoolToObject(item, "ecModeARestricted", ec_restriction_data->ec_mode_a_restricted) == NULL) { - ogs_error("OpenAPI_ec_restriction_data_convertToJSON() failed [ec_mode_a_restricted]"); - goto end; - } - } - - if (ec_restriction_data->ec_mode_b_restricted) { - if (cJSON_AddBoolToObject(item, "ecModeBRestricted", ec_restriction_data->ec_mode_b_restricted) == NULL) { - ogs_error("OpenAPI_ec_restriction_data_convertToJSON() failed [ec_mode_b_restricted]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_parseFromJSON(cJSON *ec_restriction_dataJSON) -{ - OpenAPI_ec_restriction_data_t *ec_restriction_data_local_var = NULL; - cJSON *ec_mode_a_restricted = cJSON_GetObjectItemCaseSensitive(ec_restriction_dataJSON, "ecModeARestricted"); - - if (ec_mode_a_restricted) { - if (!cJSON_IsBool(ec_mode_a_restricted)) { - ogs_error("OpenAPI_ec_restriction_data_parseFromJSON() failed [ec_mode_a_restricted]"); - goto end; - } - } - - cJSON *ec_mode_b_restricted = cJSON_GetObjectItemCaseSensitive(ec_restriction_dataJSON, "ecModeBRestricted"); - - if (ec_mode_b_restricted) { - if (!cJSON_IsBool(ec_mode_b_restricted)) { - ogs_error("OpenAPI_ec_restriction_data_parseFromJSON() failed [ec_mode_b_restricted]"); - goto end; - } - } - - ec_restriction_data_local_var = OpenAPI_ec_restriction_data_create ( - ec_mode_a_restricted ? ec_mode_a_restricted->valueint : 0, - ec_mode_b_restricted ? ec_mode_b_restricted->valueint : 0 - ); - - return ec_restriction_data_local_var; -end: - return NULL; -} - -OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_copy(OpenAPI_ec_restriction_data_t *dst, OpenAPI_ec_restriction_data_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_ec_restriction_data_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_ec_restriction_data_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_ec_restriction_data_free(dst); - dst = OpenAPI_ec_restriction_data_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/ec_restriction_data.h b/lib/sbi/openapi/model/ec_restriction_data.h deleted file mode 100644 index cb85f6556..000000000 --- a/lib/sbi/openapi/model/ec_restriction_data.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * ec_restriction_data.h - * - * - */ - -#ifndef _OpenAPI_ec_restriction_data_H_ -#define _OpenAPI_ec_restriction_data_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_ec_restriction_data_s OpenAPI_ec_restriction_data_t; -typedef struct OpenAPI_ec_restriction_data_s { - int ec_mode_a_restricted; - int ec_mode_b_restricted; -} OpenAPI_ec_restriction_data_t; - -OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_create( - int ec_mode_a_restricted, - int ec_mode_b_restricted - ); -void OpenAPI_ec_restriction_data_free(OpenAPI_ec_restriction_data_t *ec_restriction_data); -OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_parseFromJSON(cJSON *ec_restriction_dataJSON); -cJSON *OpenAPI_ec_restriction_data_convertToJSON(OpenAPI_ec_restriction_data_t *ec_restriction_data); -OpenAPI_ec_restriction_data_t *OpenAPI_ec_restriction_data_copy(OpenAPI_ec_restriction_data_t *dst, OpenAPI_ec_restriction_data_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_ec_restriction_data_H_ */ - diff --git a/lib/sbi/openapi/model/ec_restriction_data_wb.c b/lib/sbi/openapi/model/ec_restriction_data_wb.c new file mode 100644 index 000000000..da7864f4c --- /dev/null +++ b/lib/sbi/openapi/model/ec_restriction_data_wb.c @@ -0,0 +1,123 @@ + +#include +#include +#include +#include "ec_restriction_data_wb.h" + +OpenAPI_ec_restriction_data_wb_t *OpenAPI_ec_restriction_data_wb_create( + int ec_mode_a_restricted, + int ec_mode_b_restricted + ) +{ + OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_var = OpenAPI_malloc(sizeof(OpenAPI_ec_restriction_data_wb_t)); + if (!ec_restriction_data_wb_local_var) { + return NULL; + } + ec_restriction_data_wb_local_var->ec_mode_a_restricted = ec_mode_a_restricted; + ec_restriction_data_wb_local_var->ec_mode_b_restricted = ec_mode_b_restricted; + + return ec_restriction_data_wb_local_var; +} + +void OpenAPI_ec_restriction_data_wb_free(OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb) +{ + if (NULL == ec_restriction_data_wb) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ec_restriction_data_wb); +} + +cJSON *OpenAPI_ec_restriction_data_wb_convertToJSON(OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb) +{ + cJSON *item = NULL; + + if (ec_restriction_data_wb == NULL) { + ogs_error("OpenAPI_ec_restriction_data_wb_convertToJSON() failed [EcRestrictionDataWb]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ec_restriction_data_wb->ec_mode_a_restricted) { + if (cJSON_AddBoolToObject(item, "ecModeARestricted", ec_restriction_data_wb->ec_mode_a_restricted) == NULL) { + ogs_error("OpenAPI_ec_restriction_data_wb_convertToJSON() failed [ec_mode_a_restricted]"); + goto end; + } + } + + if (ec_restriction_data_wb->ec_mode_b_restricted) { + if (cJSON_AddBoolToObject(item, "ecModeBRestricted", ec_restriction_data_wb->ec_mode_b_restricted) == NULL) { + ogs_error("OpenAPI_ec_restriction_data_wb_convertToJSON() failed [ec_mode_b_restricted]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ec_restriction_data_wb_t *OpenAPI_ec_restriction_data_wb_parseFromJSON(cJSON *ec_restriction_data_wbJSON) +{ + OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_var = NULL; + cJSON *ec_mode_a_restricted = cJSON_GetObjectItemCaseSensitive(ec_restriction_data_wbJSON, "ecModeARestricted"); + + if (ec_mode_a_restricted) { + if (!cJSON_IsBool(ec_mode_a_restricted)) { + ogs_error("OpenAPI_ec_restriction_data_wb_parseFromJSON() failed [ec_mode_a_restricted]"); + goto end; + } + } + + cJSON *ec_mode_b_restricted = cJSON_GetObjectItemCaseSensitive(ec_restriction_data_wbJSON, "ecModeBRestricted"); + + if (ec_mode_b_restricted) { + if (!cJSON_IsBool(ec_mode_b_restricted)) { + ogs_error("OpenAPI_ec_restriction_data_wb_parseFromJSON() failed [ec_mode_b_restricted]"); + goto end; + } + } + + ec_restriction_data_wb_local_var = OpenAPI_ec_restriction_data_wb_create ( + ec_mode_a_restricted ? ec_mode_a_restricted->valueint : 0, + ec_mode_b_restricted ? ec_mode_b_restricted->valueint : 0 + ); + + return ec_restriction_data_wb_local_var; +end: + return NULL; +} + +OpenAPI_ec_restriction_data_wb_t *OpenAPI_ec_restriction_data_wb_copy(OpenAPI_ec_restriction_data_wb_t *dst, OpenAPI_ec_restriction_data_wb_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ec_restriction_data_wb_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ec_restriction_data_wb_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_ec_restriction_data_wb_free(dst); + dst = OpenAPI_ec_restriction_data_wb_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ec_restriction_data_wb.h b/lib/sbi/openapi/model/ec_restriction_data_wb.h new file mode 100644 index 000000000..2f2c7dcf6 --- /dev/null +++ b/lib/sbi/openapi/model/ec_restriction_data_wb.h @@ -0,0 +1,40 @@ +/* + * ec_restriction_data_wb.h + * + * + */ + +#ifndef _OpenAPI_ec_restriction_data_wb_H_ +#define _OpenAPI_ec_restriction_data_wb_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ec_restriction_data_wb_s OpenAPI_ec_restriction_data_wb_t; +typedef struct OpenAPI_ec_restriction_data_wb_s { + int ec_mode_a_restricted; + int ec_mode_b_restricted; +} OpenAPI_ec_restriction_data_wb_t; + +OpenAPI_ec_restriction_data_wb_t *OpenAPI_ec_restriction_data_wb_create( + int ec_mode_a_restricted, + int ec_mode_b_restricted + ); +void OpenAPI_ec_restriction_data_wb_free(OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb); +OpenAPI_ec_restriction_data_wb_t *OpenAPI_ec_restriction_data_wb_parseFromJSON(cJSON *ec_restriction_data_wbJSON); +cJSON *OpenAPI_ec_restriction_data_wb_convertToJSON(OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb); +OpenAPI_ec_restriction_data_wb_t *OpenAPI_ec_restriction_data_wb_copy(OpenAPI_ec_restriction_data_wb_t *dst, OpenAPI_ec_restriction_data_wb_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ec_restriction_data_wb_H_ */ + diff --git a/lib/sbi/openapi/model/ee_subscription.c b/lib/sbi/openapi/model/ee_subscription.c index 92e897c2f..3913a81d0 100644 --- a/lib/sbi/openapi/model/ee_subscription.c +++ b/lib/sbi/openapi/model/ee_subscription.c @@ -9,7 +9,12 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( OpenAPI_list_t* monitoring_configurations, OpenAPI_reporting_options_t *reporting_options, char *supported_features, - char *subscription_id + char *subscription_id, + OpenAPI_context_info_t *context_info, + int epc_applied_ind, + char *scef_diam_host, + char *scef_diam_realm, + char *notify_correlation_id ) { OpenAPI_ee_subscription_t *ee_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_ee_subscription_t)); @@ -21,6 +26,11 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( ee_subscription_local_var->reporting_options = reporting_options; ee_subscription_local_var->supported_features = supported_features; ee_subscription_local_var->subscription_id = subscription_id; + ee_subscription_local_var->context_info = context_info; + ee_subscription_local_var->epc_applied_ind = epc_applied_ind; + ee_subscription_local_var->scef_diam_host = scef_diam_host; + ee_subscription_local_var->scef_diam_realm = scef_diam_realm; + ee_subscription_local_var->notify_correlation_id = notify_correlation_id; return ee_subscription_local_var; } @@ -41,6 +51,10 @@ void OpenAPI_ee_subscription_free(OpenAPI_ee_subscription_t *ee_subscription) OpenAPI_reporting_options_free(ee_subscription->reporting_options); ogs_free(ee_subscription->supported_features); ogs_free(ee_subscription->subscription_id); + OpenAPI_context_info_free(ee_subscription->context_info); + ogs_free(ee_subscription->scef_diam_host); + ogs_free(ee_subscription->scef_diam_realm); + ogs_free(ee_subscription->notify_correlation_id); ogs_free(ee_subscription); } @@ -113,6 +127,47 @@ cJSON *OpenAPI_ee_subscription_convertToJSON(OpenAPI_ee_subscription_t *ee_subsc } } + if (ee_subscription->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(ee_subscription->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [context_info]"); + goto end; + } + } + + if (ee_subscription->epc_applied_ind) { + if (cJSON_AddBoolToObject(item, "epcAppliedInd", ee_subscription->epc_applied_ind) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [epc_applied_ind]"); + goto end; + } + } + + if (ee_subscription->scef_diam_host) { + if (cJSON_AddStringToObject(item, "scefDiamHost", ee_subscription->scef_diam_host) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [scef_diam_host]"); + goto end; + } + } + + if (ee_subscription->scef_diam_realm) { + if (cJSON_AddStringToObject(item, "scefDiamRealm", ee_subscription->scef_diam_realm) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [scef_diam_realm]"); + goto end; + } + } + + if (ee_subscription->notify_correlation_id) { + if (cJSON_AddStringToObject(item, "notifyCorrelationId", ee_subscription->notify_correlation_id) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [notify_correlation_id]"); + goto end; + } + } + end: return item; } @@ -183,12 +238,60 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_parseFromJSON(cJSON *ee_subsc } } + cJSON *context_info = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "contextInfo"); + + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + + cJSON *epc_applied_ind = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "epcAppliedInd"); + + if (epc_applied_ind) { + if (!cJSON_IsBool(epc_applied_ind)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [epc_applied_ind]"); + goto end; + } + } + + cJSON *scef_diam_host = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "scefDiamHost"); + + if (scef_diam_host) { + if (!cJSON_IsString(scef_diam_host)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [scef_diam_host]"); + goto end; + } + } + + cJSON *scef_diam_realm = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "scefDiamRealm"); + + if (scef_diam_realm) { + if (!cJSON_IsString(scef_diam_realm)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [scef_diam_realm]"); + goto end; + } + } + + cJSON *notify_correlation_id = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "notifyCorrelationId"); + + if (notify_correlation_id) { + if (!cJSON_IsString(notify_correlation_id)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [notify_correlation_id]"); + goto end; + } + } + ee_subscription_local_var = OpenAPI_ee_subscription_create ( ogs_strdup(callback_reference->valuestring), monitoring_configurationsList, reporting_options ? reporting_options_local_nonprim : NULL, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, - subscription_id ? ogs_strdup(subscription_id->valuestring) : NULL + subscription_id ? ogs_strdup(subscription_id->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL, + epc_applied_ind ? epc_applied_ind->valueint : 0, + scef_diam_host ? ogs_strdup(scef_diam_host->valuestring) : NULL, + scef_diam_realm ? ogs_strdup(scef_diam_realm->valuestring) : NULL, + notify_correlation_id ? ogs_strdup(notify_correlation_id->valuestring) : NULL ); return ee_subscription_local_var; diff --git a/lib/sbi/openapi/model/ee_subscription.h b/lib/sbi/openapi/model/ee_subscription.h index 983749f2b..8a506eb25 100644 --- a/lib/sbi/openapi/model/ee_subscription.h +++ b/lib/sbi/openapi/model/ee_subscription.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "context_info.h" #include "monitoring_configuration.h" #include "reporting_options.h" @@ -26,6 +27,11 @@ typedef struct OpenAPI_ee_subscription_s { struct OpenAPI_reporting_options_s *reporting_options; char *supported_features; char *subscription_id; + struct OpenAPI_context_info_s *context_info; + int epc_applied_ind; + char *scef_diam_host; + char *scef_diam_realm; + char *notify_correlation_id; } OpenAPI_ee_subscription_t; OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( @@ -33,7 +39,12 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( OpenAPI_list_t* monitoring_configurations, OpenAPI_reporting_options_t *reporting_options, char *supported_features, - char *subscription_id + char *subscription_id, + OpenAPI_context_info_t *context_info, + int epc_applied_ind, + char *scef_diam_host, + char *scef_diam_realm, + char *notify_correlation_id ); void OpenAPI_ee_subscription_free(OpenAPI_ee_subscription_t *ee_subscription); OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_parseFromJSON(cJSON *ee_subscriptionJSON); diff --git a/lib/sbi/openapi/model/emergency_info.c b/lib/sbi/openapi/model/emergency_info.c index 13aaf2386..c52332103 100644 --- a/lib/sbi/openapi/model/emergency_info.c +++ b/lib/sbi/openapi/model/emergency_info.c @@ -7,7 +7,8 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( char *pgw_fqdn, OpenAPI_ip_address_t *pgw_ip_address, - char *smf_instance_id + char *smf_instance_id, + int epdg_ind ) { OpenAPI_emergency_info_t *emergency_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_emergency_info_t)); @@ -17,6 +18,7 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( emergency_info_local_var->pgw_fqdn = pgw_fqdn; emergency_info_local_var->pgw_ip_address = pgw_ip_address; emergency_info_local_var->smf_instance_id = smf_instance_id; + emergency_info_local_var->epdg_ind = epdg_ind; return emergency_info_local_var; } @@ -70,6 +72,13 @@ cJSON *OpenAPI_emergency_info_convertToJSON(OpenAPI_emergency_info_t *emergency_ } } + if (emergency_info->epdg_ind) { + if (cJSON_AddBoolToObject(item, "epdgInd", emergency_info->epdg_ind) == NULL) { + ogs_error("OpenAPI_emergency_info_convertToJSON() failed [epdg_ind]"); + goto end; + } + } + end: return item; } @@ -102,10 +111,20 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_parseFromJSON(cJSON *emergency_ } } + cJSON *epdg_ind = cJSON_GetObjectItemCaseSensitive(emergency_infoJSON, "epdgInd"); + + if (epdg_ind) { + if (!cJSON_IsBool(epdg_ind)) { + ogs_error("OpenAPI_emergency_info_parseFromJSON() failed [epdg_ind]"); + goto end; + } + } + emergency_info_local_var = OpenAPI_emergency_info_create ( pgw_fqdn ? ogs_strdup(pgw_fqdn->valuestring) : NULL, pgw_ip_address ? pgw_ip_address_local_nonprim : NULL, - smf_instance_id ? ogs_strdup(smf_instance_id->valuestring) : NULL + smf_instance_id ? ogs_strdup(smf_instance_id->valuestring) : NULL, + epdg_ind ? epdg_ind->valueint : 0 ); return emergency_info_local_var; diff --git a/lib/sbi/openapi/model/emergency_info.h b/lib/sbi/openapi/model/emergency_info.h index 1e34986d9..ec9f29f99 100644 --- a/lib/sbi/openapi/model/emergency_info.h +++ b/lib/sbi/openapi/model/emergency_info.h @@ -23,12 +23,14 @@ typedef struct OpenAPI_emergency_info_s { char *pgw_fqdn; struct OpenAPI_ip_address_s *pgw_ip_address; char *smf_instance_id; + int epdg_ind; } OpenAPI_emergency_info_t; OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( char *pgw_fqdn, OpenAPI_ip_address_t *pgw_ip_address, - char *smf_instance_id + char *smf_instance_id, + int epdg_ind ); void OpenAPI_emergency_info_free(OpenAPI_emergency_info_t *emergency_info); OpenAPI_emergency_info_t *OpenAPI_emergency_info_parseFromJSON(cJSON *emergency_infoJSON); diff --git a/lib/sbi/openapi/model/eps_interworking_info.c b/lib/sbi/openapi/model/eps_interworking_info.c index 117231e6a..4a2aee6f9 100644 --- a/lib/sbi/openapi/model/eps_interworking_info.c +++ b/lib/sbi/openapi/model/eps_interworking_info.c @@ -25,7 +25,7 @@ void OpenAPI_eps_interworking_info_free(OpenAPI_eps_interworking_info_t *eps_int OpenAPI_lnode_t *node; OpenAPI_list_for_each(eps_interworking_info->eps_iwk_pgws, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; - OpenAPI_object_free(localKeyValue->value); + OpenAPI_eps_iwk_pgw_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(eps_interworking_info->eps_iwk_pgws); @@ -53,7 +53,7 @@ cJSON *OpenAPI_eps_interworking_info_convertToJSON(OpenAPI_eps_interworking_info if (eps_interworking_info->eps_iwk_pgws) { OpenAPI_list_for_each(eps_interworking_info->eps_iwk_pgws, eps_iwk_pgws_node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)eps_iwk_pgws_node->data; - cJSON *itemLocal = OpenAPI_object_convertToJSON(localKeyValue->value); + cJSON *itemLocal = OpenAPI_eps_iwk_pgw_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { ogs_error("OpenAPI_eps_interworking_info_convertToJSON() failed [eps_iwk_pgws]"); goto end; @@ -88,7 +88,7 @@ OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_parseFromJSON(cJS goto end; } localMapKeyPair = OpenAPI_map_create( - localMapObject->string, OpenAPI_object_parseFromJSON(localMapObject)); + localMapObject->string, OpenAPI_eps_iwk_pgw_parseFromJSON(localMapObject)); OpenAPI_list_add(eps_iwk_pgwsList, localMapKeyPair); } } diff --git a/lib/sbi/openapi/model/eps_interworking_info.h b/lib/sbi/openapi/model/eps_interworking_info.h index 93b167d14..7268cb6c6 100644 --- a/lib/sbi/openapi/model/eps_interworking_info.h +++ b/lib/sbi/openapi/model/eps_interworking_info.h @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "object.h" +#include "eps_iwk_pgw.h" #ifdef __cplusplus extern "C" { diff --git a/lib/sbi/openapi/model/event_for_mdt.c b/lib/sbi/openapi/model/event_for_mdt.c new file mode 100644 index 000000000..7484f8643 --- /dev/null +++ b/lib/sbi/openapi/model/event_for_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "event_for_mdt.h" + +char* OpenAPI_event_for_mdt_ToString(OpenAPI_event_for_mdt_e event_for_mdt) +{ + const char *event_for_mdtArray[] = { "NULL", "OUT_OF_COVERAG", "A2_EVENT" }; + size_t sizeofArray = sizeof(event_for_mdtArray) / sizeof(event_for_mdtArray[0]); + if (event_for_mdt < sizeofArray) + return (char *)event_for_mdtArray[event_for_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_event_for_mdt_e OpenAPI_event_for_mdt_FromString(char* event_for_mdt) +{ + int stringToReturn = 0; + const char *event_for_mdtArray[] = { "NULL", "OUT_OF_COVERAG", "A2_EVENT" }; + size_t sizeofArray = sizeof(event_for_mdtArray) / sizeof(event_for_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(event_for_mdt, event_for_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/event_for_mdt.h b/lib/sbi/openapi/model/event_for_mdt.h new file mode 100644 index 000000000..d27d20814 --- /dev/null +++ b/lib/sbi/openapi/model/event_for_mdt.h @@ -0,0 +1,31 @@ +/* + * event_for_mdt.h + * + * + */ + +#ifndef _OpenAPI_event_for_mdt_H_ +#define _OpenAPI_event_for_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_event_for_mdt_NULL = 0, OpenAPI_event_for_mdt_OUT_OF_COVERAG, OpenAPI_event_for_mdt_A2_EVENT } OpenAPI_event_for_mdt_e; + +char* OpenAPI_event_for_mdt_ToString(OpenAPI_event_for_mdt_e event_for_mdt); + +OpenAPI_event_for_mdt_e OpenAPI_event_for_mdt_FromString(char* event_for_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_event_for_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/expected_ue_behaviour.c b/lib/sbi/openapi/model/expected_ue_behaviour.c index b385fe925..3b5848a39 100644 --- a/lib/sbi/openapi/model/expected_ue_behaviour.c +++ b/lib/sbi/openapi/model/expected_ue_behaviour.c @@ -15,7 +15,8 @@ OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_create( OpenAPI_list_t *expected_umts, OpenAPI_traffic_profile_rm_t *traffic_profile, OpenAPI_battery_indication_rm_t *battery_indication, - char *validity_time + char *validity_time, + char *mtc_provider_information ) { OpenAPI_expected_ue_behaviour_t *expected_ue_behaviour_local_var = OpenAPI_malloc(sizeof(OpenAPI_expected_ue_behaviour_t)); @@ -33,6 +34,7 @@ OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_create( expected_ue_behaviour_local_var->traffic_profile = traffic_profile; expected_ue_behaviour_local_var->battery_indication = battery_indication; expected_ue_behaviour_local_var->validity_time = validity_time; + expected_ue_behaviour_local_var->mtc_provider_information = mtc_provider_information; return expected_ue_behaviour_local_var; } @@ -54,6 +56,7 @@ void OpenAPI_expected_ue_behaviour_free(OpenAPI_expected_ue_behaviour_t *expecte OpenAPI_traffic_profile_rm_free(expected_ue_behaviour->traffic_profile); OpenAPI_battery_indication_rm_free(expected_ue_behaviour->battery_indication); ogs_free(expected_ue_behaviour->validity_time); + ogs_free(expected_ue_behaviour->mtc_provider_information); ogs_free(expected_ue_behaviour); } @@ -191,6 +194,13 @@ cJSON *OpenAPI_expected_ue_behaviour_convertToJSON(OpenAPI_expected_ue_behaviour } } + if (expected_ue_behaviour->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", expected_ue_behaviour->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_expected_ue_behaviour_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -307,6 +317,15 @@ OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_parseFromJSON(cJS } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviourJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_expected_ue_behaviour_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + expected_ue_behaviour_local_var = OpenAPI_expected_ue_behaviour_create ( ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, @@ -318,7 +337,8 @@ OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_parseFromJSON(cJS expected_umts ? expected_umtsList : NULL, traffic_profile ? traffic_profile_local_nonprim : NULL, battery_indication ? battery_indication_local_nonprim : NULL, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return expected_ue_behaviour_local_var; diff --git a/lib/sbi/openapi/model/expected_ue_behaviour.h b/lib/sbi/openapi/model/expected_ue_behaviour.h index e82149812..f65630670 100644 --- a/lib/sbi/openapi/model/expected_ue_behaviour.h +++ b/lib/sbi/openapi/model/expected_ue_behaviour.h @@ -36,6 +36,7 @@ typedef struct OpenAPI_expected_ue_behaviour_s { struct OpenAPI_traffic_profile_rm_s *traffic_profile; struct OpenAPI_battery_indication_rm_s *battery_indication; char *validity_time; + char *mtc_provider_information; } OpenAPI_expected_ue_behaviour_t; OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_create( @@ -49,7 +50,8 @@ OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_create( OpenAPI_list_t *expected_umts, OpenAPI_traffic_profile_rm_t *traffic_profile, OpenAPI_battery_indication_rm_t *battery_indication, - char *validity_time + char *validity_time, + char *mtc_provider_information ); void OpenAPI_expected_ue_behaviour_free(OpenAPI_expected_ue_behaviour_t *expected_ue_behaviour); OpenAPI_expected_ue_behaviour_t *OpenAPI_expected_ue_behaviour_parseFromJSON(cJSON *expected_ue_behaviourJSON); diff --git a/lib/sbi/openapi/model/ext_problem_details.c b/lib/sbi/openapi/model/ext_problem_details.c new file mode 100644 index 000000000..6d581c712 --- /dev/null +++ b/lib/sbi/openapi/model/ext_problem_details.c @@ -0,0 +1,313 @@ + +#include +#include +#include +#include "ext_problem_details.h" + +OpenAPI_ext_problem_details_t *OpenAPI_ext_problem_details_create( + char *type, + char *title, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features, + char *target_scp, + int remote_error + ) +{ + OpenAPI_ext_problem_details_t *ext_problem_details_local_var = OpenAPI_malloc(sizeof(OpenAPI_ext_problem_details_t)); + if (!ext_problem_details_local_var) { + return NULL; + } + ext_problem_details_local_var->type = type; + ext_problem_details_local_var->title = title; + ext_problem_details_local_var->status = status; + ext_problem_details_local_var->detail = detail; + ext_problem_details_local_var->instance = instance; + ext_problem_details_local_var->cause = cause; + ext_problem_details_local_var->invalid_params = invalid_params; + ext_problem_details_local_var->supported_features = supported_features; + ext_problem_details_local_var->target_scp = target_scp; + ext_problem_details_local_var->remote_error = remote_error; + + return ext_problem_details_local_var; +} + +void OpenAPI_ext_problem_details_free(OpenAPI_ext_problem_details_t *ext_problem_details) +{ + if (NULL == ext_problem_details) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ext_problem_details->type); + ogs_free(ext_problem_details->title); + ogs_free(ext_problem_details->detail); + ogs_free(ext_problem_details->instance); + ogs_free(ext_problem_details->cause); + OpenAPI_list_for_each(ext_problem_details->invalid_params, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(ext_problem_details->invalid_params); + ogs_free(ext_problem_details->supported_features); + ogs_free(ext_problem_details->target_scp); + ogs_free(ext_problem_details); +} + +cJSON *OpenAPI_ext_problem_details_convertToJSON(OpenAPI_ext_problem_details_t *ext_problem_details) +{ + cJSON *item = NULL; + + if (ext_problem_details == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [ExtProblemDetails]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ext_problem_details->type) { + if (cJSON_AddStringToObject(item, "type", ext_problem_details->type) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [type]"); + goto end; + } + } + + if (ext_problem_details->title) { + if (cJSON_AddStringToObject(item, "title", ext_problem_details->title) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [title]"); + goto end; + } + } + + if (ext_problem_details->status) { + if (cJSON_AddNumberToObject(item, "status", ext_problem_details->status) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [status]"); + goto end; + } + } + + if (ext_problem_details->detail) { + if (cJSON_AddStringToObject(item, "detail", ext_problem_details->detail) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [detail]"); + goto end; + } + } + + if (ext_problem_details->instance) { + if (cJSON_AddStringToObject(item, "instance", ext_problem_details->instance) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [instance]"); + goto end; + } + } + + if (ext_problem_details->cause) { + if (cJSON_AddStringToObject(item, "cause", ext_problem_details->cause) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [cause]"); + goto end; + } + } + + if (ext_problem_details->invalid_params) { + cJSON *invalid_paramsList = cJSON_AddArrayToObject(item, "invalidParams"); + if (invalid_paramsList == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [invalid_params]"); + goto end; + } + + OpenAPI_lnode_t *invalid_params_node; + if (ext_problem_details->invalid_params) { + OpenAPI_list_for_each(ext_problem_details->invalid_params, invalid_params_node) { + cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(invalid_params_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [invalid_params]"); + goto end; + } + cJSON_AddItemToArray(invalid_paramsList, itemLocal); + } + } + } + + if (ext_problem_details->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ext_problem_details->supported_features) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (ext_problem_details->target_scp) { + if (cJSON_AddStringToObject(item, "targetScp", ext_problem_details->target_scp) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [target_scp]"); + goto end; + } + } + + if (ext_problem_details->remote_error) { + if (cJSON_AddBoolToObject(item, "remoteError", ext_problem_details->remote_error) == NULL) { + ogs_error("OpenAPI_ext_problem_details_convertToJSON() failed [remote_error]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ext_problem_details_t *OpenAPI_ext_problem_details_parseFromJSON(cJSON *ext_problem_detailsJSON) +{ + OpenAPI_ext_problem_details_t *ext_problem_details_local_var = NULL; + cJSON *type = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "type"); + + if (type) { + if (!cJSON_IsString(type)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [type]"); + goto end; + } + } + + cJSON *title = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "title"); + + if (title) { + if (!cJSON_IsString(title)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [title]"); + goto end; + } + } + + cJSON *status = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "status"); + + if (status) { + if (!cJSON_IsNumber(status)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [status]"); + goto end; + } + } + + cJSON *detail = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "detail"); + + if (detail) { + if (!cJSON_IsString(detail)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [detail]"); + goto end; + } + } + + cJSON *instance = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "instance"); + + if (instance) { + if (!cJSON_IsString(instance)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [instance]"); + goto end; + } + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "cause"); + + if (cause) { + if (!cJSON_IsString(cause)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [cause]"); + goto end; + } + } + + cJSON *invalid_params = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "invalidParams"); + + OpenAPI_list_t *invalid_paramsList; + if (invalid_params) { + cJSON *invalid_params_local_nonprimitive; + if (!cJSON_IsArray(invalid_params)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [invalid_params]"); + goto end; + } + + invalid_paramsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(invalid_params_local_nonprimitive, invalid_params ) { + if (!cJSON_IsObject(invalid_params_local_nonprimitive)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [invalid_params]"); + goto end; + } + OpenAPI_invalid_param_t *invalid_paramsItem = OpenAPI_invalid_param_parseFromJSON(invalid_params_local_nonprimitive); + + OpenAPI_list_add(invalid_paramsList, invalid_paramsItem); + } + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *target_scp = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "targetScp"); + + if (target_scp) { + if (!cJSON_IsString(target_scp)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [target_scp]"); + goto end; + } + } + + cJSON *remote_error = cJSON_GetObjectItemCaseSensitive(ext_problem_detailsJSON, "remoteError"); + + if (remote_error) { + if (!cJSON_IsBool(remote_error)) { + ogs_error("OpenAPI_ext_problem_details_parseFromJSON() failed [remote_error]"); + goto end; + } + } + + ext_problem_details_local_var = OpenAPI_ext_problem_details_create ( + type ? ogs_strdup(type->valuestring) : NULL, + title ? ogs_strdup(title->valuestring) : NULL, + status ? status->valuedouble : 0, + detail ? ogs_strdup(detail->valuestring) : NULL, + instance ? ogs_strdup(instance->valuestring) : NULL, + cause ? ogs_strdup(cause->valuestring) : NULL, + invalid_params ? invalid_paramsList : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + target_scp ? ogs_strdup(target_scp->valuestring) : NULL, + remote_error ? remote_error->valueint : 0 + ); + + return ext_problem_details_local_var; +end: + return NULL; +} + +OpenAPI_ext_problem_details_t *OpenAPI_ext_problem_details_copy(OpenAPI_ext_problem_details_t *dst, OpenAPI_ext_problem_details_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ext_problem_details_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ext_problem_details_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_ext_problem_details_free(dst); + dst = OpenAPI_ext_problem_details_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ext_problem_details.h b/lib/sbi/openapi/model/ext_problem_details.h new file mode 100644 index 000000000..eb642d613 --- /dev/null +++ b/lib/sbi/openapi/model/ext_problem_details.h @@ -0,0 +1,59 @@ +/* + * ext_problem_details.h + * + * + */ + +#ifndef _OpenAPI_ext_problem_details_H_ +#define _OpenAPI_ext_problem_details_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "invalid_param.h" +#include "problem_details.h" +#include "problem_details_add_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ext_problem_details_s OpenAPI_ext_problem_details_t; +typedef struct OpenAPI_ext_problem_details_s { + char *type; + char *title; + int status; + char *detail; + char *instance; + char *cause; + OpenAPI_list_t *invalid_params; + char *supported_features; + char *target_scp; + int remote_error; +} OpenAPI_ext_problem_details_t; + +OpenAPI_ext_problem_details_t *OpenAPI_ext_problem_details_create( + char *type, + char *title, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features, + char *target_scp, + int remote_error + ); +void OpenAPI_ext_problem_details_free(OpenAPI_ext_problem_details_t *ext_problem_details); +OpenAPI_ext_problem_details_t *OpenAPI_ext_problem_details_parseFromJSON(cJSON *ext_problem_detailsJSON); +cJSON *OpenAPI_ext_problem_details_convertToJSON(OpenAPI_ext_problem_details_t *ext_problem_details); +OpenAPI_ext_problem_details_t *OpenAPI_ext_problem_details_copy(OpenAPI_ext_problem_details_t *dst, OpenAPI_ext_problem_details_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ext_problem_details_H_ */ + diff --git a/lib/sbi/openapi/model/ext_snssai.c b/lib/sbi/openapi/model/ext_snssai.c new file mode 100644 index 000000000..024bc0ac9 --- /dev/null +++ b/lib/sbi/openapi/model/ext_snssai.c @@ -0,0 +1,198 @@ + +#include +#include +#include +#include "ext_snssai.h" + +OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_create( + int sst, + char *sd, + OpenAPI_list_t *sd_ranges, + int wildcard_sd + ) +{ + OpenAPI_ext_snssai_t *ext_snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_ext_snssai_t)); + if (!ext_snssai_local_var) { + return NULL; + } + ext_snssai_local_var->sst = sst; + ext_snssai_local_var->sd = sd; + ext_snssai_local_var->sd_ranges = sd_ranges; + ext_snssai_local_var->wildcard_sd = wildcard_sd; + + return ext_snssai_local_var; +} + +void OpenAPI_ext_snssai_free(OpenAPI_ext_snssai_t *ext_snssai) +{ + if (NULL == ext_snssai) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ext_snssai->sd); + OpenAPI_list_for_each(ext_snssai->sd_ranges, node) { + OpenAPI_sd_range_free(node->data); + } + OpenAPI_list_free(ext_snssai->sd_ranges); + ogs_free(ext_snssai); +} + +cJSON *OpenAPI_ext_snssai_convertToJSON(OpenAPI_ext_snssai_t *ext_snssai) +{ + cJSON *item = NULL; + + if (ext_snssai == NULL) { + ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [ExtSnssai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ext_snssai->sst) { + ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [sst]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "sst", ext_snssai->sst) == NULL) { + ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [sst]"); + goto end; + } + + if (ext_snssai->sd) { + if (cJSON_AddStringToObject(item, "sd", ext_snssai->sd) == NULL) { + ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [sd]"); + goto end; + } + } + + if (ext_snssai->sd_ranges) { + cJSON *sd_rangesList = cJSON_AddArrayToObject(item, "sdRanges"); + if (sd_rangesList == NULL) { + ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [sd_ranges]"); + goto end; + } + + OpenAPI_lnode_t *sd_ranges_node; + if (ext_snssai->sd_ranges) { + OpenAPI_list_for_each(ext_snssai->sd_ranges, sd_ranges_node) { + cJSON *itemLocal = OpenAPI_sd_range_convertToJSON(sd_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [sd_ranges]"); + goto end; + } + cJSON_AddItemToArray(sd_rangesList, itemLocal); + } + } + } + + if (ext_snssai->wildcard_sd) { + if (cJSON_AddBoolToObject(item, "wildcardSd", ext_snssai->wildcard_sd) == NULL) { + ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [wildcard_sd]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_parseFromJSON(cJSON *ext_snssaiJSON) +{ + OpenAPI_ext_snssai_t *ext_snssai_local_var = NULL; + cJSON *sst = cJSON_GetObjectItemCaseSensitive(ext_snssaiJSON, "sst"); + if (!sst) { + ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [sst]"); + goto end; + } + + + if (!cJSON_IsNumber(sst)) { + ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [sst]"); + goto end; + } + + cJSON *sd = cJSON_GetObjectItemCaseSensitive(ext_snssaiJSON, "sd"); + + if (sd) { + if (!cJSON_IsString(sd)) { + ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [sd]"); + goto end; + } + } + + cJSON *sd_ranges = cJSON_GetObjectItemCaseSensitive(ext_snssaiJSON, "sdRanges"); + + OpenAPI_list_t *sd_rangesList; + if (sd_ranges) { + cJSON *sd_ranges_local_nonprimitive; + if (!cJSON_IsArray(sd_ranges)) { + ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [sd_ranges]"); + goto end; + } + + sd_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(sd_ranges_local_nonprimitive, sd_ranges ) { + if (!cJSON_IsObject(sd_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [sd_ranges]"); + goto end; + } + OpenAPI_sd_range_t *sd_rangesItem = OpenAPI_sd_range_parseFromJSON(sd_ranges_local_nonprimitive); + + OpenAPI_list_add(sd_rangesList, sd_rangesItem); + } + } + + cJSON *wildcard_sd = cJSON_GetObjectItemCaseSensitive(ext_snssaiJSON, "wildcardSd"); + + if (wildcard_sd) { + if (!cJSON_IsBool(wildcard_sd)) { + ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [wildcard_sd]"); + goto end; + } + } + + ext_snssai_local_var = OpenAPI_ext_snssai_create ( + sst->valuedouble, + sd ? ogs_strdup(sd->valuestring) : NULL, + sd_ranges ? sd_rangesList : NULL, + wildcard_sd ? wildcard_sd->valueint : 0 + ); + + return ext_snssai_local_var; +end: + return NULL; +} + +OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_copy(OpenAPI_ext_snssai_t *dst, OpenAPI_ext_snssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ext_snssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ext_snssai_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_ext_snssai_free(dst); + dst = OpenAPI_ext_snssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ext_snssai.h b/lib/sbi/openapi/model/ext_snssai.h new file mode 100644 index 000000000..d01a1e5b0 --- /dev/null +++ b/lib/sbi/openapi/model/ext_snssai.h @@ -0,0 +1,47 @@ +/* + * ext_snssai.h + * + * + */ + +#ifndef _OpenAPI_ext_snssai_H_ +#define _OpenAPI_ext_snssai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "sd_range.h" +#include "snssai.h" +#include "snssai_extension.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ext_snssai_s OpenAPI_ext_snssai_t; +typedef struct OpenAPI_ext_snssai_s { + int sst; + char *sd; + OpenAPI_list_t *sd_ranges; + int wildcard_sd; +} OpenAPI_ext_snssai_t; + +OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_create( + int sst, + char *sd, + OpenAPI_list_t *sd_ranges, + int wildcard_sd + ); +void OpenAPI_ext_snssai_free(OpenAPI_ext_snssai_t *ext_snssai); +OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_parseFromJSON(cJSON *ext_snssaiJSON); +cJSON *OpenAPI_ext_snssai_convertToJSON(OpenAPI_ext_snssai_t *ext_snssai); +OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_copy(OpenAPI_ext_snssai_t *dst, OpenAPI_ext_snssai_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ext_snssai_H_ */ + diff --git a/lib/sbi/openapi/model/flow_direction_rm.c b/lib/sbi/openapi/model/flow_direction_rm.c deleted file mode 100644 index 82a931baa..000000000 --- a/lib/sbi/openapi/model/flow_direction_rm.c +++ /dev/null @@ -1,85 +0,0 @@ - -#include -#include -#include -#include "flow_direction_rm.h" - -OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create( - ) -{ - OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_direction_rm_t)); - if (!flow_direction_rm_local_var) { - return NULL; - } - - return flow_direction_rm_local_var; -} - -void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm) -{ - if (NULL == flow_direction_rm) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(flow_direction_rm); -} - -cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm) -{ - cJSON *item = NULL; - - if (flow_direction_rm == NULL) { - ogs_error("OpenAPI_flow_direction_rm_convertToJSON() failed [FlowDirectionRm]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON) -{ - OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = NULL; - flow_direction_rm_local_var = OpenAPI_flow_direction_rm_create ( - ); - - return flow_direction_rm_local_var; -end: - return NULL; -} - -OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_flow_direction_rm_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_flow_direction_rm_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_flow_direction_rm_free(dst); - dst = OpenAPI_flow_direction_rm_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/flow_direction_rm.h b/lib/sbi/openapi/model/flow_direction_rm.h deleted file mode 100644 index 7dcc933bd..000000000 --- a/lib/sbi/openapi/model/flow_direction_rm.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * flow_direction_rm.h - * - * - */ - -#ifndef _OpenAPI_flow_direction_rm_H_ -#define _OpenAPI_flow_direction_rm_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "flow_direction.h" -#include "null_value.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_flow_direction_rm_s OpenAPI_flow_direction_rm_t; -typedef struct OpenAPI_flow_direction_rm_s { -} OpenAPI_flow_direction_rm_t; - -OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create( - ); -void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm); -OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON); -cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm); -OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_flow_direction_rm_H_ */ - diff --git a/lib/sbi/openapi/model/gbr_qos_flow_information.c b/lib/sbi/openapi/model/gbr_qos_flow_information.c index 5e9552d61..be0c5f336 100644 --- a/lib/sbi/openapi/model/gbr_qos_flow_information.c +++ b/lib/sbi/openapi/model/gbr_qos_flow_information.c @@ -9,9 +9,10 @@ OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_create( char *max_fbr_ul, char *gua_fbr_dl, char *gua_fbr_ul, - OpenAPI_notification_control_t *notif_control, + OpenAPI_notification_control_e notif_control, int max_packet_loss_rate_dl, - int max_packet_loss_rate_ul + int max_packet_loss_rate_ul, + OpenAPI_list_t *alternative_qos_profile_list ) { OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_gbr_qos_flow_information_t)); @@ -25,6 +26,7 @@ OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_create( gbr_qos_flow_information_local_var->notif_control = notif_control; gbr_qos_flow_information_local_var->max_packet_loss_rate_dl = max_packet_loss_rate_dl; gbr_qos_flow_information_local_var->max_packet_loss_rate_ul = max_packet_loss_rate_ul; + gbr_qos_flow_information_local_var->alternative_qos_profile_list = alternative_qos_profile_list; return gbr_qos_flow_information_local_var; } @@ -39,7 +41,10 @@ void OpenAPI_gbr_qos_flow_information_free(OpenAPI_gbr_qos_flow_information_t *g ogs_free(gbr_qos_flow_information->max_fbr_ul); ogs_free(gbr_qos_flow_information->gua_fbr_dl); ogs_free(gbr_qos_flow_information->gua_fbr_ul); - OpenAPI_notification_control_free(gbr_qos_flow_information->notif_control); + OpenAPI_list_for_each(gbr_qos_flow_information->alternative_qos_profile_list, node) { + OpenAPI_alternative_qos_profile_free(node->data); + } + OpenAPI_list_free(gbr_qos_flow_information->alternative_qos_profile_list); ogs_free(gbr_qos_flow_information); } @@ -90,13 +95,7 @@ cJSON *OpenAPI_gbr_qos_flow_information_convertToJSON(OpenAPI_gbr_qos_flow_infor } if (gbr_qos_flow_information->notif_control) { - cJSON *notif_control_local_JSON = OpenAPI_notification_control_convertToJSON(gbr_qos_flow_information->notif_control); - if (notif_control_local_JSON == NULL) { - ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [notif_control]"); - goto end; - } - cJSON_AddItemToObject(item, "notifControl", notif_control_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "notifControl", OpenAPI_notification_control_ToString(gbr_qos_flow_information->notif_control)) == NULL) { ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [notif_control]"); goto end; } @@ -116,6 +115,26 @@ cJSON *OpenAPI_gbr_qos_flow_information_convertToJSON(OpenAPI_gbr_qos_flow_infor } } + if (gbr_qos_flow_information->alternative_qos_profile_list) { + cJSON *alternative_qos_profile_listList = cJSON_AddArrayToObject(item, "alternativeQosProfileList"); + if (alternative_qos_profile_listList == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [alternative_qos_profile_list]"); + goto end; + } + + OpenAPI_lnode_t *alternative_qos_profile_list_node; + if (gbr_qos_flow_information->alternative_qos_profile_list) { + OpenAPI_list_for_each(gbr_qos_flow_information->alternative_qos_profile_list, alternative_qos_profile_list_node) { + cJSON *itemLocal = OpenAPI_alternative_qos_profile_convertToJSON(alternative_qos_profile_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_gbr_qos_flow_information_convertToJSON() failed [alternative_qos_profile_list]"); + goto end; + } + cJSON_AddItemToArray(alternative_qos_profile_listList, itemLocal); + } + } + } + end: return item; } @@ -173,9 +192,13 @@ OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_parseFromJS cJSON *notif_control = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "notifControl"); - OpenAPI_notification_control_t *notif_control_local_nonprim = NULL; + OpenAPI_notification_control_e notif_controlVariable; if (notif_control) { - notif_control_local_nonprim = OpenAPI_notification_control_parseFromJSON(notif_control); + if (!cJSON_IsString(notif_control)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [notif_control]"); + goto end; + } + notif_controlVariable = OpenAPI_notification_control_FromString(notif_control->valuestring); } cJSON *max_packet_loss_rate_dl = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "maxPacketLossRateDl"); @@ -196,14 +219,38 @@ OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_parseFromJS } } + cJSON *alternative_qos_profile_list = cJSON_GetObjectItemCaseSensitive(gbr_qos_flow_informationJSON, "alternativeQosProfileList"); + + OpenAPI_list_t *alternative_qos_profile_listList; + if (alternative_qos_profile_list) { + cJSON *alternative_qos_profile_list_local_nonprimitive; + if (!cJSON_IsArray(alternative_qos_profile_list)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [alternative_qos_profile_list]"); + goto end; + } + + alternative_qos_profile_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(alternative_qos_profile_list_local_nonprimitive, alternative_qos_profile_list ) { + if (!cJSON_IsObject(alternative_qos_profile_list_local_nonprimitive)) { + ogs_error("OpenAPI_gbr_qos_flow_information_parseFromJSON() failed [alternative_qos_profile_list]"); + goto end; + } + OpenAPI_alternative_qos_profile_t *alternative_qos_profile_listItem = OpenAPI_alternative_qos_profile_parseFromJSON(alternative_qos_profile_list_local_nonprimitive); + + OpenAPI_list_add(alternative_qos_profile_listList, alternative_qos_profile_listItem); + } + } + gbr_qos_flow_information_local_var = OpenAPI_gbr_qos_flow_information_create ( ogs_strdup(max_fbr_dl->valuestring), ogs_strdup(max_fbr_ul->valuestring), ogs_strdup(gua_fbr_dl->valuestring), ogs_strdup(gua_fbr_ul->valuestring), - notif_control ? notif_control_local_nonprim : NULL, + notif_control ? notif_controlVariable : 0, max_packet_loss_rate_dl ? max_packet_loss_rate_dl->valuedouble : 0, - max_packet_loss_rate_ul ? max_packet_loss_rate_ul->valuedouble : 0 + max_packet_loss_rate_ul ? max_packet_loss_rate_ul->valuedouble : 0, + alternative_qos_profile_list ? alternative_qos_profile_listList : NULL ); return gbr_qos_flow_information_local_var; diff --git a/lib/sbi/openapi/model/gbr_qos_flow_information.h b/lib/sbi/openapi/model/gbr_qos_flow_information.h index 89d2751f3..1bba66dd1 100644 --- a/lib/sbi/openapi/model/gbr_qos_flow_information.h +++ b/lib/sbi/openapi/model/gbr_qos_flow_information.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "alternative_qos_profile.h" #include "notification_control.h" #ifdef __cplusplus @@ -24,9 +25,10 @@ typedef struct OpenAPI_gbr_qos_flow_information_s { char *max_fbr_ul; char *gua_fbr_dl; char *gua_fbr_ul; - struct OpenAPI_notification_control_s *notif_control; + OpenAPI_notification_control_e notif_control; int max_packet_loss_rate_dl; int max_packet_loss_rate_ul; + OpenAPI_list_t *alternative_qos_profile_list; } OpenAPI_gbr_qos_flow_information_t; OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_create( @@ -34,9 +36,10 @@ OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_create( char *max_fbr_ul, char *gua_fbr_dl, char *gua_fbr_ul, - OpenAPI_notification_control_t *notif_control, + OpenAPI_notification_control_e notif_control, int max_packet_loss_rate_dl, - int max_packet_loss_rate_ul + int max_packet_loss_rate_ul, + OpenAPI_list_t *alternative_qos_profile_list ); void OpenAPI_gbr_qos_flow_information_free(OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_information); OpenAPI_gbr_qos_flow_information_t *OpenAPI_gbr_qos_flow_information_parseFromJSON(cJSON *gbr_qos_flow_informationJSON); diff --git a/lib/sbi/openapi/model/global_ran_node_id.c b/lib/sbi/openapi/model/global_ran_node_id.c index f13ed2218..8ee765577 100644 --- a/lib/sbi/openapi/model/global_ran_node_id.c +++ b/lib/sbi/openapi/model/global_ran_node_id.c @@ -9,6 +9,8 @@ OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_create( char *n3_iwf_id, OpenAPI_g_nb_id_t *g_nb_id, char *nge_nb_id, + char *wagf_id, + char *tngf_id, char *nid, char *e_nb_id ) @@ -21,6 +23,8 @@ OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_create( global_ran_node_id_local_var->n3_iwf_id = n3_iwf_id; global_ran_node_id_local_var->g_nb_id = g_nb_id; global_ran_node_id_local_var->nge_nb_id = nge_nb_id; + global_ran_node_id_local_var->wagf_id = wagf_id; + global_ran_node_id_local_var->tngf_id = tngf_id; global_ran_node_id_local_var->nid = nid; global_ran_node_id_local_var->e_nb_id = e_nb_id; @@ -37,6 +41,8 @@ void OpenAPI_global_ran_node_id_free(OpenAPI_global_ran_node_id_t *global_ran_no ogs_free(global_ran_node_id->n3_iwf_id); OpenAPI_g_nb_id_free(global_ran_node_id->g_nb_id); ogs_free(global_ran_node_id->nge_nb_id); + ogs_free(global_ran_node_id->wagf_id); + ogs_free(global_ran_node_id->tngf_id); ogs_free(global_ran_node_id->nid); ogs_free(global_ran_node_id->e_nb_id); ogs_free(global_ran_node_id); @@ -94,6 +100,20 @@ cJSON *OpenAPI_global_ran_node_id_convertToJSON(OpenAPI_global_ran_node_id_t *gl } } + if (global_ran_node_id->wagf_id) { + if (cJSON_AddStringToObject(item, "wagfId", global_ran_node_id->wagf_id) == NULL) { + ogs_error("OpenAPI_global_ran_node_id_convertToJSON() failed [wagf_id]"); + goto end; + } + } + + if (global_ran_node_id->tngf_id) { + if (cJSON_AddStringToObject(item, "tngfId", global_ran_node_id->tngf_id) == NULL) { + ogs_error("OpenAPI_global_ran_node_id_convertToJSON() failed [tngf_id]"); + goto end; + } + } + if (global_ran_node_id->nid) { if (cJSON_AddStringToObject(item, "nid", global_ran_node_id->nid) == NULL) { ogs_error("OpenAPI_global_ran_node_id_convertToJSON() failed [nid]"); @@ -150,6 +170,24 @@ OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_parseFromJSON(cJSON *gl } } + cJSON *wagf_id = cJSON_GetObjectItemCaseSensitive(global_ran_node_idJSON, "wagfId"); + + if (wagf_id) { + if (!cJSON_IsString(wagf_id)) { + ogs_error("OpenAPI_global_ran_node_id_parseFromJSON() failed [wagf_id]"); + goto end; + } + } + + cJSON *tngf_id = cJSON_GetObjectItemCaseSensitive(global_ran_node_idJSON, "tngfId"); + + if (tngf_id) { + if (!cJSON_IsString(tngf_id)) { + ogs_error("OpenAPI_global_ran_node_id_parseFromJSON() failed [tngf_id]"); + goto end; + } + } + cJSON *nid = cJSON_GetObjectItemCaseSensitive(global_ran_node_idJSON, "nid"); if (nid) { @@ -173,6 +211,8 @@ OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_parseFromJSON(cJSON *gl n3_iwf_id ? ogs_strdup(n3_iwf_id->valuestring) : NULL, g_nb_id ? g_nb_id_local_nonprim : NULL, nge_nb_id ? ogs_strdup(nge_nb_id->valuestring) : NULL, + wagf_id ? ogs_strdup(wagf_id->valuestring) : NULL, + tngf_id ? ogs_strdup(tngf_id->valuestring) : NULL, nid ? ogs_strdup(nid->valuestring) : NULL, e_nb_id ? ogs_strdup(e_nb_id->valuestring) : NULL ); diff --git a/lib/sbi/openapi/model/global_ran_node_id.h b/lib/sbi/openapi/model/global_ran_node_id.h index 102532978..d98e54426 100644 --- a/lib/sbi/openapi/model/global_ran_node_id.h +++ b/lib/sbi/openapi/model/global_ran_node_id.h @@ -25,6 +25,8 @@ typedef struct OpenAPI_global_ran_node_id_s { char *n3_iwf_id; struct OpenAPI_g_nb_id_s *g_nb_id; char *nge_nb_id; + char *wagf_id; + char *tngf_id; char *nid; char *e_nb_id; } OpenAPI_global_ran_node_id_t; @@ -34,6 +36,8 @@ OpenAPI_global_ran_node_id_t *OpenAPI_global_ran_node_id_create( char *n3_iwf_id, OpenAPI_g_nb_id_t *g_nb_id, char *nge_nb_id, + char *wagf_id, + char *tngf_id, char *nid, char *e_nb_id ); diff --git a/lib/sbi/openapi/model/gmlc_info.h b/lib/sbi/openapi/model/gmlc_info.h index 82047e0f6..eda507e14 100644 --- a/lib/sbi/openapi/model/gmlc_info.h +++ b/lib/sbi/openapi/model/gmlc_info.h @@ -1,7 +1,7 @@ /* * gmlc_info.h * - * + * Information of a GMLC NF Instance */ #ifndef _OpenAPI_gmlc_info_H_ diff --git a/lib/sbi/openapi/model/guami.c b/lib/sbi/openapi/model/guami.c index 04ef03c5b..07d633c24 100644 --- a/lib/sbi/openapi/model/guami.c +++ b/lib/sbi/openapi/model/guami.c @@ -5,7 +5,7 @@ #include "guami.h" OpenAPI_guami_t *OpenAPI_guami_create( - OpenAPI_plmn_id_t *plmn_id, + OpenAPI_plmn_id_nid_t *plmn_id, char *amf_id ) { @@ -25,7 +25,7 @@ void OpenAPI_guami_free(OpenAPI_guami_t *guami) return; } OpenAPI_lnode_t *node; - OpenAPI_plmn_id_free(guami->plmn_id); + OpenAPI_plmn_id_nid_free(guami->plmn_id); ogs_free(guami->amf_id); ogs_free(guami); } @@ -44,7 +44,7 @@ cJSON *OpenAPI_guami_convertToJSON(OpenAPI_guami_t *guami) ogs_error("OpenAPI_guami_convertToJSON() failed [plmn_id]"); goto end; } - cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(guami->plmn_id); + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(guami->plmn_id); if (plmn_id_local_JSON == NULL) { ogs_error("OpenAPI_guami_convertToJSON() failed [plmn_id]"); goto end; @@ -77,9 +77,9 @@ OpenAPI_guami_t *OpenAPI_guami_parseFromJSON(cJSON *guamiJSON) goto end; } - OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + OpenAPI_plmn_id_nid_t *plmn_id_local_nonprim = NULL; - plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + plmn_id_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(plmn_id); cJSON *amf_id = cJSON_GetObjectItemCaseSensitive(guamiJSON, "amfId"); if (!amf_id) { diff --git a/lib/sbi/openapi/model/guami.h b/lib/sbi/openapi/model/guami.h index eda0483e4..8aa0fed3d 100644 --- a/lib/sbi/openapi/model/guami.h +++ b/lib/sbi/openapi/model/guami.h @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "plmn_id.h" +#include "plmn_id_nid.h" #ifdef __cplusplus extern "C" { @@ -20,12 +20,12 @@ extern "C" { typedef struct OpenAPI_guami_s OpenAPI_guami_t; typedef struct OpenAPI_guami_s { - struct OpenAPI_plmn_id_s *plmn_id; + struct OpenAPI_plmn_id_nid_s *plmn_id; char *amf_id; } OpenAPI_guami_t; OpenAPI_guami_t *OpenAPI_guami_create( - OpenAPI_plmn_id_t *plmn_id, + OpenAPI_plmn_id_nid_t *plmn_id, char *amf_id ); void OpenAPI_guami_free(OpenAPI_guami_t *guami); diff --git a/lib/sbi/openapi/model/hsmf_update_data.c b/lib/sbi/openapi/model/hsmf_update_data.c index e3bc8c421..bbef173a0 100644 --- a/lib/sbi/openapi/model/hsmf_update_data.c +++ b/lib/sbi/openapi/model/hsmf_update_data.c @@ -55,9 +55,10 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( OpenAPI_list_t *dnai_list, char *supported_features, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, - OpenAPI_vplmn_qos_t *vplmn_qos + OpenAPI_vplmn_qos_t *vplmn_qos, + OpenAPI_security_result_t *security_result, + OpenAPI_up_security_info_t *up_security_info ) { OpenAPI_hsmf_update_data_t *hsmf_update_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_hsmf_update_data_t)); @@ -114,9 +115,10 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( hsmf_update_data_local_var->dnai_list = dnai_list; hsmf_update_data_local_var->supported_features = supported_features; hsmf_update_data_local_var->roaming_charging_profile = roaming_charging_profile; - hsmf_update_data_local_var->mo_exp_data_ind = mo_exp_data_ind; hsmf_update_data_local_var->mo_exp_data_counter = mo_exp_data_counter; hsmf_update_data_local_var->vplmn_qos = vplmn_qos; + hsmf_update_data_local_var->security_result = security_result; + hsmf_update_data_local_var->up_security_info = up_security_info; return hsmf_update_data_local_var; } @@ -186,9 +188,10 @@ void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data) OpenAPI_list_free(hsmf_update_data->dnai_list); ogs_free(hsmf_update_data->supported_features); OpenAPI_roaming_charging_profile_free(hsmf_update_data->roaming_charging_profile); - OpenAPI_mo_exception_data_flag_free(hsmf_update_data->mo_exp_data_ind); OpenAPI_mo_exp_data_counter_free(hsmf_update_data->mo_exp_data_counter); OpenAPI_vplmn_qos_free(hsmf_update_data->vplmn_qos); + OpenAPI_security_result_free(hsmf_update_data->security_result); + OpenAPI_up_security_info_free(hsmf_update_data->up_security_info); ogs_free(hsmf_update_data); } @@ -743,19 +746,6 @@ cJSON *OpenAPI_hsmf_update_data_convertToJSON(OpenAPI_hsmf_update_data_t *hsmf_u } } - if (hsmf_update_data->mo_exp_data_ind) { - cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(hsmf_update_data->mo_exp_data_ind); - if (mo_exp_data_ind_local_JSON == NULL) { - ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - } - if (hsmf_update_data->mo_exp_data_counter) { cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(hsmf_update_data->mo_exp_data_counter); if (mo_exp_data_counter_local_JSON == NULL) { @@ -782,6 +772,32 @@ cJSON *OpenAPI_hsmf_update_data_convertToJSON(OpenAPI_hsmf_update_data_t *hsmf_u } } + if (hsmf_update_data->security_result) { + cJSON *security_result_local_JSON = OpenAPI_security_result_convertToJSON(hsmf_update_data->security_result); + if (security_result_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [security_result]"); + goto end; + } + cJSON_AddItemToObject(item, "securityResult", security_result_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [security_result]"); + goto end; + } + } + + if (hsmf_update_data->up_security_info) { + cJSON *up_security_info_local_JSON = OpenAPI_up_security_info_convertToJSON(hsmf_update_data->up_security_info); + if (up_security_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [up_security_info]"); + goto end; + } + cJSON_AddItemToObject(item, "upSecurityInfo", up_security_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [up_security_info]"); + goto end; + } + } + end: return item; } @@ -1349,13 +1365,6 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); } - cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "moExpDataInd"); - - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; - if (mo_exp_data_ind) { - mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); - } - cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "moExpDataCounter"); OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; @@ -1370,6 +1379,20 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u vplmn_qos_local_nonprim = OpenAPI_vplmn_qos_parseFromJSON(vplmn_qos); } + cJSON *security_result = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "securityResult"); + + OpenAPI_security_result_t *security_result_local_nonprim = NULL; + if (security_result) { + security_result_local_nonprim = OpenAPI_security_result_parseFromJSON(security_result); + } + + cJSON *up_security_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "upSecurityInfo"); + + OpenAPI_up_security_info_t *up_security_info_local_nonprim = NULL; + if (up_security_info) { + up_security_info_local_nonprim = OpenAPI_up_security_info_parseFromJSON(up_security_info); + } + hsmf_update_data_local_var = OpenAPI_hsmf_update_data_create ( request_indicationVariable, pei ? ogs_strdup(pei->valuestring) : NULL, @@ -1421,9 +1444,10 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u dnai_list ? dnai_listList : NULL, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, - mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, - vplmn_qos ? vplmn_qos_local_nonprim : NULL + vplmn_qos ? vplmn_qos_local_nonprim : NULL, + security_result ? security_result_local_nonprim : NULL, + up_security_info ? up_security_info_local_nonprim : NULL ); return hsmf_update_data_local_var; diff --git a/lib/sbi/openapi/model/hsmf_update_data.h b/lib/sbi/openapi/model/hsmf_update_data.h index 7feaf2da8..a165f4330 100644 --- a/lib/sbi/openapi/model/hsmf_update_data.h +++ b/lib/sbi/openapi/model/hsmf_update_data.h @@ -16,7 +16,6 @@ #include "cause.h" #include "eps_interworking_indication.h" #include "ma_release_indication.h" -#include "mo_exception_data_flag.h" #include "mo_exp_data_counter.h" #include "n4_information.h" #include "ng_ap_cause.h" @@ -32,9 +31,11 @@ #include "roaming_charging_profile.h" #include "secondary_rat_usage_info.h" #include "secondary_rat_usage_report.h" +#include "security_result.h" #include "tunnel_info.h" #include "ulcl_bp_information.h" #include "unavailable_access_indication.h" +#include "up_security_info.h" #include "user_location.h" #include "vplmn_qos.h" @@ -94,9 +95,10 @@ typedef struct OpenAPI_hsmf_update_data_s { OpenAPI_list_t *dnai_list; char *supported_features; struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; - struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; struct OpenAPI_vplmn_qos_s *vplmn_qos; + struct OpenAPI_security_result_s *security_result; + struct OpenAPI_up_security_info_s *up_security_info; } OpenAPI_hsmf_update_data_t; OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( @@ -150,9 +152,10 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( OpenAPI_list_t *dnai_list, char *supported_features, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, - OpenAPI_vplmn_qos_t *vplmn_qos + OpenAPI_vplmn_qos_t *vplmn_qos, + OpenAPI_security_result_t *security_result, + OpenAPI_up_security_info_t *up_security_info ); void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data); OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_update_dataJSON); diff --git a/lib/sbi/openapi/model/hsmf_updated_data.c b/lib/sbi/openapi/model/hsmf_updated_data.c index 858ecc624..223a7091b 100644 --- a/lib/sbi/openapi/model/hsmf_updated_data.c +++ b/lib/sbi/openapi/model/hsmf_updated_data.c @@ -12,6 +12,9 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( OpenAPI_list_t *dnai_list, char *supported_features, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + OpenAPI_up_security_t *up_security, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, int ipv6_multi_homing_ind ) { @@ -26,6 +29,9 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( hsmf_updated_data_local_var->dnai_list = dnai_list; hsmf_updated_data_local_var->supported_features = supported_features; hsmf_updated_data_local_var->roaming_charging_profile = roaming_charging_profile; + hsmf_updated_data_local_var->up_security = up_security; + hsmf_updated_data_local_var->max_integrity_protected_data_rate_ul = max_integrity_protected_data_rate_ul; + hsmf_updated_data_local_var->max_integrity_protected_data_rate_dl = max_integrity_protected_data_rate_dl; hsmf_updated_data_local_var->ipv6_multi_homing_ind = ipv6_multi_homing_ind; return hsmf_updated_data_local_var; @@ -47,6 +53,7 @@ void OpenAPI_hsmf_updated_data_free(OpenAPI_hsmf_updated_data_t *hsmf_updated_da OpenAPI_list_free(hsmf_updated_data->dnai_list); ogs_free(hsmf_updated_data->supported_features); OpenAPI_roaming_charging_profile_free(hsmf_updated_data->roaming_charging_profile); + OpenAPI_up_security_free(hsmf_updated_data->up_security); ogs_free(hsmf_updated_data); } @@ -148,6 +155,33 @@ cJSON *OpenAPI_hsmf_updated_data_convertToJSON(OpenAPI_hsmf_updated_data_t *hsmf } } + if (hsmf_updated_data->up_security) { + cJSON *up_security_local_JSON = OpenAPI_up_security_convertToJSON(hsmf_updated_data->up_security); + if (up_security_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [up_security]"); + goto end; + } + cJSON_AddItemToObject(item, "upSecurity", up_security_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [up_security]"); + goto end; + } + } + + if (hsmf_updated_data->max_integrity_protected_data_rate_ul) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateUl", OpenAPI_max_integrity_protected_data_rate_ToString(hsmf_updated_data->max_integrity_protected_data_rate_ul)) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + } + + if (hsmf_updated_data->max_integrity_protected_data_rate_dl) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateDl", OpenAPI_max_integrity_protected_data_rate_ToString(hsmf_updated_data->max_integrity_protected_data_rate_dl)) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + } + if (hsmf_updated_data->ipv6_multi_homing_ind) { if (cJSON_AddBoolToObject(item, "ipv6MultiHomingInd", hsmf_updated_data->ipv6_multi_homing_ind) == NULL) { ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [ipv6_multi_homing_ind]"); @@ -226,6 +260,35 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); } + cJSON *up_security = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "upSecurity"); + + OpenAPI_up_security_t *up_security_local_nonprim = NULL; + if (up_security) { + up_security_local_nonprim = OpenAPI_up_security_parseFromJSON(up_security); + } + + cJSON *max_integrity_protected_data_rate_ul = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "maxIntegrityProtectedDataRateUl"); + + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ulVariable; + if (max_integrity_protected_data_rate_ul) { + if (!cJSON_IsString(max_integrity_protected_data_rate_ul)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + max_integrity_protected_data_rate_ulVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_ul->valuestring); + } + + cJSON *max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "maxIntegrityProtectedDataRateDl"); + + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable; + if (max_integrity_protected_data_rate_dl) { + if (!cJSON_IsString(max_integrity_protected_data_rate_dl)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + max_integrity_protected_data_rate_dlVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_dl->valuestring); + } + cJSON *ipv6_multi_homing_ind = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "ipv6MultiHomingInd"); if (ipv6_multi_homing_ind) { @@ -243,6 +306,9 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf dnai_list ? dnai_listList : NULL, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, + up_security ? up_security_local_nonprim : NULL, + max_integrity_protected_data_rate_ul ? max_integrity_protected_data_rate_ulVariable : 0, + max_integrity_protected_data_rate_dl ? max_integrity_protected_data_rate_dlVariable : 0, ipv6_multi_homing_ind ? ipv6_multi_homing_ind->valueint : 0 ); diff --git a/lib/sbi/openapi/model/hsmf_updated_data.h b/lib/sbi/openapi/model/hsmf_updated_data.h index b98208ede..52c9cf631 100644 --- a/lib/sbi/openapi/model/hsmf_updated_data.h +++ b/lib/sbi/openapi/model/hsmf_updated_data.h @@ -12,9 +12,11 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "max_integrity_protected_data_rate.h" #include "n4_information.h" #include "ref_to_binary_data.h" #include "roaming_charging_profile.h" +#include "up_security.h" #ifdef __cplusplus extern "C" { @@ -29,6 +31,9 @@ typedef struct OpenAPI_hsmf_updated_data_s { OpenAPI_list_t *dnai_list; char *supported_features; struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; + struct OpenAPI_up_security_s *up_security; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl; int ipv6_multi_homing_ind; } OpenAPI_hsmf_updated_data_t; @@ -40,6 +45,9 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( OpenAPI_list_t *dnai_list, char *supported_features, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + OpenAPI_up_security_t *up_security, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, int ipv6_multi_homing_ind ); void OpenAPI_hsmf_updated_data_free(OpenAPI_hsmf_updated_data_t *hsmf_updated_data); diff --git a/lib/sbi/openapi/model/hss_auth_type.c b/lib/sbi/openapi/model/hss_auth_type.c index 0d3fb8bbc..ff1cd5734 100644 --- a/lib/sbi/openapi/model/hss_auth_type.c +++ b/lib/sbi/openapi/model/hss_auth_type.c @@ -4,82 +4,27 @@ #include #include "hss_auth_type.h" -OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_create( - ) +char* OpenAPI_hss_auth_type_ToString(OpenAPI_hss_auth_type_e hss_auth_type) { - OpenAPI_hss_auth_type_t *hss_auth_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_hss_auth_type_t)); - if (!hss_auth_type_local_var) { - return NULL; - } - - return hss_auth_type_local_var; + const char *hss_auth_typeArray[] = { "NULL", "EPS_AKA", "EAP_AKA", "EAP_AKA_PRIME", "IMS_AKA", "GBA_AKA", "UMTS_AKA" }; + size_t sizeofArray = sizeof(hss_auth_typeArray) / sizeof(hss_auth_typeArray[0]); + if (hss_auth_type < sizeofArray) + return (char *)hss_auth_typeArray[hss_auth_type]; + else + return (char *)"Unknown"; } -void OpenAPI_hss_auth_type_free(OpenAPI_hss_auth_type_t *hss_auth_type) +OpenAPI_hss_auth_type_e OpenAPI_hss_auth_type_FromString(char* hss_auth_type) { - if (NULL == hss_auth_type) { - return; + int stringToReturn = 0; + const char *hss_auth_typeArray[] = { "NULL", "EPS_AKA", "EAP_AKA", "EAP_AKA_PRIME", "IMS_AKA", "GBA_AKA", "UMTS_AKA" }; + size_t sizeofArray = sizeof(hss_auth_typeArray) / sizeof(hss_auth_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(hss_auth_type, hss_auth_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(hss_auth_type); -} - -cJSON *OpenAPI_hss_auth_type_convertToJSON(OpenAPI_hss_auth_type_t *hss_auth_type) -{ - cJSON *item = NULL; - - if (hss_auth_type == NULL) { - ogs_error("OpenAPI_hss_auth_type_convertToJSON() failed [HssAuthType]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_parseFromJSON(cJSON *hss_auth_typeJSON) -{ - OpenAPI_hss_auth_type_t *hss_auth_type_local_var = NULL; - hss_auth_type_local_var = OpenAPI_hss_auth_type_create ( - ); - - return hss_auth_type_local_var; -end: - return NULL; -} - -OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_copy(OpenAPI_hss_auth_type_t *dst, OpenAPI_hss_auth_type_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_hss_auth_type_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_hss_auth_type_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_hss_auth_type_free(dst); - dst = OpenAPI_hss_auth_type_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/hss_auth_type.h b/lib/sbi/openapi/model/hss_auth_type.h index 0b1dcbffa..a2c313501 100644 --- a/lib/sbi/openapi/model/hss_auth_type.h +++ b/lib/sbi/openapi/model/hss_auth_type.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_hss_auth_type_s OpenAPI_hss_auth_type_t; -typedef struct OpenAPI_hss_auth_type_s { -} OpenAPI_hss_auth_type_t; +typedef enum { OpenAPI_hss_auth_type_NULL = 0, OpenAPI_hss_auth_type_EPS_AKA, OpenAPI_hss_auth_type_EAP_AKA, OpenAPI_hss_auth_type_EAP_AKA_PRIME, OpenAPI_hss_auth_type_IMS_AKA, OpenAPI_hss_auth_type_GBA_AKA, OpenAPI_hss_auth_type_UMTS_AKA } OpenAPI_hss_auth_type_e; -OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_create( - ); -void OpenAPI_hss_auth_type_free(OpenAPI_hss_auth_type_t *hss_auth_type); -OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_parseFromJSON(cJSON *hss_auth_typeJSON); -cJSON *OpenAPI_hss_auth_type_convertToJSON(OpenAPI_hss_auth_type_t *hss_auth_type); -OpenAPI_hss_auth_type_t *OpenAPI_hss_auth_type_copy(OpenAPI_hss_auth_type_t *dst, OpenAPI_hss_auth_type_t *src); +char* OpenAPI_hss_auth_type_ToString(OpenAPI_hss_auth_type_e hss_auth_type); + +OpenAPI_hss_auth_type_e OpenAPI_hss_auth_type_FromString(char* hss_auth_type); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hss_auth_type_in_uri.c b/lib/sbi/openapi/model/hss_auth_type_in_uri.c new file mode 100644 index 000000000..4996a93bf --- /dev/null +++ b/lib/sbi/openapi/model/hss_auth_type_in_uri.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "hss_auth_type_in_uri.h" + +char* OpenAPI_hss_auth_type_in_uri_ToString(OpenAPI_hss_auth_type_in_uri_e hss_auth_type_in_uri) +{ + const char *hss_auth_type_in_uriArray[] = { "NULL", "eps_aka", "eap_aka", "eap_aka_prime", "ims_aka", "gba_aka" }; + size_t sizeofArray = sizeof(hss_auth_type_in_uriArray) / sizeof(hss_auth_type_in_uriArray[0]); + if (hss_auth_type_in_uri < sizeofArray) + return (char *)hss_auth_type_in_uriArray[hss_auth_type_in_uri]; + else + return (char *)"Unknown"; +} + +OpenAPI_hss_auth_type_in_uri_e OpenAPI_hss_auth_type_in_uri_FromString(char* hss_auth_type_in_uri) +{ + int stringToReturn = 0; + const char *hss_auth_type_in_uriArray[] = { "NULL", "eps_aka", "eap_aka", "eap_aka_prime", "ims_aka", "gba_aka" }; + size_t sizeofArray = sizeof(hss_auth_type_in_uriArray) / sizeof(hss_auth_type_in_uriArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(hss_auth_type_in_uri, hss_auth_type_in_uriArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/hss_auth_type_in_uri.h b/lib/sbi/openapi/model/hss_auth_type_in_uri.h new file mode 100644 index 000000000..be9fa39af --- /dev/null +++ b/lib/sbi/openapi/model/hss_auth_type_in_uri.h @@ -0,0 +1,31 @@ +/* + * hss_auth_type_in_uri.h + * + * + */ + +#ifndef _OpenAPI_hss_auth_type_in_uri_H_ +#define _OpenAPI_hss_auth_type_in_uri_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_hss_auth_type_in_uri_NULL = 0, OpenAPI_hss_auth_type_in_uri_eps_aka, OpenAPI_hss_auth_type_in_uri_eap_aka, OpenAPI_hss_auth_type_in_uri_eap_aka_prime, OpenAPI_hss_auth_type_in_uri_ims_aka, OpenAPI_hss_auth_type_in_uri_gba_aka } OpenAPI_hss_auth_type_in_uri_e; + +char* OpenAPI_hss_auth_type_in_uri_ToString(OpenAPI_hss_auth_type_in_uri_e hss_auth_type_in_uri); + +OpenAPI_hss_auth_type_in_uri_e OpenAPI_hss_auth_type_in_uri_FromString(char* hss_auth_type_in_uri); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_hss_auth_type_in_uri_H_ */ + diff --git a/lib/sbi/openapi/model/hss_authentication_info_request.c b/lib/sbi/openapi/model/hss_authentication_info_request.c index a5dc9459a..fe2649dd4 100644 --- a/lib/sbi/openapi/model/hss_authentication_info_request.c +++ b/lib/sbi/openapi/model/hss_authentication_info_request.c @@ -6,10 +6,12 @@ OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_request_create( char *supported_features, - OpenAPI_hss_auth_type_t *hss_auth_type, + OpenAPI_hss_auth_type_e hss_auth_type, int num_of_requested_vectors, + OpenAPI_node_type_e requesting_node_type, OpenAPI_plmn_id_t *serving_network_id, - OpenAPI_resynchronization_info_t *resynchronization_info + OpenAPI_resynchronization_info_t *resynchronization_info, + OpenAPI_access_network_id_e an_id ) { OpenAPI_hss_authentication_info_request_t *hss_authentication_info_request_local_var = OpenAPI_malloc(sizeof(OpenAPI_hss_authentication_info_request_t)); @@ -19,8 +21,10 @@ OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_reque hss_authentication_info_request_local_var->supported_features = supported_features; hss_authentication_info_request_local_var->hss_auth_type = hss_auth_type; hss_authentication_info_request_local_var->num_of_requested_vectors = num_of_requested_vectors; + hss_authentication_info_request_local_var->requesting_node_type = requesting_node_type; hss_authentication_info_request_local_var->serving_network_id = serving_network_id; hss_authentication_info_request_local_var->resynchronization_info = resynchronization_info; + hss_authentication_info_request_local_var->an_id = an_id; return hss_authentication_info_request_local_var; } @@ -32,7 +36,6 @@ void OpenAPI_hss_authentication_info_request_free(OpenAPI_hss_authentication_inf } OpenAPI_lnode_t *node; ogs_free(hss_authentication_info_request->supported_features); - OpenAPI_hss_auth_type_free(hss_authentication_info_request->hss_auth_type); OpenAPI_plmn_id_free(hss_authentication_info_request->serving_network_id); OpenAPI_resynchronization_info_free(hss_authentication_info_request->resynchronization_info); ogs_free(hss_authentication_info_request); @@ -59,13 +62,7 @@ cJSON *OpenAPI_hss_authentication_info_request_convertToJSON(OpenAPI_hss_authent ogs_error("OpenAPI_hss_authentication_info_request_convertToJSON() failed [hss_auth_type]"); goto end; } - cJSON *hss_auth_type_local_JSON = OpenAPI_hss_auth_type_convertToJSON(hss_authentication_info_request->hss_auth_type); - if (hss_auth_type_local_JSON == NULL) { - ogs_error("OpenAPI_hss_authentication_info_request_convertToJSON() failed [hss_auth_type]"); - goto end; - } - cJSON_AddItemToObject(item, "hssAuthType", hss_auth_type_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "hssAuthType", OpenAPI_hss_auth_type_ToString(hss_authentication_info_request->hss_auth_type)) == NULL) { ogs_error("OpenAPI_hss_authentication_info_request_convertToJSON() failed [hss_auth_type]"); goto end; } @@ -79,6 +76,13 @@ cJSON *OpenAPI_hss_authentication_info_request_convertToJSON(OpenAPI_hss_authent goto end; } + if (hss_authentication_info_request->requesting_node_type) { + if (cJSON_AddStringToObject(item, "requestingNodeType", OpenAPI_node_type_ToString(hss_authentication_info_request->requesting_node_type)) == NULL) { + ogs_error("OpenAPI_hss_authentication_info_request_convertToJSON() failed [requesting_node_type]"); + goto end; + } + } + if (hss_authentication_info_request->serving_network_id) { cJSON *serving_network_id_local_JSON = OpenAPI_plmn_id_convertToJSON(hss_authentication_info_request->serving_network_id); if (serving_network_id_local_JSON == NULL) { @@ -105,6 +109,13 @@ cJSON *OpenAPI_hss_authentication_info_request_convertToJSON(OpenAPI_hss_authent } } + if (hss_authentication_info_request->an_id) { + if (cJSON_AddStringToObject(item, "anId", OpenAPI_access_network_id_ToString(hss_authentication_info_request->an_id)) == NULL) { + ogs_error("OpenAPI_hss_authentication_info_request_convertToJSON() failed [an_id]"); + goto end; + } + } + end: return item; } @@ -127,9 +138,13 @@ OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_reque goto end; } - OpenAPI_hss_auth_type_t *hss_auth_type_local_nonprim = NULL; + OpenAPI_hss_auth_type_e hss_auth_typeVariable; - hss_auth_type_local_nonprim = OpenAPI_hss_auth_type_parseFromJSON(hss_auth_type); + if (!cJSON_IsString(hss_auth_type)) { + ogs_error("OpenAPI_hss_authentication_info_request_parseFromJSON() failed [hss_auth_type]"); + goto end; + } + hss_auth_typeVariable = OpenAPI_hss_auth_type_FromString(hss_auth_type->valuestring); cJSON *num_of_requested_vectors = cJSON_GetObjectItemCaseSensitive(hss_authentication_info_requestJSON, "numOfRequestedVectors"); if (!num_of_requested_vectors) { @@ -143,6 +158,17 @@ OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_reque goto end; } + cJSON *requesting_node_type = cJSON_GetObjectItemCaseSensitive(hss_authentication_info_requestJSON, "requestingNodeType"); + + OpenAPI_node_type_e requesting_node_typeVariable; + if (requesting_node_type) { + if (!cJSON_IsString(requesting_node_type)) { + ogs_error("OpenAPI_hss_authentication_info_request_parseFromJSON() failed [requesting_node_type]"); + goto end; + } + requesting_node_typeVariable = OpenAPI_node_type_FromString(requesting_node_type->valuestring); + } + cJSON *serving_network_id = cJSON_GetObjectItemCaseSensitive(hss_authentication_info_requestJSON, "servingNetworkId"); OpenAPI_plmn_id_t *serving_network_id_local_nonprim = NULL; @@ -157,12 +183,25 @@ OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_reque resynchronization_info_local_nonprim = OpenAPI_resynchronization_info_parseFromJSON(resynchronization_info); } + cJSON *an_id = cJSON_GetObjectItemCaseSensitive(hss_authentication_info_requestJSON, "anId"); + + OpenAPI_access_network_id_e an_idVariable; + if (an_id) { + if (!cJSON_IsString(an_id)) { + ogs_error("OpenAPI_hss_authentication_info_request_parseFromJSON() failed [an_id]"); + goto end; + } + an_idVariable = OpenAPI_access_network_id_FromString(an_id->valuestring); + } + hss_authentication_info_request_local_var = OpenAPI_hss_authentication_info_request_create ( supported_features ? ogs_strdup(supported_features->valuestring) : NULL, - hss_auth_type_local_nonprim, + hss_auth_typeVariable, num_of_requested_vectors->valuedouble, + requesting_node_type ? requesting_node_typeVariable : 0, serving_network_id ? serving_network_id_local_nonprim : NULL, - resynchronization_info ? resynchronization_info_local_nonprim : NULL + resynchronization_info ? resynchronization_info_local_nonprim : NULL, + an_id ? an_idVariable : 0 ); return hss_authentication_info_request_local_var; diff --git a/lib/sbi/openapi/model/hss_authentication_info_request.h b/lib/sbi/openapi/model/hss_authentication_info_request.h index 38562761e..71d4a160a 100644 --- a/lib/sbi/openapi/model/hss_authentication_info_request.h +++ b/lib/sbi/openapi/model/hss_authentication_info_request.h @@ -12,7 +12,9 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "access_network_id.h" #include "hss_auth_type.h" +#include "node_type.h" #include "plmn_id.h" #include "resynchronization_info.h" @@ -23,18 +25,22 @@ extern "C" { typedef struct OpenAPI_hss_authentication_info_request_s OpenAPI_hss_authentication_info_request_t; typedef struct OpenAPI_hss_authentication_info_request_s { char *supported_features; - struct OpenAPI_hss_auth_type_s *hss_auth_type; + OpenAPI_hss_auth_type_e hss_auth_type; int num_of_requested_vectors; + OpenAPI_node_type_e requesting_node_type; struct OpenAPI_plmn_id_s *serving_network_id; struct OpenAPI_resynchronization_info_s *resynchronization_info; + OpenAPI_access_network_id_e an_id; } OpenAPI_hss_authentication_info_request_t; OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_request_create( char *supported_features, - OpenAPI_hss_auth_type_t *hss_auth_type, + OpenAPI_hss_auth_type_e hss_auth_type, int num_of_requested_vectors, + OpenAPI_node_type_e requesting_node_type, OpenAPI_plmn_id_t *serving_network_id, - OpenAPI_resynchronization_info_t *resynchronization_info + OpenAPI_resynchronization_info_t *resynchronization_info, + OpenAPI_access_network_id_e an_id ); void OpenAPI_hss_authentication_info_request_free(OpenAPI_hss_authentication_info_request_t *hss_authentication_info_request); OpenAPI_hss_authentication_info_request_t *OpenAPI_hss_authentication_info_request_parseFromJSON(cJSON *hss_authentication_info_requestJSON); diff --git a/lib/sbi/openapi/model/hss_av_type.c b/lib/sbi/openapi/model/hss_av_type.c index 24bca8162..56e0317b2 100644 --- a/lib/sbi/openapi/model/hss_av_type.c +++ b/lib/sbi/openapi/model/hss_av_type.c @@ -4,82 +4,27 @@ #include #include "hss_av_type.h" -OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_create( - ) +char* OpenAPI_hss_av_type_ToString(OpenAPI_hss_av_type_e hss_av_type) { - OpenAPI_hss_av_type_t *hss_av_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_hss_av_type_t)); - if (!hss_av_type_local_var) { - return NULL; - } - - return hss_av_type_local_var; + const char *hss_av_typeArray[] = { "NULL", "EPS_AKA", "EAP_AKA", "IMS_AKA", "GBA_AKA", "UMTS_AKA" }; + size_t sizeofArray = sizeof(hss_av_typeArray) / sizeof(hss_av_typeArray[0]); + if (hss_av_type < sizeofArray) + return (char *)hss_av_typeArray[hss_av_type]; + else + return (char *)"Unknown"; } -void OpenAPI_hss_av_type_free(OpenAPI_hss_av_type_t *hss_av_type) +OpenAPI_hss_av_type_e OpenAPI_hss_av_type_FromString(char* hss_av_type) { - if (NULL == hss_av_type) { - return; + int stringToReturn = 0; + const char *hss_av_typeArray[] = { "NULL", "EPS_AKA", "EAP_AKA", "IMS_AKA", "GBA_AKA", "UMTS_AKA" }; + size_t sizeofArray = sizeof(hss_av_typeArray) / sizeof(hss_av_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(hss_av_type, hss_av_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(hss_av_type); -} - -cJSON *OpenAPI_hss_av_type_convertToJSON(OpenAPI_hss_av_type_t *hss_av_type) -{ - cJSON *item = NULL; - - if (hss_av_type == NULL) { - ogs_error("OpenAPI_hss_av_type_convertToJSON() failed [HssAvType]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_parseFromJSON(cJSON *hss_av_typeJSON) -{ - OpenAPI_hss_av_type_t *hss_av_type_local_var = NULL; - hss_av_type_local_var = OpenAPI_hss_av_type_create ( - ); - - return hss_av_type_local_var; -end: - return NULL; -} - -OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_copy(OpenAPI_hss_av_type_t *dst, OpenAPI_hss_av_type_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_hss_av_type_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_hss_av_type_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_hss_av_type_free(dst); - dst = OpenAPI_hss_av_type_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/hss_av_type.h b/lib/sbi/openapi/model/hss_av_type.h index 1eb3af271..7855c8167 100644 --- a/lib/sbi/openapi/model/hss_av_type.h +++ b/lib/sbi/openapi/model/hss_av_type.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_hss_av_type_s OpenAPI_hss_av_type_t; -typedef struct OpenAPI_hss_av_type_s { -} OpenAPI_hss_av_type_t; +typedef enum { OpenAPI_hss_av_type_NULL = 0, OpenAPI_hss_av_type_EPS_AKA, OpenAPI_hss_av_type_EAP_AKA, OpenAPI_hss_av_type_IMS_AKA, OpenAPI_hss_av_type_GBA_AKA, OpenAPI_hss_av_type_UMTS_AKA } OpenAPI_hss_av_type_e; -OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_create( - ); -void OpenAPI_hss_av_type_free(OpenAPI_hss_av_type_t *hss_av_type); -OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_parseFromJSON(cJSON *hss_av_typeJSON); -cJSON *OpenAPI_hss_av_type_convertToJSON(OpenAPI_hss_av_type_t *hss_av_type); -OpenAPI_hss_av_type_t *OpenAPI_hss_av_type_copy(OpenAPI_hss_av_type_t *dst, OpenAPI_hss_av_type_t *src); +char* OpenAPI_hss_av_type_ToString(OpenAPI_hss_av_type_e hss_av_type); + +OpenAPI_hss_av_type_e OpenAPI_hss_av_type_FromString(char* hss_av_type); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/hss_info.c b/lib/sbi/openapi/model/hss_info.c index 1c786a33e..6e806b8bb 100644 --- a/lib/sbi/openapi/model/hss_info.c +++ b/lib/sbi/openapi/model/hss_info.c @@ -6,7 +6,10 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_create( char *group_id, - OpenAPI_list_t *ims_ranges + OpenAPI_list_t *imsi_ranges, + OpenAPI_list_t *ims_private_identity_ranges, + OpenAPI_list_t *ims_public_identity_ranges, + OpenAPI_list_t *msisdn_ranges ) { OpenAPI_hss_info_t *hss_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_hss_info_t)); @@ -14,7 +17,10 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_create( return NULL; } hss_info_local_var->group_id = group_id; - hss_info_local_var->ims_ranges = ims_ranges; + hss_info_local_var->imsi_ranges = imsi_ranges; + hss_info_local_var->ims_private_identity_ranges = ims_private_identity_ranges; + hss_info_local_var->ims_public_identity_ranges = ims_public_identity_ranges; + hss_info_local_var->msisdn_ranges = msisdn_ranges; return hss_info_local_var; } @@ -26,10 +32,22 @@ void OpenAPI_hss_info_free(OpenAPI_hss_info_t *hss_info) } OpenAPI_lnode_t *node; ogs_free(hss_info->group_id); - OpenAPI_list_for_each(hss_info->ims_ranges, node) { + OpenAPI_list_for_each(hss_info->imsi_ranges, node) { OpenAPI_imsi_range_free(node->data); } - OpenAPI_list_free(hss_info->ims_ranges); + OpenAPI_list_free(hss_info->imsi_ranges); + OpenAPI_list_for_each(hss_info->ims_private_identity_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(hss_info->ims_private_identity_ranges); + OpenAPI_list_for_each(hss_info->ims_public_identity_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(hss_info->ims_public_identity_ranges); + OpenAPI_list_for_each(hss_info->msisdn_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(hss_info->msisdn_ranges); ogs_free(hss_info); } @@ -50,22 +68,82 @@ cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info) } } - if (hss_info->ims_ranges) { - cJSON *ims_rangesList = cJSON_AddArrayToObject(item, "imsRanges"); - if (ims_rangesList == NULL) { - ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_ranges]"); + if (hss_info->imsi_ranges) { + cJSON *imsi_rangesList = cJSON_AddArrayToObject(item, "imsiRanges"); + if (imsi_rangesList == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [imsi_ranges]"); goto end; } - OpenAPI_lnode_t *ims_ranges_node; - if (hss_info->ims_ranges) { - OpenAPI_list_for_each(hss_info->ims_ranges, ims_ranges_node) { - cJSON *itemLocal = OpenAPI_imsi_range_convertToJSON(ims_ranges_node->data); + OpenAPI_lnode_t *imsi_ranges_node; + if (hss_info->imsi_ranges) { + OpenAPI_list_for_each(hss_info->imsi_ranges, imsi_ranges_node) { + cJSON *itemLocal = OpenAPI_imsi_range_convertToJSON(imsi_ranges_node->data); if (itemLocal == NULL) { - ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_ranges]"); + ogs_error("OpenAPI_hss_info_convertToJSON() failed [imsi_ranges]"); goto end; } - cJSON_AddItemToArray(ims_rangesList, itemLocal); + cJSON_AddItemToArray(imsi_rangesList, itemLocal); + } + } + } + + if (hss_info->ims_private_identity_ranges) { + cJSON *ims_private_identity_rangesList = cJSON_AddArrayToObject(item, "imsPrivateIdentityRanges"); + if (ims_private_identity_rangesList == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_private_identity_ranges]"); + goto end; + } + + OpenAPI_lnode_t *ims_private_identity_ranges_node; + if (hss_info->ims_private_identity_ranges) { + OpenAPI_list_for_each(hss_info->ims_private_identity_ranges, ims_private_identity_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(ims_private_identity_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_private_identity_ranges]"); + goto end; + } + cJSON_AddItemToArray(ims_private_identity_rangesList, itemLocal); + } + } + } + + if (hss_info->ims_public_identity_ranges) { + cJSON *ims_public_identity_rangesList = cJSON_AddArrayToObject(item, "imsPublicIdentityRanges"); + if (ims_public_identity_rangesList == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_public_identity_ranges]"); + goto end; + } + + OpenAPI_lnode_t *ims_public_identity_ranges_node; + if (hss_info->ims_public_identity_ranges) { + OpenAPI_list_for_each(hss_info->ims_public_identity_ranges, ims_public_identity_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(ims_public_identity_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [ims_public_identity_ranges]"); + goto end; + } + cJSON_AddItemToArray(ims_public_identity_rangesList, itemLocal); + } + } + } + + if (hss_info->msisdn_ranges) { + cJSON *msisdn_rangesList = cJSON_AddArrayToObject(item, "msisdnRanges"); + if (msisdn_rangesList == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + + OpenAPI_lnode_t *msisdn_ranges_node; + if (hss_info->msisdn_ranges) { + OpenAPI_list_for_each(hss_info->msisdn_ranges, msisdn_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(msisdn_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + cJSON_AddItemToArray(msisdn_rangesList, itemLocal); } } } @@ -86,32 +164,104 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON) } } - cJSON *ims_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsRanges"); + cJSON *imsi_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsiRanges"); - OpenAPI_list_t *ims_rangesList; - if (ims_ranges) { - cJSON *ims_ranges_local_nonprimitive; - if (!cJSON_IsArray(ims_ranges)) { - ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_ranges]"); + OpenAPI_list_t *imsi_rangesList; + if (imsi_ranges) { + cJSON *imsi_ranges_local_nonprimitive; + if (!cJSON_IsArray(imsi_ranges)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [imsi_ranges]"); goto end; } - ims_rangesList = OpenAPI_list_create(); + imsi_rangesList = OpenAPI_list_create(); - cJSON_ArrayForEach(ims_ranges_local_nonprimitive, ims_ranges ) { - if (!cJSON_IsObject(ims_ranges_local_nonprimitive)) { - ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_ranges]"); + cJSON_ArrayForEach(imsi_ranges_local_nonprimitive, imsi_ranges ) { + if (!cJSON_IsObject(imsi_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [imsi_ranges]"); goto end; } - OpenAPI_imsi_range_t *ims_rangesItem = OpenAPI_imsi_range_parseFromJSON(ims_ranges_local_nonprimitive); + OpenAPI_imsi_range_t *imsi_rangesItem = OpenAPI_imsi_range_parseFromJSON(imsi_ranges_local_nonprimitive); - OpenAPI_list_add(ims_rangesList, ims_rangesItem); + OpenAPI_list_add(imsi_rangesList, imsi_rangesItem); + } + } + + cJSON *ims_private_identity_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsPrivateIdentityRanges"); + + OpenAPI_list_t *ims_private_identity_rangesList; + if (ims_private_identity_ranges) { + cJSON *ims_private_identity_ranges_local_nonprimitive; + if (!cJSON_IsArray(ims_private_identity_ranges)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_private_identity_ranges]"); + goto end; + } + + ims_private_identity_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ims_private_identity_ranges_local_nonprimitive, ims_private_identity_ranges ) { + if (!cJSON_IsObject(ims_private_identity_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_private_identity_ranges]"); + goto end; + } + OpenAPI_identity_range_t *ims_private_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_private_identity_ranges_local_nonprimitive); + + OpenAPI_list_add(ims_private_identity_rangesList, ims_private_identity_rangesItem); + } + } + + cJSON *ims_public_identity_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "imsPublicIdentityRanges"); + + OpenAPI_list_t *ims_public_identity_rangesList; + if (ims_public_identity_ranges) { + cJSON *ims_public_identity_ranges_local_nonprimitive; + if (!cJSON_IsArray(ims_public_identity_ranges)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_public_identity_ranges]"); + goto end; + } + + ims_public_identity_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ims_public_identity_ranges_local_nonprimitive, ims_public_identity_ranges ) { + if (!cJSON_IsObject(ims_public_identity_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [ims_public_identity_ranges]"); + goto end; + } + OpenAPI_identity_range_t *ims_public_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_public_identity_ranges_local_nonprimitive); + + OpenAPI_list_add(ims_public_identity_rangesList, ims_public_identity_rangesItem); + } + } + + cJSON *msisdn_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "msisdnRanges"); + + OpenAPI_list_t *msisdn_rangesList; + if (msisdn_ranges) { + cJSON *msisdn_ranges_local_nonprimitive; + if (!cJSON_IsArray(msisdn_ranges)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + + msisdn_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(msisdn_ranges_local_nonprimitive, msisdn_ranges ) { + if (!cJSON_IsObject(msisdn_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + OpenAPI_identity_range_t *msisdn_rangesItem = OpenAPI_identity_range_parseFromJSON(msisdn_ranges_local_nonprimitive); + + OpenAPI_list_add(msisdn_rangesList, msisdn_rangesItem); } } hss_info_local_var = OpenAPI_hss_info_create ( group_id ? ogs_strdup(group_id->valuestring) : NULL, - ims_ranges ? ims_rangesList : NULL + imsi_ranges ? imsi_rangesList : NULL, + ims_private_identity_ranges ? ims_private_identity_rangesList : NULL, + ims_public_identity_ranges ? ims_public_identity_rangesList : NULL, + msisdn_ranges ? msisdn_rangesList : NULL ); return hss_info_local_var; diff --git a/lib/sbi/openapi/model/hss_info.h b/lib/sbi/openapi/model/hss_info.h index d681ef152..8d8357c58 100644 --- a/lib/sbi/openapi/model/hss_info.h +++ b/lib/sbi/openapi/model/hss_info.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "identity_range.h" #include "imsi_range.h" #ifdef __cplusplus @@ -21,12 +22,18 @@ extern "C" { typedef struct OpenAPI_hss_info_s OpenAPI_hss_info_t; typedef struct OpenAPI_hss_info_s { char *group_id; - OpenAPI_list_t *ims_ranges; + OpenAPI_list_t *imsi_ranges; + OpenAPI_list_t *ims_private_identity_ranges; + OpenAPI_list_t *ims_public_identity_ranges; + OpenAPI_list_t *msisdn_ranges; } OpenAPI_hss_info_t; OpenAPI_hss_info_t *OpenAPI_hss_info_create( char *group_id, - OpenAPI_list_t *ims_ranges + OpenAPI_list_t *imsi_ranges, + OpenAPI_list_t *ims_private_identity_ranges, + OpenAPI_list_t *ims_public_identity_ranges, + OpenAPI_list_t *msisdn_ranges ); void OpenAPI_hss_info_free(OpenAPI_hss_info_t *hss_info); OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON); diff --git a/lib/sbi/openapi/model/inter_freq_target_info.c b/lib/sbi/openapi/model/inter_freq_target_info.c new file mode 100644 index 000000000..c679f1b98 --- /dev/null +++ b/lib/sbi/openapi/model/inter_freq_target_info.c @@ -0,0 +1,152 @@ + +#include +#include +#include +#include "inter_freq_target_info.h" + +OpenAPI_inter_freq_target_info_t *OpenAPI_inter_freq_target_info_create( + int dl_carrier_freq, + OpenAPI_list_t *cell_id_list + ) +{ + OpenAPI_inter_freq_target_info_t *inter_freq_target_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_inter_freq_target_info_t)); + if (!inter_freq_target_info_local_var) { + return NULL; + } + inter_freq_target_info_local_var->dl_carrier_freq = dl_carrier_freq; + inter_freq_target_info_local_var->cell_id_list = cell_id_list; + + return inter_freq_target_info_local_var; +} + +void OpenAPI_inter_freq_target_info_free(OpenAPI_inter_freq_target_info_t *inter_freq_target_info) +{ + if (NULL == inter_freq_target_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(inter_freq_target_info->cell_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(inter_freq_target_info->cell_id_list); + ogs_free(inter_freq_target_info); +} + +cJSON *OpenAPI_inter_freq_target_info_convertToJSON(OpenAPI_inter_freq_target_info_t *inter_freq_target_info) +{ + cJSON *item = NULL; + + if (inter_freq_target_info == NULL) { + ogs_error("OpenAPI_inter_freq_target_info_convertToJSON() failed [InterFreqTargetInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!inter_freq_target_info->dl_carrier_freq) { + ogs_error("OpenAPI_inter_freq_target_info_convertToJSON() failed [dl_carrier_freq]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "dlCarrierFreq", inter_freq_target_info->dl_carrier_freq) == NULL) { + ogs_error("OpenAPI_inter_freq_target_info_convertToJSON() failed [dl_carrier_freq]"); + goto end; + } + + if (inter_freq_target_info->cell_id_list) { + cJSON *cell_id_list = cJSON_AddArrayToObject(item, "cellIdList"); + if (cell_id_list == NULL) { + ogs_error("OpenAPI_inter_freq_target_info_convertToJSON() failed [cell_id_list]"); + goto end; + } + + OpenAPI_lnode_t *cell_id_list_node; + OpenAPI_list_for_each(inter_freq_target_info->cell_id_list, cell_id_list_node) { + if (cJSON_AddNumberToObject(cell_id_list, "", *(double *)cell_id_list_node->data) == NULL) { + ogs_error("OpenAPI_inter_freq_target_info_convertToJSON() failed [cell_id_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_inter_freq_target_info_t *OpenAPI_inter_freq_target_info_parseFromJSON(cJSON *inter_freq_target_infoJSON) +{ + OpenAPI_inter_freq_target_info_t *inter_freq_target_info_local_var = NULL; + cJSON *dl_carrier_freq = cJSON_GetObjectItemCaseSensitive(inter_freq_target_infoJSON, "dlCarrierFreq"); + if (!dl_carrier_freq) { + ogs_error("OpenAPI_inter_freq_target_info_parseFromJSON() failed [dl_carrier_freq]"); + goto end; + } + + + if (!cJSON_IsNumber(dl_carrier_freq)) { + ogs_error("OpenAPI_inter_freq_target_info_parseFromJSON() failed [dl_carrier_freq]"); + goto end; + } + + cJSON *cell_id_list = cJSON_GetObjectItemCaseSensitive(inter_freq_target_infoJSON, "cellIdList"); + + OpenAPI_list_t *cell_id_listList; + if (cell_id_list) { + cJSON *cell_id_list_local; + if (!cJSON_IsArray(cell_id_list)) { + ogs_error("OpenAPI_inter_freq_target_info_parseFromJSON() failed [cell_id_list]"); + goto end; + } + cell_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cell_id_list_local, cell_id_list) { + if (!cJSON_IsNumber(cell_id_list_local)) { + ogs_error("OpenAPI_inter_freq_target_info_parseFromJSON() failed [cell_id_list]"); + goto end; + } + OpenAPI_list_add(cell_id_listList, &cell_id_list_local->valuedouble); + } + } + + inter_freq_target_info_local_var = OpenAPI_inter_freq_target_info_create ( + dl_carrier_freq->valuedouble, + cell_id_list ? cell_id_listList : NULL + ); + + return inter_freq_target_info_local_var; +end: + return NULL; +} + +OpenAPI_inter_freq_target_info_t *OpenAPI_inter_freq_target_info_copy(OpenAPI_inter_freq_target_info_t *dst, OpenAPI_inter_freq_target_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_inter_freq_target_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_inter_freq_target_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_inter_freq_target_info_free(dst); + dst = OpenAPI_inter_freq_target_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/inter_freq_target_info.h b/lib/sbi/openapi/model/inter_freq_target_info.h new file mode 100644 index 000000000..66874c8a2 --- /dev/null +++ b/lib/sbi/openapi/model/inter_freq_target_info.h @@ -0,0 +1,40 @@ +/* + * inter_freq_target_info.h + * + * + */ + +#ifndef _OpenAPI_inter_freq_target_info_H_ +#define _OpenAPI_inter_freq_target_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_inter_freq_target_info_s OpenAPI_inter_freq_target_info_t; +typedef struct OpenAPI_inter_freq_target_info_s { + int dl_carrier_freq; + OpenAPI_list_t *cell_id_list; +} OpenAPI_inter_freq_target_info_t; + +OpenAPI_inter_freq_target_info_t *OpenAPI_inter_freq_target_info_create( + int dl_carrier_freq, + OpenAPI_list_t *cell_id_list + ); +void OpenAPI_inter_freq_target_info_free(OpenAPI_inter_freq_target_info_t *inter_freq_target_info); +OpenAPI_inter_freq_target_info_t *OpenAPI_inter_freq_target_info_parseFromJSON(cJSON *inter_freq_target_infoJSON); +cJSON *OpenAPI_inter_freq_target_info_convertToJSON(OpenAPI_inter_freq_target_info_t *inter_freq_target_info); +OpenAPI_inter_freq_target_info_t *OpenAPI_inter_freq_target_info_copy(OpenAPI_inter_freq_target_info_t *dst, OpenAPI_inter_freq_target_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_inter_freq_target_info_H_ */ + diff --git a/lib/sbi/openapi/model/ip_end_point.c b/lib/sbi/openapi/model/ip_end_point.c index 2aef494cd..31334ca16 100644 --- a/lib/sbi/openapi/model/ip_end_point.c +++ b/lib/sbi/openapi/model/ip_end_point.c @@ -7,7 +7,7 @@ OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_create( char *ipv4_address, char *ipv6_address, - OpenAPI_transport_protocol_t *transport, + OpenAPI_transport_protocol_e transport, int port ) { @@ -31,7 +31,6 @@ void OpenAPI_ip_end_point_free(OpenAPI_ip_end_point_t *ip_end_point) OpenAPI_lnode_t *node; ogs_free(ip_end_point->ipv4_address); ogs_free(ip_end_point->ipv6_address); - OpenAPI_transport_protocol_free(ip_end_point->transport); ogs_free(ip_end_point); } @@ -60,13 +59,7 @@ cJSON *OpenAPI_ip_end_point_convertToJSON(OpenAPI_ip_end_point_t *ip_end_point) } if (ip_end_point->transport) { - cJSON *transport_local_JSON = OpenAPI_transport_protocol_convertToJSON(ip_end_point->transport); - if (transport_local_JSON == NULL) { - ogs_error("OpenAPI_ip_end_point_convertToJSON() failed [transport]"); - goto end; - } - cJSON_AddItemToObject(item, "transport", transport_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "transport", OpenAPI_transport_protocol_ToString(ip_end_point->transport)) == NULL) { ogs_error("OpenAPI_ip_end_point_convertToJSON() failed [transport]"); goto end; } @@ -106,9 +99,13 @@ OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_parseFromJSON(cJSON *ip_end_pointJS cJSON *transport = cJSON_GetObjectItemCaseSensitive(ip_end_pointJSON, "transport"); - OpenAPI_transport_protocol_t *transport_local_nonprim = NULL; + OpenAPI_transport_protocol_e transportVariable; if (transport) { - transport_local_nonprim = OpenAPI_transport_protocol_parseFromJSON(transport); + if (!cJSON_IsString(transport)) { + ogs_error("OpenAPI_ip_end_point_parseFromJSON() failed [transport]"); + goto end; + } + transportVariable = OpenAPI_transport_protocol_FromString(transport->valuestring); } cJSON *port = cJSON_GetObjectItemCaseSensitive(ip_end_pointJSON, "port"); @@ -123,7 +120,7 @@ OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_parseFromJSON(cJSON *ip_end_pointJS ip_end_point_local_var = OpenAPI_ip_end_point_create ( ipv4_address ? ogs_strdup(ipv4_address->valuestring) : NULL, ipv6_address ? ogs_strdup(ipv6_address->valuestring) : NULL, - transport ? transport_local_nonprim : NULL, + transport ? transportVariable : 0, port ? port->valuedouble : 0 ); diff --git a/lib/sbi/openapi/model/ip_end_point.h b/lib/sbi/openapi/model/ip_end_point.h index ad1beea60..8932d41ad 100644 --- a/lib/sbi/openapi/model/ip_end_point.h +++ b/lib/sbi/openapi/model/ip_end_point.h @@ -22,14 +22,14 @@ typedef struct OpenAPI_ip_end_point_s OpenAPI_ip_end_point_t; typedef struct OpenAPI_ip_end_point_s { char *ipv4_address; char *ipv6_address; - struct OpenAPI_transport_protocol_s *transport; + OpenAPI_transport_protocol_e transport; int port; } OpenAPI_ip_end_point_t; OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_create( char *ipv4_address, char *ipv6_address, - OpenAPI_transport_protocol_t *transport, + OpenAPI_transport_protocol_e transport, int port ); void OpenAPI_ip_end_point_free(OpenAPI_ip_end_point_t *ip_end_point); diff --git a/lib/sbi/openapi/model/ip_sm_gw_registration.c b/lib/sbi/openapi/model/ip_sm_gw_registration.c new file mode 100644 index 000000000..1923fa492 --- /dev/null +++ b/lib/sbi/openapi/model/ip_sm_gw_registration.c @@ -0,0 +1,148 @@ + +#include +#include +#include +#include "ip_sm_gw_registration.h" + +OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_create( + char *ip_sm_gw_map_address, + OpenAPI_network_node_diameter_address_t *ip_sm_gw_diameter_address, + int unri_indicator + ) +{ + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_ip_sm_gw_registration_t)); + if (!ip_sm_gw_registration_local_var) { + return NULL; + } + ip_sm_gw_registration_local_var->ip_sm_gw_map_address = ip_sm_gw_map_address; + ip_sm_gw_registration_local_var->ip_sm_gw_diameter_address = ip_sm_gw_diameter_address; + ip_sm_gw_registration_local_var->unri_indicator = unri_indicator; + + return ip_sm_gw_registration_local_var; +} + +void OpenAPI_ip_sm_gw_registration_free(OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration) +{ + if (NULL == ip_sm_gw_registration) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ip_sm_gw_registration->ip_sm_gw_map_address); + OpenAPI_network_node_diameter_address_free(ip_sm_gw_registration->ip_sm_gw_diameter_address); + ogs_free(ip_sm_gw_registration); +} + +cJSON *OpenAPI_ip_sm_gw_registration_convertToJSON(OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration) +{ + cJSON *item = NULL; + + if (ip_sm_gw_registration == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [IpSmGwRegistration]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ip_sm_gw_registration->ip_sm_gw_map_address) { + if (cJSON_AddStringToObject(item, "ipSmGwMapAddress", ip_sm_gw_registration->ip_sm_gw_map_address) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [ip_sm_gw_map_address]"); + goto end; + } + } + + if (ip_sm_gw_registration->ip_sm_gw_diameter_address) { + cJSON *ip_sm_gw_diameter_address_local_JSON = OpenAPI_network_node_diameter_address_convertToJSON(ip_sm_gw_registration->ip_sm_gw_diameter_address); + if (ip_sm_gw_diameter_address_local_JSON == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [ip_sm_gw_diameter_address]"); + goto end; + } + cJSON_AddItemToObject(item, "ipSmGwDiameterAddress", ip_sm_gw_diameter_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [ip_sm_gw_diameter_address]"); + goto end; + } + } + + if (ip_sm_gw_registration->unri_indicator) { + if (cJSON_AddBoolToObject(item, "unriIndicator", ip_sm_gw_registration->unri_indicator) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [unri_indicator]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_parseFromJSON(cJSON *ip_sm_gw_registrationJSON) +{ + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration_local_var = NULL; + cJSON *ip_sm_gw_map_address = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "ipSmGwMapAddress"); + + if (ip_sm_gw_map_address) { + if (!cJSON_IsString(ip_sm_gw_map_address)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [ip_sm_gw_map_address]"); + goto end; + } + } + + cJSON *ip_sm_gw_diameter_address = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "ipSmGwDiameterAddress"); + + OpenAPI_network_node_diameter_address_t *ip_sm_gw_diameter_address_local_nonprim = NULL; + if (ip_sm_gw_diameter_address) { + ip_sm_gw_diameter_address_local_nonprim = OpenAPI_network_node_diameter_address_parseFromJSON(ip_sm_gw_diameter_address); + } + + cJSON *unri_indicator = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "unriIndicator"); + + if (unri_indicator) { + if (!cJSON_IsBool(unri_indicator)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [unri_indicator]"); + goto end; + } + } + + ip_sm_gw_registration_local_var = OpenAPI_ip_sm_gw_registration_create ( + ip_sm_gw_map_address ? ogs_strdup(ip_sm_gw_map_address->valuestring) : NULL, + ip_sm_gw_diameter_address ? ip_sm_gw_diameter_address_local_nonprim : NULL, + unri_indicator ? unri_indicator->valueint : 0 + ); + + return ip_sm_gw_registration_local_var; +end: + return NULL; +} + +OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_copy(OpenAPI_ip_sm_gw_registration_t *dst, OpenAPI_ip_sm_gw_registration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_sm_gw_registration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_sm_gw_registration_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_ip_sm_gw_registration_free(dst); + dst = OpenAPI_ip_sm_gw_registration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_sm_gw_registration.h b/lib/sbi/openapi/model/ip_sm_gw_registration.h new file mode 100644 index 000000000..a64dc81c2 --- /dev/null +++ b/lib/sbi/openapi/model/ip_sm_gw_registration.h @@ -0,0 +1,43 @@ +/* + * ip_sm_gw_registration.h + * + * + */ + +#ifndef _OpenAPI_ip_sm_gw_registration_H_ +#define _OpenAPI_ip_sm_gw_registration_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_node_diameter_address.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ip_sm_gw_registration_s OpenAPI_ip_sm_gw_registration_t; +typedef struct OpenAPI_ip_sm_gw_registration_s { + char *ip_sm_gw_map_address; + struct OpenAPI_network_node_diameter_address_s *ip_sm_gw_diameter_address; + int unri_indicator; +} OpenAPI_ip_sm_gw_registration_t; + +OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_create( + char *ip_sm_gw_map_address, + OpenAPI_network_node_diameter_address_t *ip_sm_gw_diameter_address, + int unri_indicator + ); +void OpenAPI_ip_sm_gw_registration_free(OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration); +OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_parseFromJSON(cJSON *ip_sm_gw_registrationJSON); +cJSON *OpenAPI_ip_sm_gw_registration_convertToJSON(OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration); +OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_copy(OpenAPI_ip_sm_gw_registration_t *dst, OpenAPI_ip_sm_gw_registration_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_sm_gw_registration_H_ */ + diff --git a/lib/sbi/openapi/model/job_type.c b/lib/sbi/openapi/model/job_type.c new file mode 100644 index 000000000..06578bbc7 --- /dev/null +++ b/lib/sbi/openapi/model/job_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "job_type.h" + +char* OpenAPI_job_type_ToString(OpenAPI_job_type_e job_type) +{ + const char *job_typeArray[] = { "NULL", "IMMEDIATE_MDT_ONLY", "LOGGED_MDT_ONLY", "TRACE_ONLY", "IMMEDIATE_MDT_AND_TRACE", "RLF_REPORTS_ONLY", "RCEF_REPORTS_ONLY", "LOGGED_MBSFN_MDT" }; + size_t sizeofArray = sizeof(job_typeArray) / sizeof(job_typeArray[0]); + if (job_type < sizeofArray) + return (char *)job_typeArray[job_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_job_type_e OpenAPI_job_type_FromString(char* job_type) +{ + int stringToReturn = 0; + const char *job_typeArray[] = { "NULL", "IMMEDIATE_MDT_ONLY", "LOGGED_MDT_ONLY", "TRACE_ONLY", "IMMEDIATE_MDT_AND_TRACE", "RLF_REPORTS_ONLY", "RCEF_REPORTS_ONLY", "LOGGED_MBSFN_MDT" }; + size_t sizeofArray = sizeof(job_typeArray) / sizeof(job_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(job_type, job_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/job_type.h b/lib/sbi/openapi/model/job_type.h new file mode 100644 index 000000000..5d1af5259 --- /dev/null +++ b/lib/sbi/openapi/model/job_type.h @@ -0,0 +1,31 @@ +/* + * job_type.h + * + * + */ + +#ifndef _OpenAPI_job_type_H_ +#define _OpenAPI_job_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_job_type_NULL = 0, OpenAPI_job_type_IMMEDIATE_MDT_ONLY, OpenAPI_job_type_LOGGED_MDT_ONLY, OpenAPI_job_type_TRACE_ONLY, OpenAPI_job_type_IMMEDIATE_MDT_AND_TRACE, OpenAPI_job_type_RLF_REPORTS_ONLY, OpenAPI_job_type_RCEF_REPORTS_ONLY, OpenAPI_job_type_LOGGED_MBSFN_MDT } OpenAPI_job_type_e; + +char* OpenAPI_job_type_ToString(OpenAPI_job_type_e job_type); + +OpenAPI_job_type_e OpenAPI_job_type_FromString(char* job_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_job_type_H_ */ + diff --git a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.c b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.c new file mode 100644 index 000000000..9611f9b73 --- /dev/null +++ b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.c @@ -0,0 +1,124 @@ + +#include +#include +#include +#include "lcs_broadcast_assistance_types_data.h" + +OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_create( + OpenAPI_list_t *location_assistance_type + ) +{ + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_lcs_broadcast_assistance_types_data_t)); + if (!lcs_broadcast_assistance_types_data_local_var) { + return NULL; + } + lcs_broadcast_assistance_types_data_local_var->location_assistance_type = location_assistance_type; + + return lcs_broadcast_assistance_types_data_local_var; +} + +void OpenAPI_lcs_broadcast_assistance_types_data_free(OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data) +{ + if (NULL == lcs_broadcast_assistance_types_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(lcs_broadcast_assistance_types_data->location_assistance_type, node) { + ogs_free(node->data); + } + OpenAPI_list_free(lcs_broadcast_assistance_types_data->location_assistance_type); + ogs_free(lcs_broadcast_assistance_types_data); +} + +cJSON *OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data) +{ + cJSON *item = NULL; + + if (lcs_broadcast_assistance_types_data == NULL) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON() failed [LcsBroadcastAssistanceTypesData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!lcs_broadcast_assistance_types_data->location_assistance_type) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON() failed [location_assistance_type]"); + goto end; + } + cJSON *location_assistance_type = cJSON_AddArrayToObject(item, "locationAssistanceType"); + if (location_assistance_type == NULL) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON() failed [location_assistance_type]"); + goto end; + } + + OpenAPI_lnode_t *location_assistance_type_node; + OpenAPI_list_for_each(lcs_broadcast_assistance_types_data->location_assistance_type, location_assistance_type_node) { + } + +end: + return item; +} + +OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(cJSON *lcs_broadcast_assistance_types_dataJSON) +{ + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data_local_var = NULL; + cJSON *location_assistance_type = cJSON_GetObjectItemCaseSensitive(lcs_broadcast_assistance_types_dataJSON, "locationAssistanceType"); + if (!location_assistance_type) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON() failed [location_assistance_type]"); + goto end; + } + + OpenAPI_list_t *location_assistance_typeList; + + cJSON *location_assistance_type_local; + if (!cJSON_IsArray(location_assistance_type)) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON() failed [location_assistance_type]"); + goto end; + } + location_assistance_typeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(location_assistance_type_local, location_assistance_type) { + } + + lcs_broadcast_assistance_types_data_local_var = OpenAPI_lcs_broadcast_assistance_types_data_create ( + location_assistance_typeList + ); + + return lcs_broadcast_assistance_types_data_local_var; +end: + return NULL; +} + +OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_copy(OpenAPI_lcs_broadcast_assistance_types_data_t *dst, OpenAPI_lcs_broadcast_assistance_types_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_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_lcs_broadcast_assistance_types_data_free(dst); + dst = OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.h b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.h new file mode 100644 index 000000000..0ed474dda --- /dev/null +++ b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.h @@ -0,0 +1,38 @@ +/* + * lcs_broadcast_assistance_types_data.h + * + * + */ + +#ifndef _OpenAPI_lcs_broadcast_assistance_types_data_H_ +#define _OpenAPI_lcs_broadcast_assistance_types_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_lcs_broadcast_assistance_types_data_s OpenAPI_lcs_broadcast_assistance_types_data_t; +typedef struct OpenAPI_lcs_broadcast_assistance_types_data_s { + OpenAPI_list_t *location_assistance_type; +} OpenAPI_lcs_broadcast_assistance_types_data_t; + +OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_create( + OpenAPI_list_t *location_assistance_type + ); +void OpenAPI_lcs_broadcast_assistance_types_data_free(OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data); +OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(cJSON *lcs_broadcast_assistance_types_dataJSON); +cJSON *OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data); +OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_copy(OpenAPI_lcs_broadcast_assistance_types_data_t *dst, OpenAPI_lcs_broadcast_assistance_types_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_lcs_broadcast_assistance_types_data_H_ */ + diff --git a/lib/sbi/openapi/model/lcs_client_non_external.c b/lib/sbi/openapi/model/lcs_client_non_external.c deleted file mode 100644 index 9a86fda5f..000000000 --- a/lib/sbi/openapi/model/lcs_client_non_external.c +++ /dev/null @@ -1,226 +0,0 @@ - -#include -#include -#include -#include "lcs_client_non_external.h" - -OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_create( - char *lcs_client_id, - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_t *valid_time_period - ) -{ - OpenAPI_lcs_client_non_external_t *lcs_client_non_external_local_var = OpenAPI_malloc(sizeof(OpenAPI_lcs_client_non_external_t)); - if (!lcs_client_non_external_local_var) { - return NULL; - } - lcs_client_non_external_local_var->lcs_client_id = lcs_client_id; - lcs_client_non_external_local_var->allowed_geographic_area = allowed_geographic_area; - lcs_client_non_external_local_var->privacy_check_related_action = privacy_check_related_action; - lcs_client_non_external_local_var->code_word_ind = code_word_ind; - lcs_client_non_external_local_var->valid_time_period = valid_time_period; - - return lcs_client_non_external_local_var; -} - -void OpenAPI_lcs_client_non_external_free(OpenAPI_lcs_client_non_external_t *lcs_client_non_external) -{ - if (NULL == lcs_client_non_external) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(lcs_client_non_external->lcs_client_id); - OpenAPI_list_for_each(lcs_client_non_external->allowed_geographic_area, node) { - OpenAPI_geographic_area_free(node->data); - } - OpenAPI_list_free(lcs_client_non_external->allowed_geographic_area); - OpenAPI_valid_time_period_free(lcs_client_non_external->valid_time_period); - ogs_free(lcs_client_non_external); -} - -cJSON *OpenAPI_lcs_client_non_external_convertToJSON(OpenAPI_lcs_client_non_external_t *lcs_client_non_external) -{ - cJSON *item = NULL; - - if (lcs_client_non_external == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [LcsClientNonExternal]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!lcs_client_non_external->lcs_client_id) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [lcs_client_id]"); - goto end; - } - if (cJSON_AddStringToObject(item, "lcsClientId", lcs_client_non_external->lcs_client_id) == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [lcs_client_id]"); - goto end; - } - - if (lcs_client_non_external->allowed_geographic_area) { - cJSON *allowed_geographic_areaList = cJSON_AddArrayToObject(item, "allowedGeographicArea"); - if (allowed_geographic_areaList == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - - OpenAPI_lnode_t *allowed_geographic_area_node; - if (lcs_client_non_external->allowed_geographic_area) { - OpenAPI_list_for_each(lcs_client_non_external->allowed_geographic_area, allowed_geographic_area_node) { - cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(allowed_geographic_area_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal); - } - } - } - - if (lcs_client_non_external->privacy_check_related_action) { - if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(lcs_client_non_external->privacy_check_related_action)) == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [privacy_check_related_action]"); - goto end; - } - } - - if (lcs_client_non_external->code_word_ind) { - if (cJSON_AddStringToObject(item, "codeWordInd", OpenAPI_code_word_ind_ToString(lcs_client_non_external->code_word_ind)) == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [code_word_ind]"); - goto end; - } - } - - if (lcs_client_non_external->valid_time_period) { - cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_convertToJSON(lcs_client_non_external->valid_time_period); - if (valid_time_period_local_JSON == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [valid_time_period]"); - goto end; - } - cJSON_AddItemToObject(item, "validTimePeriod", valid_time_period_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_lcs_client_non_external_convertToJSON() failed [valid_time_period]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_parseFromJSON(cJSON *lcs_client_non_externalJSON) -{ - OpenAPI_lcs_client_non_external_t *lcs_client_non_external_local_var = NULL; - cJSON *lcs_client_id = cJSON_GetObjectItemCaseSensitive(lcs_client_non_externalJSON, "lcsClientId"); - if (!lcs_client_id) { - ogs_error("OpenAPI_lcs_client_non_external_parseFromJSON() failed [lcs_client_id]"); - goto end; - } - - - if (!cJSON_IsString(lcs_client_id)) { - ogs_error("OpenAPI_lcs_client_non_external_parseFromJSON() failed [lcs_client_id]"); - goto end; - } - - cJSON *allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(lcs_client_non_externalJSON, "allowedGeographicArea"); - - OpenAPI_list_t *allowed_geographic_areaList; - if (allowed_geographic_area) { - cJSON *allowed_geographic_area_local_nonprimitive; - if (!cJSON_IsArray(allowed_geographic_area)) { - ogs_error("OpenAPI_lcs_client_non_external_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - - allowed_geographic_areaList = OpenAPI_list_create(); - - cJSON_ArrayForEach(allowed_geographic_area_local_nonprimitive, allowed_geographic_area ) { - if (!cJSON_IsObject(allowed_geographic_area_local_nonprimitive)) { - ogs_error("OpenAPI_lcs_client_non_external_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local_nonprimitive); - - OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem); - } - } - - cJSON *privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(lcs_client_non_externalJSON, "privacyCheckRelatedAction"); - - OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable; - if (privacy_check_related_action) { - if (!cJSON_IsString(privacy_check_related_action)) { - ogs_error("OpenAPI_lcs_client_non_external_parseFromJSON() failed [privacy_check_related_action]"); - goto end; - } - privacy_check_related_actionVariable = OpenAPI_privacy_check_related_action_FromString(privacy_check_related_action->valuestring); - } - - cJSON *code_word_ind = cJSON_GetObjectItemCaseSensitive(lcs_client_non_externalJSON, "codeWordInd"); - - OpenAPI_code_word_ind_e code_word_indVariable; - if (code_word_ind) { - if (!cJSON_IsString(code_word_ind)) { - ogs_error("OpenAPI_lcs_client_non_external_parseFromJSON() failed [code_word_ind]"); - goto end; - } - code_word_indVariable = OpenAPI_code_word_ind_FromString(code_word_ind->valuestring); - } - - cJSON *valid_time_period = cJSON_GetObjectItemCaseSensitive(lcs_client_non_externalJSON, "validTimePeriod"); - - OpenAPI_valid_time_period_t *valid_time_period_local_nonprim = NULL; - if (valid_time_period) { - valid_time_period_local_nonprim = OpenAPI_valid_time_period_parseFromJSON(valid_time_period); - } - - lcs_client_non_external_local_var = OpenAPI_lcs_client_non_external_create ( - ogs_strdup(lcs_client_id->valuestring), - allowed_geographic_area ? allowed_geographic_areaList : NULL, - privacy_check_related_action ? privacy_check_related_actionVariable : 0, - code_word_ind ? code_word_indVariable : 0, - valid_time_period ? valid_time_period_local_nonprim : NULL - ); - - return lcs_client_non_external_local_var; -end: - return NULL; -} - -OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_copy(OpenAPI_lcs_client_non_external_t *dst, OpenAPI_lcs_client_non_external_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_lcs_client_non_external_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_lcs_client_non_external_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_lcs_client_non_external_free(dst); - dst = OpenAPI_lcs_client_non_external_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/lcs_client_non_external.h b/lib/sbi/openapi/model/lcs_client_non_external.h deleted file mode 100644 index 0d2d23428..000000000 --- a/lib/sbi/openapi/model/lcs_client_non_external.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * lcs_client_non_external.h - * - * - */ - -#ifndef _OpenAPI_lcs_client_non_external_H_ -#define _OpenAPI_lcs_client_non_external_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "code_word_ind.h" -#include "geographic_area.h" -#include "privacy_check_related_action.h" -#include "valid_time_period.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_lcs_client_non_external_s OpenAPI_lcs_client_non_external_t; -typedef struct OpenAPI_lcs_client_non_external_s { - char *lcs_client_id; - OpenAPI_list_t *allowed_geographic_area; - OpenAPI_privacy_check_related_action_e privacy_check_related_action; - OpenAPI_code_word_ind_e code_word_ind; - struct OpenAPI_valid_time_period_s *valid_time_period; -} OpenAPI_lcs_client_non_external_t; - -OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_create( - char *lcs_client_id, - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_t *valid_time_period - ); -void OpenAPI_lcs_client_non_external_free(OpenAPI_lcs_client_non_external_t *lcs_client_non_external); -OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_parseFromJSON(cJSON *lcs_client_non_externalJSON); -cJSON *OpenAPI_lcs_client_non_external_convertToJSON(OpenAPI_lcs_client_non_external_t *lcs_client_non_external); -OpenAPI_lcs_client_non_external_t *OpenAPI_lcs_client_non_external_copy(OpenAPI_lcs_client_non_external_t *dst, OpenAPI_lcs_client_non_external_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_lcs_client_non_external_H_ */ - diff --git a/lib/sbi/openapi/model/lcs_privacy.c b/lib/sbi/openapi/model/lcs_privacy.c index 5e1414f4c..930c3caf5 100644 --- a/lib/sbi/openapi/model/lcs_privacy.c +++ b/lib/sbi/openapi/model/lcs_privacy.c @@ -7,7 +7,8 @@ OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_create( char *af_instance_id, int reference_id, - OpenAPI_lpi_t *lpi + OpenAPI_lpi_t *lpi, + char *mtc_provider_information ) { OpenAPI_lcs_privacy_t *lcs_privacy_local_var = OpenAPI_malloc(sizeof(OpenAPI_lcs_privacy_t)); @@ -17,6 +18,7 @@ OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_create( lcs_privacy_local_var->af_instance_id = af_instance_id; lcs_privacy_local_var->reference_id = reference_id; lcs_privacy_local_var->lpi = lpi; + lcs_privacy_local_var->mtc_provider_information = mtc_provider_information; return lcs_privacy_local_var; } @@ -29,6 +31,7 @@ void OpenAPI_lcs_privacy_free(OpenAPI_lcs_privacy_t *lcs_privacy) OpenAPI_lnode_t *node; ogs_free(lcs_privacy->af_instance_id); OpenAPI_lpi_free(lcs_privacy->lpi); + ogs_free(lcs_privacy->mtc_provider_information); ogs_free(lcs_privacy); } @@ -69,6 +72,13 @@ cJSON *OpenAPI_lcs_privacy_convertToJSON(OpenAPI_lcs_privacy_t *lcs_privacy) } } + if (lcs_privacy->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", lcs_privacy->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_lcs_privacy_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -101,10 +111,20 @@ OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_parseFromJSON(cJSON *lcs_privacyJSON) lpi_local_nonprim = OpenAPI_lpi_parseFromJSON(lpi); } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(lcs_privacyJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_lcs_privacy_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + lcs_privacy_local_var = OpenAPI_lcs_privacy_create ( af_instance_id ? ogs_strdup(af_instance_id->valuestring) : NULL, reference_id ? reference_id->valuedouble : 0, - lpi ? lpi_local_nonprim : NULL + lpi ? lpi_local_nonprim : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return lcs_privacy_local_var; diff --git a/lib/sbi/openapi/model/lcs_privacy.h b/lib/sbi/openapi/model/lcs_privacy.h index c4c6198ab..603a79c46 100644 --- a/lib/sbi/openapi/model/lcs_privacy.h +++ b/lib/sbi/openapi/model/lcs_privacy.h @@ -23,12 +23,14 @@ typedef struct OpenAPI_lcs_privacy_s { char *af_instance_id; int reference_id; struct OpenAPI_lpi_s *lpi; + char *mtc_provider_information; } OpenAPI_lcs_privacy_t; OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_create( char *af_instance_id, int reference_id, - OpenAPI_lpi_t *lpi + OpenAPI_lpi_t *lpi, + char *mtc_provider_information ); void OpenAPI_lcs_privacy_free(OpenAPI_lcs_privacy_t *lcs_privacy); OpenAPI_lcs_privacy_t *OpenAPI_lcs_privacy_parseFromJSON(cJSON *lcs_privacyJSON); diff --git a/lib/sbi/openapi/model/lcs_privacy_data.c b/lib/sbi/openapi/model/lcs_privacy_data.c index b706075db..fc75d3d33 100644 --- a/lib/sbi/openapi/model/lcs_privacy_data.c +++ b/lib/sbi/openapi/model/lcs_privacy_data.c @@ -6,7 +6,7 @@ OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_create( OpenAPI_lpi_t *lpi, - OpenAPI_list_t *unrelated_classes, + OpenAPI_unrelated_class_t *unrelated_class, OpenAPI_list_t *plmn_operator_classes ) { @@ -15,7 +15,7 @@ OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_create( return NULL; } lcs_privacy_data_local_var->lpi = lpi; - lcs_privacy_data_local_var->unrelated_classes = unrelated_classes; + lcs_privacy_data_local_var->unrelated_class = unrelated_class; lcs_privacy_data_local_var->plmn_operator_classes = plmn_operator_classes; return lcs_privacy_data_local_var; @@ -28,10 +28,7 @@ void OpenAPI_lcs_privacy_data_free(OpenAPI_lcs_privacy_data_t *lcs_privacy_data) } OpenAPI_lnode_t *node; OpenAPI_lpi_free(lcs_privacy_data->lpi); - OpenAPI_list_for_each(lcs_privacy_data->unrelated_classes, node) { - OpenAPI_unrelated_class_free(node->data); - } - OpenAPI_list_free(lcs_privacy_data->unrelated_classes); + OpenAPI_unrelated_class_free(lcs_privacy_data->unrelated_class); OpenAPI_list_for_each(lcs_privacy_data->plmn_operator_classes, node) { OpenAPI_plmn_operator_class_free(node->data); } @@ -62,23 +59,16 @@ cJSON *OpenAPI_lcs_privacy_data_convertToJSON(OpenAPI_lcs_privacy_data_t *lcs_pr } } - if (lcs_privacy_data->unrelated_classes) { - cJSON *unrelated_classesList = cJSON_AddArrayToObject(item, "unrelatedClasses"); - if (unrelated_classesList == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_convertToJSON() failed [unrelated_classes]"); + if (lcs_privacy_data->unrelated_class) { + cJSON *unrelated_class_local_JSON = OpenAPI_unrelated_class_convertToJSON(lcs_privacy_data->unrelated_class); + if (unrelated_class_local_JSON == NULL) { + ogs_error("OpenAPI_lcs_privacy_data_convertToJSON() failed [unrelated_class]"); goto end; } - - OpenAPI_lnode_t *unrelated_classes_node; - if (lcs_privacy_data->unrelated_classes) { - OpenAPI_list_for_each(lcs_privacy_data->unrelated_classes, unrelated_classes_node) { - cJSON *itemLocal = OpenAPI_unrelated_class_convertToJSON(unrelated_classes_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_convertToJSON() failed [unrelated_classes]"); - goto end; - } - cJSON_AddItemToArray(unrelated_classesList, itemLocal); - } + cJSON_AddItemToObject(item, "unrelatedClass", unrelated_class_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_lcs_privacy_data_convertToJSON() failed [unrelated_class]"); + goto end; } } @@ -116,27 +106,11 @@ OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_parseFromJSON(cJSON *lcs_pr lpi_local_nonprim = OpenAPI_lpi_parseFromJSON(lpi); } - cJSON *unrelated_classes = cJSON_GetObjectItemCaseSensitive(lcs_privacy_dataJSON, "unrelatedClasses"); + cJSON *unrelated_class = cJSON_GetObjectItemCaseSensitive(lcs_privacy_dataJSON, "unrelatedClass"); - OpenAPI_list_t *unrelated_classesList; - if (unrelated_classes) { - cJSON *unrelated_classes_local_nonprimitive; - if (!cJSON_IsArray(unrelated_classes)) { - ogs_error("OpenAPI_lcs_privacy_data_parseFromJSON() failed [unrelated_classes]"); - goto end; - } - - unrelated_classesList = OpenAPI_list_create(); - - cJSON_ArrayForEach(unrelated_classes_local_nonprimitive, unrelated_classes ) { - if (!cJSON_IsObject(unrelated_classes_local_nonprimitive)) { - ogs_error("OpenAPI_lcs_privacy_data_parseFromJSON() failed [unrelated_classes]"); - goto end; - } - OpenAPI_unrelated_class_t *unrelated_classesItem = OpenAPI_unrelated_class_parseFromJSON(unrelated_classes_local_nonprimitive); - - OpenAPI_list_add(unrelated_classesList, unrelated_classesItem); - } + OpenAPI_unrelated_class_t *unrelated_class_local_nonprim = NULL; + if (unrelated_class) { + unrelated_class_local_nonprim = OpenAPI_unrelated_class_parseFromJSON(unrelated_class); } cJSON *plmn_operator_classes = cJSON_GetObjectItemCaseSensitive(lcs_privacy_dataJSON, "plmnOperatorClasses"); @@ -164,7 +138,7 @@ OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_parseFromJSON(cJSON *lcs_pr lcs_privacy_data_local_var = OpenAPI_lcs_privacy_data_create ( lpi ? lpi_local_nonprim : NULL, - unrelated_classes ? unrelated_classesList : NULL, + unrelated_class ? unrelated_class_local_nonprim : NULL, plmn_operator_classes ? plmn_operator_classesList : NULL ); diff --git a/lib/sbi/openapi/model/lcs_privacy_data.h b/lib/sbi/openapi/model/lcs_privacy_data.h index 7b4f8fbeb..031049ff5 100644 --- a/lib/sbi/openapi/model/lcs_privacy_data.h +++ b/lib/sbi/openapi/model/lcs_privacy_data.h @@ -23,13 +23,13 @@ extern "C" { typedef struct OpenAPI_lcs_privacy_data_s OpenAPI_lcs_privacy_data_t; typedef struct OpenAPI_lcs_privacy_data_s { struct OpenAPI_lpi_s *lpi; - OpenAPI_list_t *unrelated_classes; + struct OpenAPI_unrelated_class_s *unrelated_class; OpenAPI_list_t *plmn_operator_classes; } OpenAPI_lcs_privacy_data_t; OpenAPI_lcs_privacy_data_t *OpenAPI_lcs_privacy_data_create( OpenAPI_lpi_t *lpi, - OpenAPI_list_t *unrelated_classes, + OpenAPI_unrelated_class_t *unrelated_class, OpenAPI_list_t *plmn_operator_classes ); void OpenAPI_lcs_privacy_data_free(OpenAPI_lcs_privacy_data_t *lcs_privacy_data); diff --git a/lib/sbi/openapi/model/line_type.c b/lib/sbi/openapi/model/line_type.c new file mode 100644 index 000000000..9e7c7c36f --- /dev/null +++ b/lib/sbi/openapi/model/line_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "line_type.h" + +char* OpenAPI_line_type_ToString(OpenAPI_line_type_e line_type) +{ + const char *line_typeArray[] = { "NULL", "DSL", "PON" }; + size_t sizeofArray = sizeof(line_typeArray) / sizeof(line_typeArray[0]); + if (line_type < sizeofArray) + return (char *)line_typeArray[line_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_line_type_e OpenAPI_line_type_FromString(char* line_type) +{ + int stringToReturn = 0; + const char *line_typeArray[] = { "NULL", "DSL", "PON" }; + size_t sizeofArray = sizeof(line_typeArray) / sizeof(line_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(line_type, line_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/line_type.h b/lib/sbi/openapi/model/line_type.h new file mode 100644 index 000000000..a742255a8 --- /dev/null +++ b/lib/sbi/openapi/model/line_type.h @@ -0,0 +1,31 @@ +/* + * line_type.h + * + * + */ + +#ifndef _OpenAPI_line_type_H_ +#define _OpenAPI_line_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_line_type_NULL = 0, OpenAPI_line_type_DSL, OpenAPI_line_type_PON } OpenAPI_line_type_e; + +char* OpenAPI_line_type_ToString(OpenAPI_line_type_e line_type); + +OpenAPI_line_type_e OpenAPI_line_type_FromString(char* line_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_line_type_H_ */ + diff --git a/lib/sbi/openapi/model/lmf_info.c b/lib/sbi/openapi/model/lmf_info.c index 2562e3986..40fc1590a 100644 --- a/lib/sbi/openapi/model/lmf_info.c +++ b/lib/sbi/openapi/model/lmf_info.c @@ -37,9 +37,6 @@ void OpenAPI_lmf_info_free(OpenAPI_lmf_info_t *lmf_info) OpenAPI_list_free(lmf_info->serving_client_types); ogs_free(lmf_info->lmf_id); OpenAPI_list_free(lmf_info->serving_access_types); - OpenAPI_list_for_each(lmf_info->serving_an_node_types, node) { - OpenAPI_an_node_type_free(node->data); - } OpenAPI_list_free(lmf_info->serving_an_node_types); OpenAPI_list_free(lmf_info->serving_rat_types); ogs_free(lmf_info); @@ -98,21 +95,16 @@ cJSON *OpenAPI_lmf_info_convertToJSON(OpenAPI_lmf_info_t *lmf_info) } if (lmf_info->serving_an_node_types) { - cJSON *serving_an_node_typesList = cJSON_AddArrayToObject(item, "servingAnNodeTypes"); - if (serving_an_node_typesList == NULL) { + cJSON *serving_an_node_types = cJSON_AddArrayToObject(item, "servingAnNodeTypes"); + if (serving_an_node_types == NULL) { ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_an_node_types]"); goto end; } - OpenAPI_lnode_t *serving_an_node_types_node; - if (lmf_info->serving_an_node_types) { - OpenAPI_list_for_each(lmf_info->serving_an_node_types, serving_an_node_types_node) { - cJSON *itemLocal = OpenAPI_an_node_type_convertToJSON(serving_an_node_types_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_an_node_types]"); - goto end; - } - cJSON_AddItemToArray(serving_an_node_typesList, itemLocal); + OpenAPI_list_for_each(lmf_info->serving_an_node_types, serving_an_node_types_node) { + if (cJSON_AddStringToObject(serving_an_node_types, "", OpenAPI_an_node_type_ToString((OpenAPI_an_node_type_e)serving_an_node_types_node->data)) == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_an_node_types]"); + goto end; } } } @@ -206,13 +198,12 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON) serving_an_node_typesList = OpenAPI_list_create(); cJSON_ArrayForEach(serving_an_node_types_local_nonprimitive, serving_an_node_types ) { - if (!cJSON_IsObject(serving_an_node_types_local_nonprimitive)) { + if (!cJSON_IsString(serving_an_node_types_local_nonprimitive)) { ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_an_node_types]"); goto end; } - OpenAPI_an_node_type_t *serving_an_node_typesItem = OpenAPI_an_node_type_parseFromJSON(serving_an_node_types_local_nonprimitive); - OpenAPI_list_add(serving_an_node_typesList, serving_an_node_typesItem); + OpenAPI_list_add(serving_an_node_typesList, (void *)OpenAPI_an_node_type_FromString(serving_an_node_types_local_nonprimitive->valuestring)); } } diff --git a/lib/sbi/openapi/model/lmf_info.h b/lib/sbi/openapi/model/lmf_info.h index 3ac04a98c..9d9db8607 100644 --- a/lib/sbi/openapi/model/lmf_info.h +++ b/lib/sbi/openapi/model/lmf_info.h @@ -1,7 +1,7 @@ /* * lmf_info.h * - * + * Information of an LMF NF Instance */ #ifndef _OpenAPI_lmf_info_H_ diff --git a/lib/sbi/openapi/model/location_info.c b/lib/sbi/openapi/model/location_info.c index 8f8ea2283..d2b097e78 100644 --- a/lib/sbi/openapi/model/location_info.c +++ b/lib/sbi/openapi/model/location_info.c @@ -32,7 +32,7 @@ void OpenAPI_location_info_free(OpenAPI_location_info_t *location_info) ogs_free(location_info->supi); ogs_free(location_info->gpsi); OpenAPI_list_for_each(location_info->registration_location_info_list, node) { - OpenAPI_object_free(node->data); + OpenAPI_registration_location_info_free(node->data); } OpenAPI_list_free(location_info->registration_location_info_list); ogs_free(location_info->supported_features); @@ -76,7 +76,7 @@ cJSON *OpenAPI_location_info_convertToJSON(OpenAPI_location_info_t *location_inf OpenAPI_lnode_t *registration_location_info_list_node; if (location_info->registration_location_info_list) { OpenAPI_list_for_each(location_info->registration_location_info_list, registration_location_info_list_node) { - cJSON *itemLocal = OpenAPI_object_convertToJSON(registration_location_info_list_node->data); + cJSON *itemLocal = OpenAPI_registration_location_info_convertToJSON(registration_location_info_list_node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_location_info_convertToJSON() failed [registration_location_info_list]"); goto end; @@ -138,7 +138,7 @@ OpenAPI_location_info_t *OpenAPI_location_info_parseFromJSON(cJSON *location_inf ogs_error("OpenAPI_location_info_parseFromJSON() failed [registration_location_info_list]"); goto end; } - OpenAPI_object_t *registration_location_info_listItem = OpenAPI_object_parseFromJSON(registration_location_info_list_local_nonprimitive); + OpenAPI_registration_location_info_t *registration_location_info_listItem = OpenAPI_registration_location_info_parseFromJSON(registration_location_info_list_local_nonprimitive); OpenAPI_list_add(registration_location_info_listList, registration_location_info_listItem); } diff --git a/lib/sbi/openapi/model/location_info.h b/lib/sbi/openapi/model/location_info.h index de418766b..fe0e4b855 100644 --- a/lib/sbi/openapi/model/location_info.h +++ b/lib/sbi/openapi/model/location_info.h @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "object.h" +#include "registration_location_info.h" #ifdef __cplusplus extern "C" { diff --git a/lib/sbi/openapi/model/logging_duration_mdt.c b/lib/sbi/openapi/model/logging_duration_mdt.c new file mode 100644 index 000000000..c33f25553 --- /dev/null +++ b/lib/sbi/openapi/model/logging_duration_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "logging_duration_mdt.h" + +char* OpenAPI_logging_duration_mdt_ToString(OpenAPI_logging_duration_mdt_e logging_duration_mdt) +{ + const char *logging_duration_mdtArray[] = { "NULL", "_600", "_1200", "_2400", "_3600", "_5400", "_7200" }; + size_t sizeofArray = sizeof(logging_duration_mdtArray) / sizeof(logging_duration_mdtArray[0]); + if (logging_duration_mdt < sizeofArray) + return (char *)logging_duration_mdtArray[logging_duration_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_logging_duration_mdt_e OpenAPI_logging_duration_mdt_FromString(char* logging_duration_mdt) +{ + int stringToReturn = 0; + const char *logging_duration_mdtArray[] = { "NULL", "_600", "_1200", "_2400", "_3600", "_5400", "_7200" }; + size_t sizeofArray = sizeof(logging_duration_mdtArray) / sizeof(logging_duration_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(logging_duration_mdt, logging_duration_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/logging_duration_mdt.h b/lib/sbi/openapi/model/logging_duration_mdt.h new file mode 100644 index 000000000..0d4c3b60f --- /dev/null +++ b/lib/sbi/openapi/model/logging_duration_mdt.h @@ -0,0 +1,31 @@ +/* + * logging_duration_mdt.h + * + * + */ + +#ifndef _OpenAPI_logging_duration_mdt_H_ +#define _OpenAPI_logging_duration_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_logging_duration_mdt_NULL = 0, OpenAPI_logging_duration_mdt__600, OpenAPI_logging_duration_mdt__1200, OpenAPI_logging_duration_mdt__2400, OpenAPI_logging_duration_mdt__3600, OpenAPI_logging_duration_mdt__5400, OpenAPI_logging_duration_mdt__7200 } OpenAPI_logging_duration_mdt_e; + +char* OpenAPI_logging_duration_mdt_ToString(OpenAPI_logging_duration_mdt_e logging_duration_mdt); + +OpenAPI_logging_duration_mdt_e OpenAPI_logging_duration_mdt_FromString(char* logging_duration_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_logging_duration_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/logging_duration_nr_mdt.c b/lib/sbi/openapi/model/logging_duration_nr_mdt.c new file mode 100644 index 000000000..9d8ab1a24 --- /dev/null +++ b/lib/sbi/openapi/model/logging_duration_nr_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "logging_duration_nr_mdt.h" + +char* OpenAPI_logging_duration_nr_mdt_ToString(OpenAPI_logging_duration_nr_mdt_e logging_duration_nr_mdt) +{ + const char *logging_duration_nr_mdtArray[] = { "NULL", "_600", "_1200", "_2400", "_3600", "_5400", "_7200" }; + size_t sizeofArray = sizeof(logging_duration_nr_mdtArray) / sizeof(logging_duration_nr_mdtArray[0]); + if (logging_duration_nr_mdt < sizeofArray) + return (char *)logging_duration_nr_mdtArray[logging_duration_nr_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_logging_duration_nr_mdt_e OpenAPI_logging_duration_nr_mdt_FromString(char* logging_duration_nr_mdt) +{ + int stringToReturn = 0; + const char *logging_duration_nr_mdtArray[] = { "NULL", "_600", "_1200", "_2400", "_3600", "_5400", "_7200" }; + size_t sizeofArray = sizeof(logging_duration_nr_mdtArray) / sizeof(logging_duration_nr_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(logging_duration_nr_mdt, logging_duration_nr_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/logging_duration_nr_mdt.h b/lib/sbi/openapi/model/logging_duration_nr_mdt.h new file mode 100644 index 000000000..3b7697e0a --- /dev/null +++ b/lib/sbi/openapi/model/logging_duration_nr_mdt.h @@ -0,0 +1,31 @@ +/* + * logging_duration_nr_mdt.h + * + * + */ + +#ifndef _OpenAPI_logging_duration_nr_mdt_H_ +#define _OpenAPI_logging_duration_nr_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_logging_duration_nr_mdt_NULL = 0, OpenAPI_logging_duration_nr_mdt__600, OpenAPI_logging_duration_nr_mdt__1200, OpenAPI_logging_duration_nr_mdt__2400, OpenAPI_logging_duration_nr_mdt__3600, OpenAPI_logging_duration_nr_mdt__5400, OpenAPI_logging_duration_nr_mdt__7200 } OpenAPI_logging_duration_nr_mdt_e; + +char* OpenAPI_logging_duration_nr_mdt_ToString(OpenAPI_logging_duration_nr_mdt_e logging_duration_nr_mdt); + +OpenAPI_logging_duration_nr_mdt_e OpenAPI_logging_duration_nr_mdt_FromString(char* logging_duration_nr_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_logging_duration_nr_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/logging_interval_mdt.c b/lib/sbi/openapi/model/logging_interval_mdt.c new file mode 100644 index 000000000..3ddce87f4 --- /dev/null +++ b/lib/sbi/openapi/model/logging_interval_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "logging_interval_mdt.h" + +char* OpenAPI_logging_interval_mdt_ToString(OpenAPI_logging_interval_mdt_e logging_interval_mdt) +{ + const char *logging_interval_mdtArray[] = { "NULL", "_128", "_256", "_512", "_1024", "_2048", "_3072", "_4096", "_6144" }; + size_t sizeofArray = sizeof(logging_interval_mdtArray) / sizeof(logging_interval_mdtArray[0]); + if (logging_interval_mdt < sizeofArray) + return (char *)logging_interval_mdtArray[logging_interval_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_logging_interval_mdt_e OpenAPI_logging_interval_mdt_FromString(char* logging_interval_mdt) +{ + int stringToReturn = 0; + const char *logging_interval_mdtArray[] = { "NULL", "_128", "_256", "_512", "_1024", "_2048", "_3072", "_4096", "_6144" }; + size_t sizeofArray = sizeof(logging_interval_mdtArray) / sizeof(logging_interval_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(logging_interval_mdt, logging_interval_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/logging_interval_mdt.h b/lib/sbi/openapi/model/logging_interval_mdt.h new file mode 100644 index 000000000..8216649b1 --- /dev/null +++ b/lib/sbi/openapi/model/logging_interval_mdt.h @@ -0,0 +1,31 @@ +/* + * logging_interval_mdt.h + * + * + */ + +#ifndef _OpenAPI_logging_interval_mdt_H_ +#define _OpenAPI_logging_interval_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_logging_interval_mdt_NULL = 0, OpenAPI_logging_interval_mdt__128, OpenAPI_logging_interval_mdt__256, OpenAPI_logging_interval_mdt__512, OpenAPI_logging_interval_mdt__1024, OpenAPI_logging_interval_mdt__2048, OpenAPI_logging_interval_mdt__3072, OpenAPI_logging_interval_mdt__4096, OpenAPI_logging_interval_mdt__6144 } OpenAPI_logging_interval_mdt_e; + +char* OpenAPI_logging_interval_mdt_ToString(OpenAPI_logging_interval_mdt_e logging_interval_mdt); + +OpenAPI_logging_interval_mdt_e OpenAPI_logging_interval_mdt_FromString(char* logging_interval_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_logging_interval_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/logging_interval_nr_mdt.c b/lib/sbi/openapi/model/logging_interval_nr_mdt.c new file mode 100644 index 000000000..1583bf172 --- /dev/null +++ b/lib/sbi/openapi/model/logging_interval_nr_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "logging_interval_nr_mdt.h" + +char* OpenAPI_logging_interval_nr_mdt_ToString(OpenAPI_logging_interval_nr_mdt_e logging_interval_nr_mdt) +{ + const char *logging_interval_nr_mdtArray[] = { "NULL", "_128", "_256", "_512", "_1024", "_2048", "_3072", "_4096", "_6144", "_320", "_640", "infinity" }; + size_t sizeofArray = sizeof(logging_interval_nr_mdtArray) / sizeof(logging_interval_nr_mdtArray[0]); + if (logging_interval_nr_mdt < sizeofArray) + return (char *)logging_interval_nr_mdtArray[logging_interval_nr_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_logging_interval_nr_mdt_e OpenAPI_logging_interval_nr_mdt_FromString(char* logging_interval_nr_mdt) +{ + int stringToReturn = 0; + const char *logging_interval_nr_mdtArray[] = { "NULL", "_128", "_256", "_512", "_1024", "_2048", "_3072", "_4096", "_6144", "_320", "_640", "infinity" }; + size_t sizeofArray = sizeof(logging_interval_nr_mdtArray) / sizeof(logging_interval_nr_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(logging_interval_nr_mdt, logging_interval_nr_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/logging_interval_nr_mdt.h b/lib/sbi/openapi/model/logging_interval_nr_mdt.h new file mode 100644 index 000000000..a03fa4a33 --- /dev/null +++ b/lib/sbi/openapi/model/logging_interval_nr_mdt.h @@ -0,0 +1,31 @@ +/* + * logging_interval_nr_mdt.h + * + * + */ + +#ifndef _OpenAPI_logging_interval_nr_mdt_H_ +#define _OpenAPI_logging_interval_nr_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_logging_interval_nr_mdt_NULL = 0, OpenAPI_logging_interval_nr_mdt__128, OpenAPI_logging_interval_nr_mdt__256, OpenAPI_logging_interval_nr_mdt__512, OpenAPI_logging_interval_nr_mdt__1024, OpenAPI_logging_interval_nr_mdt__2048, OpenAPI_logging_interval_nr_mdt__3072, OpenAPI_logging_interval_nr_mdt__4096, OpenAPI_logging_interval_nr_mdt__6144, OpenAPI_logging_interval_nr_mdt__320, OpenAPI_logging_interval_nr_mdt__640, OpenAPI_logging_interval_nr_mdt_infinity } OpenAPI_logging_interval_nr_mdt_e; + +char* OpenAPI_logging_interval_nr_mdt_ToString(OpenAPI_logging_interval_nr_mdt_e logging_interval_nr_mdt); + +OpenAPI_logging_interval_nr_mdt_e OpenAPI_logging_interval_nr_mdt_FromString(char* logging_interval_nr_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_logging_interval_nr_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/loss_connectivity_cfg.c b/lib/sbi/openapi/model/loss_connectivity_cfg.c new file mode 100644 index 000000000..9464f018d --- /dev/null +++ b/lib/sbi/openapi/model/loss_connectivity_cfg.c @@ -0,0 +1,104 @@ + +#include +#include +#include +#include "loss_connectivity_cfg.h" + +OpenAPI_loss_connectivity_cfg_t *OpenAPI_loss_connectivity_cfg_create( + int max_detection_time + ) +{ + OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg_local_var = OpenAPI_malloc(sizeof(OpenAPI_loss_connectivity_cfg_t)); + if (!loss_connectivity_cfg_local_var) { + return NULL; + } + loss_connectivity_cfg_local_var->max_detection_time = max_detection_time; + + return loss_connectivity_cfg_local_var; +} + +void OpenAPI_loss_connectivity_cfg_free(OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg) +{ + if (NULL == loss_connectivity_cfg) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(loss_connectivity_cfg); +} + +cJSON *OpenAPI_loss_connectivity_cfg_convertToJSON(OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg) +{ + cJSON *item = NULL; + + if (loss_connectivity_cfg == NULL) { + ogs_error("OpenAPI_loss_connectivity_cfg_convertToJSON() failed [LossConnectivityCfg]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (loss_connectivity_cfg->max_detection_time) { + if (cJSON_AddNumberToObject(item, "maxDetectionTime", loss_connectivity_cfg->max_detection_time) == NULL) { + ogs_error("OpenAPI_loss_connectivity_cfg_convertToJSON() failed [max_detection_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_loss_connectivity_cfg_t *OpenAPI_loss_connectivity_cfg_parseFromJSON(cJSON *loss_connectivity_cfgJSON) +{ + OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg_local_var = NULL; + cJSON *max_detection_time = cJSON_GetObjectItemCaseSensitive(loss_connectivity_cfgJSON, "maxDetectionTime"); + + if (max_detection_time) { + if (!cJSON_IsNumber(max_detection_time)) { + ogs_error("OpenAPI_loss_connectivity_cfg_parseFromJSON() failed [max_detection_time]"); + goto end; + } + } + + loss_connectivity_cfg_local_var = OpenAPI_loss_connectivity_cfg_create ( + max_detection_time ? max_detection_time->valuedouble : 0 + ); + + return loss_connectivity_cfg_local_var; +end: + return NULL; +} + +OpenAPI_loss_connectivity_cfg_t *OpenAPI_loss_connectivity_cfg_copy(OpenAPI_loss_connectivity_cfg_t *dst, OpenAPI_loss_connectivity_cfg_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_loss_connectivity_cfg_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_loss_connectivity_cfg_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_loss_connectivity_cfg_free(dst); + dst = OpenAPI_loss_connectivity_cfg_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/loss_connectivity_cfg.h b/lib/sbi/openapi/model/loss_connectivity_cfg.h new file mode 100644 index 000000000..ce3260a6c --- /dev/null +++ b/lib/sbi/openapi/model/loss_connectivity_cfg.h @@ -0,0 +1,38 @@ +/* + * loss_connectivity_cfg.h + * + * + */ + +#ifndef _OpenAPI_loss_connectivity_cfg_H_ +#define _OpenAPI_loss_connectivity_cfg_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_loss_connectivity_cfg_s OpenAPI_loss_connectivity_cfg_t; +typedef struct OpenAPI_loss_connectivity_cfg_s { + int max_detection_time; +} OpenAPI_loss_connectivity_cfg_t; + +OpenAPI_loss_connectivity_cfg_t *OpenAPI_loss_connectivity_cfg_create( + int max_detection_time + ); +void OpenAPI_loss_connectivity_cfg_free(OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg); +OpenAPI_loss_connectivity_cfg_t *OpenAPI_loss_connectivity_cfg_parseFromJSON(cJSON *loss_connectivity_cfgJSON); +cJSON *OpenAPI_loss_connectivity_cfg_convertToJSON(OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg); +OpenAPI_loss_connectivity_cfg_t *OpenAPI_loss_connectivity_cfg_copy(OpenAPI_loss_connectivity_cfg_t *dst, OpenAPI_loss_connectivity_cfg_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_loss_connectivity_cfg_H_ */ + diff --git a/lib/sbi/openapi/model/lte_v2x_auth.c b/lib/sbi/openapi/model/lte_v2x_auth.c index 5f7ab7361..aaa4e556f 100644 --- a/lib/sbi/openapi/model/lte_v2x_auth.c +++ b/lib/sbi/openapi/model/lte_v2x_auth.c @@ -5,8 +5,8 @@ #include "lte_v2x_auth.h" OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_create( - OpenAPI_ue_auth_t *vehicle_ue_auth, - OpenAPI_ue_auth_t *pedestrian_ue_auth + OpenAPI_ue_auth_e vehicle_ue_auth, + OpenAPI_ue_auth_e pedestrian_ue_auth ) { OpenAPI_lte_v2x_auth_t *lte_v2x_auth_local_var = OpenAPI_malloc(sizeof(OpenAPI_lte_v2x_auth_t)); @@ -25,8 +25,6 @@ void OpenAPI_lte_v2x_auth_free(OpenAPI_lte_v2x_auth_t *lte_v2x_auth) return; } OpenAPI_lnode_t *node; - OpenAPI_ue_auth_free(lte_v2x_auth->vehicle_ue_auth); - OpenAPI_ue_auth_free(lte_v2x_auth->pedestrian_ue_auth); ogs_free(lte_v2x_auth); } @@ -41,26 +39,14 @@ cJSON *OpenAPI_lte_v2x_auth_convertToJSON(OpenAPI_lte_v2x_auth_t *lte_v2x_auth) item = cJSON_CreateObject(); if (lte_v2x_auth->vehicle_ue_auth) { - cJSON *vehicle_ue_auth_local_JSON = OpenAPI_ue_auth_convertToJSON(lte_v2x_auth->vehicle_ue_auth); - if (vehicle_ue_auth_local_JSON == NULL) { - ogs_error("OpenAPI_lte_v2x_auth_convertToJSON() failed [vehicle_ue_auth]"); - goto end; - } - cJSON_AddItemToObject(item, "vehicleUeAuth", vehicle_ue_auth_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "vehicleUeAuth", OpenAPI_ue_auth_ToString(lte_v2x_auth->vehicle_ue_auth)) == NULL) { ogs_error("OpenAPI_lte_v2x_auth_convertToJSON() failed [vehicle_ue_auth]"); goto end; } } if (lte_v2x_auth->pedestrian_ue_auth) { - cJSON *pedestrian_ue_auth_local_JSON = OpenAPI_ue_auth_convertToJSON(lte_v2x_auth->pedestrian_ue_auth); - if (pedestrian_ue_auth_local_JSON == NULL) { - ogs_error("OpenAPI_lte_v2x_auth_convertToJSON() failed [pedestrian_ue_auth]"); - goto end; - } - cJSON_AddItemToObject(item, "pedestrianUeAuth", pedestrian_ue_auth_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "pedestrianUeAuth", OpenAPI_ue_auth_ToString(lte_v2x_auth->pedestrian_ue_auth)) == NULL) { ogs_error("OpenAPI_lte_v2x_auth_convertToJSON() failed [pedestrian_ue_auth]"); goto end; } @@ -75,21 +61,29 @@ OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_parseFromJSON(cJSON *lte_v2x_authJS OpenAPI_lte_v2x_auth_t *lte_v2x_auth_local_var = NULL; cJSON *vehicle_ue_auth = cJSON_GetObjectItemCaseSensitive(lte_v2x_authJSON, "vehicleUeAuth"); - OpenAPI_ue_auth_t *vehicle_ue_auth_local_nonprim = NULL; + OpenAPI_ue_auth_e vehicle_ue_authVariable; if (vehicle_ue_auth) { - vehicle_ue_auth_local_nonprim = OpenAPI_ue_auth_parseFromJSON(vehicle_ue_auth); + if (!cJSON_IsString(vehicle_ue_auth)) { + ogs_error("OpenAPI_lte_v2x_auth_parseFromJSON() failed [vehicle_ue_auth]"); + goto end; + } + vehicle_ue_authVariable = OpenAPI_ue_auth_FromString(vehicle_ue_auth->valuestring); } cJSON *pedestrian_ue_auth = cJSON_GetObjectItemCaseSensitive(lte_v2x_authJSON, "pedestrianUeAuth"); - OpenAPI_ue_auth_t *pedestrian_ue_auth_local_nonprim = NULL; + OpenAPI_ue_auth_e pedestrian_ue_authVariable; if (pedestrian_ue_auth) { - pedestrian_ue_auth_local_nonprim = OpenAPI_ue_auth_parseFromJSON(pedestrian_ue_auth); + if (!cJSON_IsString(pedestrian_ue_auth)) { + ogs_error("OpenAPI_lte_v2x_auth_parseFromJSON() failed [pedestrian_ue_auth]"); + goto end; + } + pedestrian_ue_authVariable = OpenAPI_ue_auth_FromString(pedestrian_ue_auth->valuestring); } lte_v2x_auth_local_var = OpenAPI_lte_v2x_auth_create ( - vehicle_ue_auth ? vehicle_ue_auth_local_nonprim : NULL, - pedestrian_ue_auth ? pedestrian_ue_auth_local_nonprim : NULL + vehicle_ue_auth ? vehicle_ue_authVariable : 0, + pedestrian_ue_auth ? pedestrian_ue_authVariable : 0 ); return lte_v2x_auth_local_var; diff --git a/lib/sbi/openapi/model/lte_v2x_auth.h b/lib/sbi/openapi/model/lte_v2x_auth.h index 657703157..bb5d06b32 100644 --- a/lib/sbi/openapi/model/lte_v2x_auth.h +++ b/lib/sbi/openapi/model/lte_v2x_auth.h @@ -20,13 +20,13 @@ extern "C" { typedef struct OpenAPI_lte_v2x_auth_s OpenAPI_lte_v2x_auth_t; typedef struct OpenAPI_lte_v2x_auth_s { - struct OpenAPI_ue_auth_s *vehicle_ue_auth; - struct OpenAPI_ue_auth_s *pedestrian_ue_auth; + OpenAPI_ue_auth_e vehicle_ue_auth; + OpenAPI_ue_auth_e pedestrian_ue_auth; } OpenAPI_lte_v2x_auth_t; OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_create( - OpenAPI_ue_auth_t *vehicle_ue_auth, - OpenAPI_ue_auth_t *pedestrian_ue_auth + OpenAPI_ue_auth_e vehicle_ue_auth, + OpenAPI_ue_auth_e pedestrian_ue_auth ); void OpenAPI_lte_v2x_auth_free(OpenAPI_lte_v2x_auth_t *lte_v2x_auth); OpenAPI_lte_v2x_auth_t *OpenAPI_lte_v2x_auth_parseFromJSON(cJSON *lte_v2x_authJSON); diff --git a/lib/sbi/openapi/model/maximum_latency.c b/lib/sbi/openapi/model/maximum_latency.c deleted file mode 100644 index 6ba39d834..000000000 --- a/lib/sbi/openapi/model/maximum_latency.c +++ /dev/null @@ -1,173 +0,0 @@ - -#include -#include -#include -#include "maximum_latency.h" - -OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_create( - int maximum_latency, - OpenAPI_snssai_t *snssai, - char *dnn, - char *validity_time - ) -{ - OpenAPI_maximum_latency_t *maximum_latency_local_var = OpenAPI_malloc(sizeof(OpenAPI_maximum_latency_t)); - if (!maximum_latency_local_var) { - return NULL; - } - maximum_latency_local_var->maximum_latency = maximum_latency; - maximum_latency_local_var->snssai = snssai; - maximum_latency_local_var->dnn = dnn; - maximum_latency_local_var->validity_time = validity_time; - - return maximum_latency_local_var; -} - -void OpenAPI_maximum_latency_free(OpenAPI_maximum_latency_t *maximum_latency) -{ - if (NULL == maximum_latency) { - return; - } - OpenAPI_lnode_t *node; - OpenAPI_snssai_free(maximum_latency->snssai); - ogs_free(maximum_latency->dnn); - ogs_free(maximum_latency->validity_time); - ogs_free(maximum_latency); -} - -cJSON *OpenAPI_maximum_latency_convertToJSON(OpenAPI_maximum_latency_t *maximum_latency) -{ - cJSON *item = NULL; - - if (maximum_latency == NULL) { - ogs_error("OpenAPI_maximum_latency_convertToJSON() failed [MaximumLatency]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!maximum_latency->maximum_latency) { - ogs_error("OpenAPI_maximum_latency_convertToJSON() failed [maximum_latency]"); - goto end; - } - if (cJSON_AddNumberToObject(item, "maximumLatency", maximum_latency->maximum_latency) == NULL) { - ogs_error("OpenAPI_maximum_latency_convertToJSON() failed [maximum_latency]"); - goto end; - } - - if (maximum_latency->snssai) { - cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(maximum_latency->snssai); - if (snssai_local_JSON == NULL) { - ogs_error("OpenAPI_maximum_latency_convertToJSON() failed [snssai]"); - goto end; - } - cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_maximum_latency_convertToJSON() failed [snssai]"); - goto end; - } - } - - if (maximum_latency->dnn) { - if (cJSON_AddStringToObject(item, "dnn", maximum_latency->dnn) == NULL) { - ogs_error("OpenAPI_maximum_latency_convertToJSON() failed [dnn]"); - goto end; - } - } - - if (maximum_latency->validity_time) { - if (cJSON_AddStringToObject(item, "validityTime", maximum_latency->validity_time) == NULL) { - ogs_error("OpenAPI_maximum_latency_convertToJSON() failed [validity_time]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_parseFromJSON(cJSON *maximum_latencyJSON) -{ - OpenAPI_maximum_latency_t *maximum_latency_local_var = NULL; - cJSON *maximum_latency = cJSON_GetObjectItemCaseSensitive(maximum_latencyJSON, "maximumLatency"); - if (!maximum_latency) { - ogs_error("OpenAPI_maximum_latency_parseFromJSON() failed [maximum_latency]"); - goto end; - } - - - if (!cJSON_IsNumber(maximum_latency)) { - ogs_error("OpenAPI_maximum_latency_parseFromJSON() failed [maximum_latency]"); - goto end; - } - - cJSON *snssai = cJSON_GetObjectItemCaseSensitive(maximum_latencyJSON, "snssai"); - - OpenAPI_snssai_t *snssai_local_nonprim = NULL; - if (snssai) { - snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); - } - - cJSON *dnn = cJSON_GetObjectItemCaseSensitive(maximum_latencyJSON, "dnn"); - - if (dnn) { - if (!cJSON_IsString(dnn)) { - ogs_error("OpenAPI_maximum_latency_parseFromJSON() failed [dnn]"); - goto end; - } - } - - cJSON *validity_time = cJSON_GetObjectItemCaseSensitive(maximum_latencyJSON, "validityTime"); - - if (validity_time) { - if (!cJSON_IsString(validity_time)) { - ogs_error("OpenAPI_maximum_latency_parseFromJSON() failed [validity_time]"); - goto end; - } - } - - maximum_latency_local_var = OpenAPI_maximum_latency_create ( - maximum_latency->valuedouble, - snssai ? snssai_local_nonprim : NULL, - dnn ? ogs_strdup(dnn->valuestring) : NULL, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL - ); - - return maximum_latency_local_var; -end: - return NULL; -} - -OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_copy(OpenAPI_maximum_latency_t *dst, OpenAPI_maximum_latency_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_maximum_latency_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_maximum_latency_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_maximum_latency_free(dst); - dst = OpenAPI_maximum_latency_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/maximum_latency.h b/lib/sbi/openapi/model/maximum_latency.h deleted file mode 100644 index 54c8a7efe..000000000 --- a/lib/sbi/openapi/model/maximum_latency.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * maximum_latency.h - * - * - */ - -#ifndef _OpenAPI_maximum_latency_H_ -#define _OpenAPI_maximum_latency_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "snssai.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_maximum_latency_s OpenAPI_maximum_latency_t; -typedef struct OpenAPI_maximum_latency_s { - int maximum_latency; - struct OpenAPI_snssai_s *snssai; - char *dnn; - char *validity_time; -} OpenAPI_maximum_latency_t; - -OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_create( - int maximum_latency, - OpenAPI_snssai_t *snssai, - char *dnn, - char *validity_time - ); -void OpenAPI_maximum_latency_free(OpenAPI_maximum_latency_t *maximum_latency); -OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_parseFromJSON(cJSON *maximum_latencyJSON); -cJSON *OpenAPI_maximum_latency_convertToJSON(OpenAPI_maximum_latency_t *maximum_latency); -OpenAPI_maximum_latency_t *OpenAPI_maximum_latency_copy(OpenAPI_maximum_latency_t *dst, OpenAPI_maximum_latency_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_maximum_latency_H_ */ - diff --git a/lib/sbi/openapi/model/maximum_response_time.c b/lib/sbi/openapi/model/maximum_response_time.c deleted file mode 100644 index 1203fc2c9..000000000 --- a/lib/sbi/openapi/model/maximum_response_time.c +++ /dev/null @@ -1,173 +0,0 @@ - -#include -#include -#include -#include "maximum_response_time.h" - -OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_create( - int maximum_response_time, - OpenAPI_snssai_t *snssai, - char *dnn, - char *validity_time - ) -{ - OpenAPI_maximum_response_time_t *maximum_response_time_local_var = OpenAPI_malloc(sizeof(OpenAPI_maximum_response_time_t)); - if (!maximum_response_time_local_var) { - return NULL; - } - maximum_response_time_local_var->maximum_response_time = maximum_response_time; - maximum_response_time_local_var->snssai = snssai; - maximum_response_time_local_var->dnn = dnn; - maximum_response_time_local_var->validity_time = validity_time; - - return maximum_response_time_local_var; -} - -void OpenAPI_maximum_response_time_free(OpenAPI_maximum_response_time_t *maximum_response_time) -{ - if (NULL == maximum_response_time) { - return; - } - OpenAPI_lnode_t *node; - OpenAPI_snssai_free(maximum_response_time->snssai); - ogs_free(maximum_response_time->dnn); - ogs_free(maximum_response_time->validity_time); - ogs_free(maximum_response_time); -} - -cJSON *OpenAPI_maximum_response_time_convertToJSON(OpenAPI_maximum_response_time_t *maximum_response_time) -{ - cJSON *item = NULL; - - if (maximum_response_time == NULL) { - ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed [MaximumResponseTime]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!maximum_response_time->maximum_response_time) { - ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed [maximum_response_time]"); - goto end; - } - if (cJSON_AddNumberToObject(item, "maximumResponseTime", maximum_response_time->maximum_response_time) == NULL) { - ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed [maximum_response_time]"); - goto end; - } - - if (maximum_response_time->snssai) { - cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(maximum_response_time->snssai); - if (snssai_local_JSON == NULL) { - ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed [snssai]"); - goto end; - } - cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed [snssai]"); - goto end; - } - } - - if (maximum_response_time->dnn) { - if (cJSON_AddStringToObject(item, "dnn", maximum_response_time->dnn) == NULL) { - ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed [dnn]"); - goto end; - } - } - - if (maximum_response_time->validity_time) { - if (cJSON_AddStringToObject(item, "validityTime", maximum_response_time->validity_time) == NULL) { - ogs_error("OpenAPI_maximum_response_time_convertToJSON() failed [validity_time]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_parseFromJSON(cJSON *maximum_response_timeJSON) -{ - OpenAPI_maximum_response_time_t *maximum_response_time_local_var = NULL; - cJSON *maximum_response_time = cJSON_GetObjectItemCaseSensitive(maximum_response_timeJSON, "maximumResponseTime"); - if (!maximum_response_time) { - ogs_error("OpenAPI_maximum_response_time_parseFromJSON() failed [maximum_response_time]"); - goto end; - } - - - if (!cJSON_IsNumber(maximum_response_time)) { - ogs_error("OpenAPI_maximum_response_time_parseFromJSON() failed [maximum_response_time]"); - goto end; - } - - cJSON *snssai = cJSON_GetObjectItemCaseSensitive(maximum_response_timeJSON, "snssai"); - - OpenAPI_snssai_t *snssai_local_nonprim = NULL; - if (snssai) { - snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); - } - - cJSON *dnn = cJSON_GetObjectItemCaseSensitive(maximum_response_timeJSON, "dnn"); - - if (dnn) { - if (!cJSON_IsString(dnn)) { - ogs_error("OpenAPI_maximum_response_time_parseFromJSON() failed [dnn]"); - goto end; - } - } - - cJSON *validity_time = cJSON_GetObjectItemCaseSensitive(maximum_response_timeJSON, "validityTime"); - - if (validity_time) { - if (!cJSON_IsString(validity_time)) { - ogs_error("OpenAPI_maximum_response_time_parseFromJSON() failed [validity_time]"); - goto end; - } - } - - maximum_response_time_local_var = OpenAPI_maximum_response_time_create ( - maximum_response_time->valuedouble, - snssai ? snssai_local_nonprim : NULL, - dnn ? ogs_strdup(dnn->valuestring) : NULL, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL - ); - - return maximum_response_time_local_var; -end: - return NULL; -} - -OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_copy(OpenAPI_maximum_response_time_t *dst, OpenAPI_maximum_response_time_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_maximum_response_time_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_maximum_response_time_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_maximum_response_time_free(dst); - dst = OpenAPI_maximum_response_time_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/maximum_response_time.h b/lib/sbi/openapi/model/maximum_response_time.h deleted file mode 100644 index 86e858b63..000000000 --- a/lib/sbi/openapi/model/maximum_response_time.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * maximum_response_time.h - * - * - */ - -#ifndef _OpenAPI_maximum_response_time_H_ -#define _OpenAPI_maximum_response_time_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "snssai.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_maximum_response_time_s OpenAPI_maximum_response_time_t; -typedef struct OpenAPI_maximum_response_time_s { - int maximum_response_time; - struct OpenAPI_snssai_s *snssai; - char *dnn; - char *validity_time; -} OpenAPI_maximum_response_time_t; - -OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_create( - int maximum_response_time, - OpenAPI_snssai_t *snssai, - char *dnn, - char *validity_time - ); -void OpenAPI_maximum_response_time_free(OpenAPI_maximum_response_time_t *maximum_response_time); -OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_parseFromJSON(cJSON *maximum_response_timeJSON); -cJSON *OpenAPI_maximum_response_time_convertToJSON(OpenAPI_maximum_response_time_t *maximum_response_time); -OpenAPI_maximum_response_time_t *OpenAPI_maximum_response_time_copy(OpenAPI_maximum_response_time_t *dst, OpenAPI_maximum_response_time_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_maximum_response_time_H_ */ - diff --git a/lib/sbi/openapi/model/mbsfn_area.c b/lib/sbi/openapi/model/mbsfn_area.c new file mode 100644 index 000000000..fdebac259 --- /dev/null +++ b/lib/sbi/openapi/model/mbsfn_area.c @@ -0,0 +1,123 @@ + +#include +#include +#include +#include "mbsfn_area.h" + +OpenAPI_mbsfn_area_t *OpenAPI_mbsfn_area_create( + int mbsfn_area_id, + int carrier_frequency + ) +{ + OpenAPI_mbsfn_area_t *mbsfn_area_local_var = OpenAPI_malloc(sizeof(OpenAPI_mbsfn_area_t)); + if (!mbsfn_area_local_var) { + return NULL; + } + mbsfn_area_local_var->mbsfn_area_id = mbsfn_area_id; + mbsfn_area_local_var->carrier_frequency = carrier_frequency; + + return mbsfn_area_local_var; +} + +void OpenAPI_mbsfn_area_free(OpenAPI_mbsfn_area_t *mbsfn_area) +{ + if (NULL == mbsfn_area) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(mbsfn_area); +} + +cJSON *OpenAPI_mbsfn_area_convertToJSON(OpenAPI_mbsfn_area_t *mbsfn_area) +{ + cJSON *item = NULL; + + if (mbsfn_area == NULL) { + ogs_error("OpenAPI_mbsfn_area_convertToJSON() failed [MbsfnArea]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbsfn_area->mbsfn_area_id) { + if (cJSON_AddNumberToObject(item, "mbsfnAreaId", mbsfn_area->mbsfn_area_id) == NULL) { + ogs_error("OpenAPI_mbsfn_area_convertToJSON() failed [mbsfn_area_id]"); + goto end; + } + } + + if (mbsfn_area->carrier_frequency) { + if (cJSON_AddNumberToObject(item, "carrierFrequency", mbsfn_area->carrier_frequency) == NULL) { + ogs_error("OpenAPI_mbsfn_area_convertToJSON() failed [carrier_frequency]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_mbsfn_area_t *OpenAPI_mbsfn_area_parseFromJSON(cJSON *mbsfn_areaJSON) +{ + OpenAPI_mbsfn_area_t *mbsfn_area_local_var = NULL; + cJSON *mbsfn_area_id = cJSON_GetObjectItemCaseSensitive(mbsfn_areaJSON, "mbsfnAreaId"); + + if (mbsfn_area_id) { + if (!cJSON_IsNumber(mbsfn_area_id)) { + ogs_error("OpenAPI_mbsfn_area_parseFromJSON() failed [mbsfn_area_id]"); + goto end; + } + } + + cJSON *carrier_frequency = cJSON_GetObjectItemCaseSensitive(mbsfn_areaJSON, "carrierFrequency"); + + if (carrier_frequency) { + if (!cJSON_IsNumber(carrier_frequency)) { + ogs_error("OpenAPI_mbsfn_area_parseFromJSON() failed [carrier_frequency]"); + goto end; + } + } + + mbsfn_area_local_var = OpenAPI_mbsfn_area_create ( + mbsfn_area_id ? mbsfn_area_id->valuedouble : 0, + carrier_frequency ? carrier_frequency->valuedouble : 0 + ); + + return mbsfn_area_local_var; +end: + return NULL; +} + +OpenAPI_mbsfn_area_t *OpenAPI_mbsfn_area_copy(OpenAPI_mbsfn_area_t *dst, OpenAPI_mbsfn_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbsfn_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbsfn_area_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_mbsfn_area_free(dst); + dst = OpenAPI_mbsfn_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbsfn_area.h b/lib/sbi/openapi/model/mbsfn_area.h new file mode 100644 index 000000000..1d47772f8 --- /dev/null +++ b/lib/sbi/openapi/model/mbsfn_area.h @@ -0,0 +1,40 @@ +/* + * mbsfn_area.h + * + * + */ + +#ifndef _OpenAPI_mbsfn_area_H_ +#define _OpenAPI_mbsfn_area_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbsfn_area_s OpenAPI_mbsfn_area_t; +typedef struct OpenAPI_mbsfn_area_s { + int mbsfn_area_id; + int carrier_frequency; +} OpenAPI_mbsfn_area_t; + +OpenAPI_mbsfn_area_t *OpenAPI_mbsfn_area_create( + int mbsfn_area_id, + int carrier_frequency + ); +void OpenAPI_mbsfn_area_free(OpenAPI_mbsfn_area_t *mbsfn_area); +OpenAPI_mbsfn_area_t *OpenAPI_mbsfn_area_parseFromJSON(cJSON *mbsfn_areaJSON); +cJSON *OpenAPI_mbsfn_area_convertToJSON(OpenAPI_mbsfn_area_t *mbsfn_area); +OpenAPI_mbsfn_area_t *OpenAPI_mbsfn_area_copy(OpenAPI_mbsfn_area_t *dst, OpenAPI_mbsfn_area_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbsfn_area_H_ */ + diff --git a/lib/sbi/openapi/model/mdt_configuration.c b/lib/sbi/openapi/model/mdt_configuration.c new file mode 100644 index 000000000..0c10002ff --- /dev/null +++ b/lib/sbi/openapi/model/mdt_configuration.c @@ -0,0 +1,818 @@ + +#include +#include +#include +#include "mdt_configuration.h" + +OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_create( + OpenAPI_job_type_e job_type, + OpenAPI_report_type_mdt_e report_type, + OpenAPI_area_scope_t *area_scope, + OpenAPI_list_t *measurement_lte_list, + OpenAPI_list_t *measurement_nr_list, + OpenAPI_list_t *sensor_measurement_list, + OpenAPI_list_t *reporting_trigger_list, + OpenAPI_report_interval_mdt_e report_interval, + OpenAPI_report_interval_nr_mdt_e report_interval_nr, + OpenAPI_report_amount_mdt_e report_amount, + int event_threshold_rsrp, + int event_threshold_rsrp_nr, + int event_threshold_rsrq, + int event_threshold_rsrq_nr, + OpenAPI_list_t *event_list, + OpenAPI_logging_interval_mdt_e logging_interval, + OpenAPI_logging_interval_nr_mdt_e logging_interval_nr, + OpenAPI_logging_duration_mdt_e logging_duration, + OpenAPI_logging_duration_nr_mdt_e logging_duration_nr, + OpenAPI_positioning_method_mdt_e positioning_method, + OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lte, + OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nr, + OpenAPI_measurement_period_lte_mdt_e measurement_period_lte, + OpenAPI_list_t *mdt_allowed_plmn_id_list, + OpenAPI_list_t *mbsfn_area_list, + OpenAPI_list_t *inter_freq_target_list + ) +{ + OpenAPI_mdt_configuration_t *mdt_configuration_local_var = OpenAPI_malloc(sizeof(OpenAPI_mdt_configuration_t)); + if (!mdt_configuration_local_var) { + return NULL; + } + mdt_configuration_local_var->job_type = job_type; + mdt_configuration_local_var->report_type = report_type; + mdt_configuration_local_var->area_scope = area_scope; + mdt_configuration_local_var->measurement_lte_list = measurement_lte_list; + mdt_configuration_local_var->measurement_nr_list = measurement_nr_list; + mdt_configuration_local_var->sensor_measurement_list = sensor_measurement_list; + mdt_configuration_local_var->reporting_trigger_list = reporting_trigger_list; + mdt_configuration_local_var->report_interval = report_interval; + mdt_configuration_local_var->report_interval_nr = report_interval_nr; + mdt_configuration_local_var->report_amount = report_amount; + mdt_configuration_local_var->event_threshold_rsrp = event_threshold_rsrp; + mdt_configuration_local_var->event_threshold_rsrp_nr = event_threshold_rsrp_nr; + mdt_configuration_local_var->event_threshold_rsrq = event_threshold_rsrq; + mdt_configuration_local_var->event_threshold_rsrq_nr = event_threshold_rsrq_nr; + mdt_configuration_local_var->event_list = event_list; + mdt_configuration_local_var->logging_interval = logging_interval; + mdt_configuration_local_var->logging_interval_nr = logging_interval_nr; + mdt_configuration_local_var->logging_duration = logging_duration; + mdt_configuration_local_var->logging_duration_nr = logging_duration_nr; + mdt_configuration_local_var->positioning_method = positioning_method; + mdt_configuration_local_var->collection_period_rmm_lte = collection_period_rmm_lte; + mdt_configuration_local_var->collection_period_rmm_nr = collection_period_rmm_nr; + mdt_configuration_local_var->measurement_period_lte = measurement_period_lte; + mdt_configuration_local_var->mdt_allowed_plmn_id_list = mdt_allowed_plmn_id_list; + mdt_configuration_local_var->mbsfn_area_list = mbsfn_area_list; + mdt_configuration_local_var->inter_freq_target_list = inter_freq_target_list; + + return mdt_configuration_local_var; +} + +void OpenAPI_mdt_configuration_free(OpenAPI_mdt_configuration_t *mdt_configuration) +{ + if (NULL == mdt_configuration) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_area_scope_free(mdt_configuration->area_scope); + OpenAPI_list_free(mdt_configuration->measurement_lte_list); + OpenAPI_list_free(mdt_configuration->measurement_nr_list); + OpenAPI_list_free(mdt_configuration->sensor_measurement_list); + OpenAPI_list_free(mdt_configuration->reporting_trigger_list); + OpenAPI_list_free(mdt_configuration->event_list); + OpenAPI_list_for_each(mdt_configuration->mdt_allowed_plmn_id_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(mdt_configuration->mdt_allowed_plmn_id_list); + OpenAPI_list_for_each(mdt_configuration->mbsfn_area_list, node) { + OpenAPI_mbsfn_area_free(node->data); + } + OpenAPI_list_free(mdt_configuration->mbsfn_area_list); + OpenAPI_list_for_each(mdt_configuration->inter_freq_target_list, node) { + OpenAPI_inter_freq_target_info_free(node->data); + } + OpenAPI_list_free(mdt_configuration->inter_freq_target_list); + ogs_free(mdt_configuration); +} + +cJSON *OpenAPI_mdt_configuration_convertToJSON(OpenAPI_mdt_configuration_t *mdt_configuration) +{ + cJSON *item = NULL; + + if (mdt_configuration == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [MdtConfiguration]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!mdt_configuration->job_type) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [job_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "jobType", OpenAPI_job_type_ToString(mdt_configuration->job_type)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [job_type]"); + goto end; + } + + if (mdt_configuration->report_type) { + if (cJSON_AddStringToObject(item, "reportType", OpenAPI_report_type_mdt_ToString(mdt_configuration->report_type)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_type]"); + goto end; + } + } + + if (mdt_configuration->area_scope) { + cJSON *area_scope_local_JSON = OpenAPI_area_scope_convertToJSON(mdt_configuration->area_scope); + if (area_scope_local_JSON == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [area_scope]"); + goto end; + } + cJSON_AddItemToObject(item, "areaScope", area_scope_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [area_scope]"); + goto end; + } + } + + if (mdt_configuration->measurement_lte_list) { + cJSON *measurement_lte_list = cJSON_AddArrayToObject(item, "measurementLteList"); + if (measurement_lte_list == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_lte_list]"); + goto end; + } + OpenAPI_lnode_t *measurement_lte_list_node; + OpenAPI_list_for_each(mdt_configuration->measurement_lte_list, measurement_lte_list_node) { + if (cJSON_AddStringToObject(measurement_lte_list, "", OpenAPI_measurement_lte_for_mdt_ToString((OpenAPI_measurement_lte_for_mdt_e)measurement_lte_list_node->data)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_lte_list]"); + goto end; + } + } + } + + if (mdt_configuration->measurement_nr_list) { + cJSON *measurement_nr_list = cJSON_AddArrayToObject(item, "measurementNrList"); + if (measurement_nr_list == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_nr_list]"); + goto end; + } + OpenAPI_lnode_t *measurement_nr_list_node; + OpenAPI_list_for_each(mdt_configuration->measurement_nr_list, measurement_nr_list_node) { + if (cJSON_AddStringToObject(measurement_nr_list, "", OpenAPI_measurement_nr_for_mdt_ToString((OpenAPI_measurement_nr_for_mdt_e)measurement_nr_list_node->data)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_nr_list]"); + goto end; + } + } + } + + if (mdt_configuration->sensor_measurement_list) { + cJSON *sensor_measurement_list = cJSON_AddArrayToObject(item, "sensorMeasurementList"); + if (sensor_measurement_list == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [sensor_measurement_list]"); + goto end; + } + OpenAPI_lnode_t *sensor_measurement_list_node; + OpenAPI_list_for_each(mdt_configuration->sensor_measurement_list, sensor_measurement_list_node) { + if (cJSON_AddStringToObject(sensor_measurement_list, "", OpenAPI_sensor_measurement_ToString((OpenAPI_sensor_measurement_e)sensor_measurement_list_node->data)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [sensor_measurement_list]"); + goto end; + } + } + } + + if (mdt_configuration->reporting_trigger_list) { + cJSON *reporting_trigger_list = cJSON_AddArrayToObject(item, "reportingTriggerList"); + if (reporting_trigger_list == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [reporting_trigger_list]"); + goto end; + } + OpenAPI_lnode_t *reporting_trigger_list_node; + OpenAPI_list_for_each(mdt_configuration->reporting_trigger_list, reporting_trigger_list_node) { + if (cJSON_AddStringToObject(reporting_trigger_list, "", OpenAPI_reporting_trigger_ToString((OpenAPI_reporting_trigger_e)reporting_trigger_list_node->data)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [reporting_trigger_list]"); + goto end; + } + } + } + + if (mdt_configuration->report_interval) { + if (cJSON_AddStringToObject(item, "reportInterval", OpenAPI_report_interval_mdt_ToString(mdt_configuration->report_interval)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_interval]"); + goto end; + } + } + + if (mdt_configuration->report_interval_nr) { + if (cJSON_AddStringToObject(item, "reportIntervalNr", OpenAPI_report_interval_nr_mdt_ToString(mdt_configuration->report_interval_nr)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_interval_nr]"); + goto end; + } + } + + if (mdt_configuration->report_amount) { + if (cJSON_AddStringToObject(item, "reportAmount", OpenAPI_report_amount_mdt_ToString(mdt_configuration->report_amount)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount]"); + goto end; + } + } + + if (mdt_configuration->event_threshold_rsrp) { + if (cJSON_AddNumberToObject(item, "eventThresholdRsrp", mdt_configuration->event_threshold_rsrp) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrp]"); + goto end; + } + } + + if (mdt_configuration->event_threshold_rsrp_nr) { + if (cJSON_AddNumberToObject(item, "eventThresholdRsrpNr", mdt_configuration->event_threshold_rsrp_nr) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrp_nr]"); + goto end; + } + } + + if (mdt_configuration->event_threshold_rsrq) { + if (cJSON_AddNumberToObject(item, "eventThresholdRsrq", mdt_configuration->event_threshold_rsrq) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrq]"); + goto end; + } + } + + if (mdt_configuration->event_threshold_rsrq_nr) { + if (cJSON_AddNumberToObject(item, "eventThresholdRsrqNr", mdt_configuration->event_threshold_rsrq_nr) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrq_nr]"); + goto end; + } + } + + if (mdt_configuration->event_list) { + cJSON *event_list = cJSON_AddArrayToObject(item, "eventList"); + if (event_list == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_list]"); + goto end; + } + OpenAPI_lnode_t *event_list_node; + OpenAPI_list_for_each(mdt_configuration->event_list, event_list_node) { + if (cJSON_AddStringToObject(event_list, "", OpenAPI_event_for_mdt_ToString((OpenAPI_event_for_mdt_e)event_list_node->data)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_list]"); + goto end; + } + } + } + + if (mdt_configuration->logging_interval) { + if (cJSON_AddStringToObject(item, "loggingInterval", OpenAPI_logging_interval_mdt_ToString(mdt_configuration->logging_interval)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_interval]"); + goto end; + } + } + + if (mdt_configuration->logging_interval_nr) { + if (cJSON_AddStringToObject(item, "loggingIntervalNr", OpenAPI_logging_interval_nr_mdt_ToString(mdt_configuration->logging_interval_nr)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_interval_nr]"); + goto end; + } + } + + if (mdt_configuration->logging_duration) { + if (cJSON_AddStringToObject(item, "loggingDuration", OpenAPI_logging_duration_mdt_ToString(mdt_configuration->logging_duration)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_duration]"); + goto end; + } + } + + if (mdt_configuration->logging_duration_nr) { + if (cJSON_AddStringToObject(item, "loggingDurationNr", OpenAPI_logging_duration_nr_mdt_ToString(mdt_configuration->logging_duration_nr)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_duration_nr]"); + goto end; + } + } + + if (mdt_configuration->positioning_method) { + if (cJSON_AddStringToObject(item, "positioningMethod", OpenAPI_positioning_method_mdt_ToString(mdt_configuration->positioning_method)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [positioning_method]"); + goto end; + } + } + + if (mdt_configuration->collection_period_rmm_lte) { + if (cJSON_AddStringToObject(item, "collectionPeriodRmmLte", OpenAPI_collection_period_rmm_lte_mdt_ToString(mdt_configuration->collection_period_rmm_lte)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [collection_period_rmm_lte]"); + goto end; + } + } + + if (mdt_configuration->collection_period_rmm_nr) { + if (cJSON_AddStringToObject(item, "collectionPeriodRmmNr", OpenAPI_collection_period_rmm_nr_mdt_ToString(mdt_configuration->collection_period_rmm_nr)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [collection_period_rmm_nr]"); + goto end; + } + } + + if (mdt_configuration->measurement_period_lte) { + if (cJSON_AddStringToObject(item, "measurementPeriodLte", OpenAPI_measurement_period_lte_mdt_ToString(mdt_configuration->measurement_period_lte)) == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_period_lte]"); + goto end; + } + } + + if (mdt_configuration->mdt_allowed_plmn_id_list) { + cJSON *mdt_allowed_plmn_id_listList = cJSON_AddArrayToObject(item, "mdtAllowedPlmnIdList"); + if (mdt_allowed_plmn_id_listList == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mdt_allowed_plmn_id_list]"); + goto end; + } + + OpenAPI_lnode_t *mdt_allowed_plmn_id_list_node; + if (mdt_configuration->mdt_allowed_plmn_id_list) { + OpenAPI_list_for_each(mdt_configuration->mdt_allowed_plmn_id_list, mdt_allowed_plmn_id_list_node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(mdt_allowed_plmn_id_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mdt_allowed_plmn_id_list]"); + goto end; + } + cJSON_AddItemToArray(mdt_allowed_plmn_id_listList, itemLocal); + } + } + } + + if (mdt_configuration->mbsfn_area_list) { + cJSON *mbsfn_area_listList = cJSON_AddArrayToObject(item, "mbsfnAreaList"); + if (mbsfn_area_listList == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mbsfn_area_list]"); + goto end; + } + + OpenAPI_lnode_t *mbsfn_area_list_node; + if (mdt_configuration->mbsfn_area_list) { + OpenAPI_list_for_each(mdt_configuration->mbsfn_area_list, mbsfn_area_list_node) { + cJSON *itemLocal = OpenAPI_mbsfn_area_convertToJSON(mbsfn_area_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mbsfn_area_list]"); + goto end; + } + cJSON_AddItemToArray(mbsfn_area_listList, itemLocal); + } + } + } + + if (mdt_configuration->inter_freq_target_list) { + cJSON *inter_freq_target_listList = cJSON_AddArrayToObject(item, "interFreqTargetList"); + if (inter_freq_target_listList == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [inter_freq_target_list]"); + goto end; + } + + OpenAPI_lnode_t *inter_freq_target_list_node; + if (mdt_configuration->inter_freq_target_list) { + OpenAPI_list_for_each(mdt_configuration->inter_freq_target_list, inter_freq_target_list_node) { + cJSON *itemLocal = OpenAPI_inter_freq_target_info_convertToJSON(inter_freq_target_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [inter_freq_target_list]"); + goto end; + } + cJSON_AddItemToArray(inter_freq_target_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_parseFromJSON(cJSON *mdt_configurationJSON) +{ + OpenAPI_mdt_configuration_t *mdt_configuration_local_var = NULL; + cJSON *job_type = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "jobType"); + if (!job_type) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [job_type]"); + goto end; + } + + OpenAPI_job_type_e job_typeVariable; + + if (!cJSON_IsString(job_type)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [job_type]"); + goto end; + } + job_typeVariable = OpenAPI_job_type_FromString(job_type->valuestring); + + cJSON *report_type = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportType"); + + OpenAPI_report_type_mdt_e report_typeVariable; + if (report_type) { + if (!cJSON_IsString(report_type)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_type]"); + goto end; + } + report_typeVariable = OpenAPI_report_type_mdt_FromString(report_type->valuestring); + } + + cJSON *area_scope = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "areaScope"); + + OpenAPI_area_scope_t *area_scope_local_nonprim = NULL; + if (area_scope) { + area_scope_local_nonprim = OpenAPI_area_scope_parseFromJSON(area_scope); + } + + cJSON *measurement_lte_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "measurementLteList"); + + OpenAPI_list_t *measurement_lte_listList; + if (measurement_lte_list) { + cJSON *measurement_lte_list_local_nonprimitive; + if (!cJSON_IsArray(measurement_lte_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_lte_list]"); + goto end; + } + + measurement_lte_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(measurement_lte_list_local_nonprimitive, measurement_lte_list ) { + if (!cJSON_IsString(measurement_lte_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_lte_list]"); + goto end; + } + + OpenAPI_list_add(measurement_lte_listList, (void *)OpenAPI_measurement_lte_for_mdt_FromString(measurement_lte_list_local_nonprimitive->valuestring)); + } + } + + cJSON *measurement_nr_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "measurementNrList"); + + OpenAPI_list_t *measurement_nr_listList; + if (measurement_nr_list) { + cJSON *measurement_nr_list_local_nonprimitive; + if (!cJSON_IsArray(measurement_nr_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_nr_list]"); + goto end; + } + + measurement_nr_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(measurement_nr_list_local_nonprimitive, measurement_nr_list ) { + if (!cJSON_IsString(measurement_nr_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_nr_list]"); + goto end; + } + + OpenAPI_list_add(measurement_nr_listList, (void *)OpenAPI_measurement_nr_for_mdt_FromString(measurement_nr_list_local_nonprimitive->valuestring)); + } + } + + cJSON *sensor_measurement_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "sensorMeasurementList"); + + OpenAPI_list_t *sensor_measurement_listList; + if (sensor_measurement_list) { + cJSON *sensor_measurement_list_local_nonprimitive; + if (!cJSON_IsArray(sensor_measurement_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [sensor_measurement_list]"); + goto end; + } + + sensor_measurement_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(sensor_measurement_list_local_nonprimitive, sensor_measurement_list ) { + if (!cJSON_IsString(sensor_measurement_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [sensor_measurement_list]"); + goto end; + } + + OpenAPI_list_add(sensor_measurement_listList, (void *)OpenAPI_sensor_measurement_FromString(sensor_measurement_list_local_nonprimitive->valuestring)); + } + } + + cJSON *reporting_trigger_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportingTriggerList"); + + OpenAPI_list_t *reporting_trigger_listList; + if (reporting_trigger_list) { + cJSON *reporting_trigger_list_local_nonprimitive; + if (!cJSON_IsArray(reporting_trigger_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [reporting_trigger_list]"); + goto end; + } + + reporting_trigger_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reporting_trigger_list_local_nonprimitive, reporting_trigger_list ) { + if (!cJSON_IsString(reporting_trigger_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [reporting_trigger_list]"); + goto end; + } + + OpenAPI_list_add(reporting_trigger_listList, (void *)OpenAPI_reporting_trigger_FromString(reporting_trigger_list_local_nonprimitive->valuestring)); + } + } + + cJSON *report_interval = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportInterval"); + + OpenAPI_report_interval_mdt_e report_intervalVariable; + if (report_interval) { + if (!cJSON_IsString(report_interval)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_interval]"); + goto end; + } + report_intervalVariable = OpenAPI_report_interval_mdt_FromString(report_interval->valuestring); + } + + cJSON *report_interval_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportIntervalNr"); + + OpenAPI_report_interval_nr_mdt_e report_interval_nrVariable; + if (report_interval_nr) { + if (!cJSON_IsString(report_interval_nr)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_interval_nr]"); + goto end; + } + report_interval_nrVariable = OpenAPI_report_interval_nr_mdt_FromString(report_interval_nr->valuestring); + } + + cJSON *report_amount = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportAmount"); + + OpenAPI_report_amount_mdt_e report_amountVariable; + if (report_amount) { + if (!cJSON_IsString(report_amount)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount]"); + goto end; + } + report_amountVariable = OpenAPI_report_amount_mdt_FromString(report_amount->valuestring); + } + + cJSON *event_threshold_rsrp = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrp"); + + if (event_threshold_rsrp) { + if (!cJSON_IsNumber(event_threshold_rsrp)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrp]"); + goto end; + } + } + + cJSON *event_threshold_rsrp_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrpNr"); + + if (event_threshold_rsrp_nr) { + if (!cJSON_IsNumber(event_threshold_rsrp_nr)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrp_nr]"); + goto end; + } + } + + cJSON *event_threshold_rsrq = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrq"); + + if (event_threshold_rsrq) { + if (!cJSON_IsNumber(event_threshold_rsrq)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrq]"); + goto end; + } + } + + cJSON *event_threshold_rsrq_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrqNr"); + + if (event_threshold_rsrq_nr) { + if (!cJSON_IsNumber(event_threshold_rsrq_nr)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrq_nr]"); + goto end; + } + } + + cJSON *event_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventList"); + + OpenAPI_list_t *event_listList; + if (event_list) { + cJSON *event_list_local_nonprimitive; + if (!cJSON_IsArray(event_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_list]"); + goto end; + } + + event_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_list_local_nonprimitive, event_list ) { + if (!cJSON_IsString(event_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_list]"); + goto end; + } + + OpenAPI_list_add(event_listList, (void *)OpenAPI_event_for_mdt_FromString(event_list_local_nonprimitive->valuestring)); + } + } + + cJSON *logging_interval = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingInterval"); + + OpenAPI_logging_interval_mdt_e logging_intervalVariable; + if (logging_interval) { + if (!cJSON_IsString(logging_interval)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_interval]"); + goto end; + } + logging_intervalVariable = OpenAPI_logging_interval_mdt_FromString(logging_interval->valuestring); + } + + cJSON *logging_interval_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingIntervalNr"); + + OpenAPI_logging_interval_nr_mdt_e logging_interval_nrVariable; + if (logging_interval_nr) { + if (!cJSON_IsString(logging_interval_nr)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_interval_nr]"); + goto end; + } + logging_interval_nrVariable = OpenAPI_logging_interval_nr_mdt_FromString(logging_interval_nr->valuestring); + } + + cJSON *logging_duration = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingDuration"); + + OpenAPI_logging_duration_mdt_e logging_durationVariable; + if (logging_duration) { + if (!cJSON_IsString(logging_duration)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_duration]"); + goto end; + } + logging_durationVariable = OpenAPI_logging_duration_mdt_FromString(logging_duration->valuestring); + } + + cJSON *logging_duration_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingDurationNr"); + + OpenAPI_logging_duration_nr_mdt_e logging_duration_nrVariable; + if (logging_duration_nr) { + if (!cJSON_IsString(logging_duration_nr)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_duration_nr]"); + goto end; + } + logging_duration_nrVariable = OpenAPI_logging_duration_nr_mdt_FromString(logging_duration_nr->valuestring); + } + + cJSON *positioning_method = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "positioningMethod"); + + OpenAPI_positioning_method_mdt_e positioning_methodVariable; + if (positioning_method) { + if (!cJSON_IsString(positioning_method)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [positioning_method]"); + goto end; + } + positioning_methodVariable = OpenAPI_positioning_method_mdt_FromString(positioning_method->valuestring); + } + + cJSON *collection_period_rmm_lte = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "collectionPeriodRmmLte"); + + OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lteVariable; + if (collection_period_rmm_lte) { + if (!cJSON_IsString(collection_period_rmm_lte)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [collection_period_rmm_lte]"); + goto end; + } + collection_period_rmm_lteVariable = OpenAPI_collection_period_rmm_lte_mdt_FromString(collection_period_rmm_lte->valuestring); + } + + cJSON *collection_period_rmm_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "collectionPeriodRmmNr"); + + OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nrVariable; + if (collection_period_rmm_nr) { + if (!cJSON_IsString(collection_period_rmm_nr)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [collection_period_rmm_nr]"); + goto end; + } + collection_period_rmm_nrVariable = OpenAPI_collection_period_rmm_nr_mdt_FromString(collection_period_rmm_nr->valuestring); + } + + cJSON *measurement_period_lte = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "measurementPeriodLte"); + + OpenAPI_measurement_period_lte_mdt_e measurement_period_lteVariable; + if (measurement_period_lte) { + if (!cJSON_IsString(measurement_period_lte)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_period_lte]"); + goto end; + } + measurement_period_lteVariable = OpenAPI_measurement_period_lte_mdt_FromString(measurement_period_lte->valuestring); + } + + cJSON *mdt_allowed_plmn_id_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "mdtAllowedPlmnIdList"); + + OpenAPI_list_t *mdt_allowed_plmn_id_listList; + if (mdt_allowed_plmn_id_list) { + cJSON *mdt_allowed_plmn_id_list_local_nonprimitive; + if (!cJSON_IsArray(mdt_allowed_plmn_id_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mdt_allowed_plmn_id_list]"); + goto end; + } + + mdt_allowed_plmn_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mdt_allowed_plmn_id_list_local_nonprimitive, mdt_allowed_plmn_id_list ) { + if (!cJSON_IsObject(mdt_allowed_plmn_id_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mdt_allowed_plmn_id_list]"); + goto end; + } + OpenAPI_plmn_id_t *mdt_allowed_plmn_id_listItem = OpenAPI_plmn_id_parseFromJSON(mdt_allowed_plmn_id_list_local_nonprimitive); + + OpenAPI_list_add(mdt_allowed_plmn_id_listList, mdt_allowed_plmn_id_listItem); + } + } + + cJSON *mbsfn_area_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "mbsfnAreaList"); + + OpenAPI_list_t *mbsfn_area_listList; + if (mbsfn_area_list) { + cJSON *mbsfn_area_list_local_nonprimitive; + if (!cJSON_IsArray(mbsfn_area_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mbsfn_area_list]"); + goto end; + } + + mbsfn_area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mbsfn_area_list_local_nonprimitive, mbsfn_area_list ) { + if (!cJSON_IsObject(mbsfn_area_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mbsfn_area_list]"); + goto end; + } + OpenAPI_mbsfn_area_t *mbsfn_area_listItem = OpenAPI_mbsfn_area_parseFromJSON(mbsfn_area_list_local_nonprimitive); + + OpenAPI_list_add(mbsfn_area_listList, mbsfn_area_listItem); + } + } + + cJSON *inter_freq_target_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "interFreqTargetList"); + + OpenAPI_list_t *inter_freq_target_listList; + if (inter_freq_target_list) { + cJSON *inter_freq_target_list_local_nonprimitive; + if (!cJSON_IsArray(inter_freq_target_list)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [inter_freq_target_list]"); + goto end; + } + + inter_freq_target_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(inter_freq_target_list_local_nonprimitive, inter_freq_target_list ) { + if (!cJSON_IsObject(inter_freq_target_list_local_nonprimitive)) { + ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [inter_freq_target_list]"); + goto end; + } + OpenAPI_inter_freq_target_info_t *inter_freq_target_listItem = OpenAPI_inter_freq_target_info_parseFromJSON(inter_freq_target_list_local_nonprimitive); + + OpenAPI_list_add(inter_freq_target_listList, inter_freq_target_listItem); + } + } + + mdt_configuration_local_var = OpenAPI_mdt_configuration_create ( + job_typeVariable, + report_type ? report_typeVariable : 0, + area_scope ? area_scope_local_nonprim : NULL, + measurement_lte_list ? measurement_lte_listList : NULL, + measurement_nr_list ? measurement_nr_listList : NULL, + sensor_measurement_list ? sensor_measurement_listList : NULL, + reporting_trigger_list ? reporting_trigger_listList : NULL, + report_interval ? report_intervalVariable : 0, + report_interval_nr ? report_interval_nrVariable : 0, + report_amount ? report_amountVariable : 0, + event_threshold_rsrp ? event_threshold_rsrp->valuedouble : 0, + event_threshold_rsrp_nr ? event_threshold_rsrp_nr->valuedouble : 0, + event_threshold_rsrq ? event_threshold_rsrq->valuedouble : 0, + event_threshold_rsrq_nr ? event_threshold_rsrq_nr->valuedouble : 0, + event_list ? event_listList : NULL, + logging_interval ? logging_intervalVariable : 0, + logging_interval_nr ? logging_interval_nrVariable : 0, + logging_duration ? logging_durationVariable : 0, + logging_duration_nr ? logging_duration_nrVariable : 0, + positioning_method ? positioning_methodVariable : 0, + collection_period_rmm_lte ? collection_period_rmm_lteVariable : 0, + collection_period_rmm_nr ? collection_period_rmm_nrVariable : 0, + measurement_period_lte ? measurement_period_lteVariable : 0, + mdt_allowed_plmn_id_list ? mdt_allowed_plmn_id_listList : NULL, + mbsfn_area_list ? mbsfn_area_listList : NULL, + inter_freq_target_list ? inter_freq_target_listList : NULL + ); + + return mdt_configuration_local_var; +end: + return NULL; +} + +OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_copy(OpenAPI_mdt_configuration_t *dst, OpenAPI_mdt_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mdt_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mdt_configuration_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_mdt_configuration_free(dst); + dst = OpenAPI_mdt_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mdt_configuration.h b/lib/sbi/openapi/model/mdt_configuration.h new file mode 100644 index 000000000..d48789ffb --- /dev/null +++ b/lib/sbi/openapi/model/mdt_configuration.h @@ -0,0 +1,110 @@ +/* + * mdt_configuration.h + * + * + */ + +#ifndef _OpenAPI_mdt_configuration_H_ +#define _OpenAPI_mdt_configuration_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "area_scope.h" +#include "collection_period_rmm_lte_mdt.h" +#include "collection_period_rmm_nr_mdt.h" +#include "event_for_mdt.h" +#include "inter_freq_target_info.h" +#include "job_type.h" +#include "logging_duration_mdt.h" +#include "logging_duration_nr_mdt.h" +#include "logging_interval_mdt.h" +#include "logging_interval_nr_mdt.h" +#include "mbsfn_area.h" +#include "measurement_lte_for_mdt.h" +#include "measurement_nr_for_mdt.h" +#include "measurement_period_lte_mdt.h" +#include "plmn_id.h" +#include "positioning_method_mdt.h" +#include "report_amount_mdt.h" +#include "report_interval_mdt.h" +#include "report_interval_nr_mdt.h" +#include "report_type_mdt.h" +#include "reporting_trigger.h" +#include "sensor_measurement.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mdt_configuration_s OpenAPI_mdt_configuration_t; +typedef struct OpenAPI_mdt_configuration_s { + OpenAPI_job_type_e job_type; + OpenAPI_report_type_mdt_e report_type; + struct OpenAPI_area_scope_s *area_scope; + OpenAPI_list_t *measurement_lte_list; + OpenAPI_list_t *measurement_nr_list; + OpenAPI_list_t *sensor_measurement_list; + OpenAPI_list_t *reporting_trigger_list; + OpenAPI_report_interval_mdt_e report_interval; + OpenAPI_report_interval_nr_mdt_e report_interval_nr; + OpenAPI_report_amount_mdt_e report_amount; + int event_threshold_rsrp; + int event_threshold_rsrp_nr; + int event_threshold_rsrq; + int event_threshold_rsrq_nr; + OpenAPI_list_t *event_list; + OpenAPI_logging_interval_mdt_e logging_interval; + OpenAPI_logging_interval_nr_mdt_e logging_interval_nr; + OpenAPI_logging_duration_mdt_e logging_duration; + OpenAPI_logging_duration_nr_mdt_e logging_duration_nr; + OpenAPI_positioning_method_mdt_e positioning_method; + OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lte; + OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nr; + OpenAPI_measurement_period_lte_mdt_e measurement_period_lte; + OpenAPI_list_t *mdt_allowed_plmn_id_list; + OpenAPI_list_t *mbsfn_area_list; + OpenAPI_list_t *inter_freq_target_list; +} OpenAPI_mdt_configuration_t; + +OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_create( + OpenAPI_job_type_e job_type, + OpenAPI_report_type_mdt_e report_type, + OpenAPI_area_scope_t *area_scope, + OpenAPI_list_t *measurement_lte_list, + OpenAPI_list_t *measurement_nr_list, + OpenAPI_list_t *sensor_measurement_list, + OpenAPI_list_t *reporting_trigger_list, + OpenAPI_report_interval_mdt_e report_interval, + OpenAPI_report_interval_nr_mdt_e report_interval_nr, + OpenAPI_report_amount_mdt_e report_amount, + int event_threshold_rsrp, + int event_threshold_rsrp_nr, + int event_threshold_rsrq, + int event_threshold_rsrq_nr, + OpenAPI_list_t *event_list, + OpenAPI_logging_interval_mdt_e logging_interval, + OpenAPI_logging_interval_nr_mdt_e logging_interval_nr, + OpenAPI_logging_duration_mdt_e logging_duration, + OpenAPI_logging_duration_nr_mdt_e logging_duration_nr, + OpenAPI_positioning_method_mdt_e positioning_method, + OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lte, + OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nr, + OpenAPI_measurement_period_lte_mdt_e measurement_period_lte, + OpenAPI_list_t *mdt_allowed_plmn_id_list, + OpenAPI_list_t *mbsfn_area_list, + OpenAPI_list_t *inter_freq_target_list + ); +void OpenAPI_mdt_configuration_free(OpenAPI_mdt_configuration_t *mdt_configuration); +OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_parseFromJSON(cJSON *mdt_configurationJSON); +cJSON *OpenAPI_mdt_configuration_convertToJSON(OpenAPI_mdt_configuration_t *mdt_configuration); +OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_copy(OpenAPI_mdt_configuration_t *dst, OpenAPI_mdt_configuration_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mdt_configuration_H_ */ + diff --git a/lib/sbi/openapi/model/mdt_user_consent.c b/lib/sbi/openapi/model/mdt_user_consent.c new file mode 100644 index 000000000..93ad01e2a --- /dev/null +++ b/lib/sbi/openapi/model/mdt_user_consent.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "mdt_user_consent.h" + +char* OpenAPI_mdt_user_consent_ToString(OpenAPI_mdt_user_consent_e mdt_user_consent) +{ + const char *mdt_user_consentArray[] = { "NULL", "CONSENT_NOT_GIVEN", "CONSENT_GIVEN" }; + size_t sizeofArray = sizeof(mdt_user_consentArray) / sizeof(mdt_user_consentArray[0]); + if (mdt_user_consent < sizeofArray) + return (char *)mdt_user_consentArray[mdt_user_consent]; + else + return (char *)"Unknown"; +} + +OpenAPI_mdt_user_consent_e OpenAPI_mdt_user_consent_FromString(char* mdt_user_consent) +{ + int stringToReturn = 0; + const char *mdt_user_consentArray[] = { "NULL", "CONSENT_NOT_GIVEN", "CONSENT_GIVEN" }; + size_t sizeofArray = sizeof(mdt_user_consentArray) / sizeof(mdt_user_consentArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(mdt_user_consent, mdt_user_consentArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/mdt_user_consent.h b/lib/sbi/openapi/model/mdt_user_consent.h new file mode 100644 index 000000000..93ebcb67f --- /dev/null +++ b/lib/sbi/openapi/model/mdt_user_consent.h @@ -0,0 +1,31 @@ +/* + * mdt_user_consent.h + * + * + */ + +#ifndef _OpenAPI_mdt_user_consent_H_ +#define _OpenAPI_mdt_user_consent_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_mdt_user_consent_NULL = 0, OpenAPI_mdt_user_consent_CONSENT_NOT_GIVEN, OpenAPI_mdt_user_consent_CONSENT_GIVEN } OpenAPI_mdt_user_consent_e; + +char* OpenAPI_mdt_user_consent_ToString(OpenAPI_mdt_user_consent_e mdt_user_consent); + +OpenAPI_mdt_user_consent_e OpenAPI_mdt_user_consent_FromString(char* mdt_user_consent); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mdt_user_consent_H_ */ + diff --git a/lib/sbi/openapi/model/measurement_lte_for_mdt.c b/lib/sbi/openapi/model/measurement_lte_for_mdt.c new file mode 100644 index 000000000..b7db06780 --- /dev/null +++ b/lib/sbi/openapi/model/measurement_lte_for_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "measurement_lte_for_mdt.h" + +char* OpenAPI_measurement_lte_for_mdt_ToString(OpenAPI_measurement_lte_for_mdt_e measurement_lte_for_mdt) +{ + const char *measurement_lte_for_mdtArray[] = { "NULL", "M1", "M2", "M3", "M4_DL", "M4_UL", "M5_DL", "M5_UL", "M6_DL", "M6_UL", "M7_DL", "M7_UL", "M8", "M9" }; + size_t sizeofArray = sizeof(measurement_lte_for_mdtArray) / sizeof(measurement_lte_for_mdtArray[0]); + if (measurement_lte_for_mdt < sizeofArray) + return (char *)measurement_lte_for_mdtArray[measurement_lte_for_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_measurement_lte_for_mdt_e OpenAPI_measurement_lte_for_mdt_FromString(char* measurement_lte_for_mdt) +{ + int stringToReturn = 0; + const char *measurement_lte_for_mdtArray[] = { "NULL", "M1", "M2", "M3", "M4_DL", "M4_UL", "M5_DL", "M5_UL", "M6_DL", "M6_UL", "M7_DL", "M7_UL", "M8", "M9" }; + size_t sizeofArray = sizeof(measurement_lte_for_mdtArray) / sizeof(measurement_lte_for_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(measurement_lte_for_mdt, measurement_lte_for_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/measurement_lte_for_mdt.h b/lib/sbi/openapi/model/measurement_lte_for_mdt.h new file mode 100644 index 000000000..e1c596e55 --- /dev/null +++ b/lib/sbi/openapi/model/measurement_lte_for_mdt.h @@ -0,0 +1,31 @@ +/* + * measurement_lte_for_mdt.h + * + * + */ + +#ifndef _OpenAPI_measurement_lte_for_mdt_H_ +#define _OpenAPI_measurement_lte_for_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_measurement_lte_for_mdt_NULL = 0, OpenAPI_measurement_lte_for_mdt_M1, OpenAPI_measurement_lte_for_mdt_M2, OpenAPI_measurement_lte_for_mdt_M3, OpenAPI_measurement_lte_for_mdt_M4_DL, OpenAPI_measurement_lte_for_mdt_M4_UL, OpenAPI_measurement_lte_for_mdt_M5_DL, OpenAPI_measurement_lte_for_mdt_M5_UL, OpenAPI_measurement_lte_for_mdt_M6_DL, OpenAPI_measurement_lte_for_mdt_M6_UL, OpenAPI_measurement_lte_for_mdt_M7_DL, OpenAPI_measurement_lte_for_mdt_M7_UL, OpenAPI_measurement_lte_for_mdt_M8, OpenAPI_measurement_lte_for_mdt_M9 } OpenAPI_measurement_lte_for_mdt_e; + +char* OpenAPI_measurement_lte_for_mdt_ToString(OpenAPI_measurement_lte_for_mdt_e measurement_lte_for_mdt); + +OpenAPI_measurement_lte_for_mdt_e OpenAPI_measurement_lte_for_mdt_FromString(char* measurement_lte_for_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_measurement_lte_for_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/measurement_nr_for_mdt.c b/lib/sbi/openapi/model/measurement_nr_for_mdt.c new file mode 100644 index 000000000..e94459bf4 --- /dev/null +++ b/lib/sbi/openapi/model/measurement_nr_for_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "measurement_nr_for_mdt.h" + +char* OpenAPI_measurement_nr_for_mdt_ToString(OpenAPI_measurement_nr_for_mdt_e measurement_nr_for_mdt) +{ + const char *measurement_nr_for_mdtArray[] = { "NULL", "M1", "M2", "M3", "M4_DL", "M4_UL", "M5_DL", "M5_UL", "M6_DL", "M6_UL", "M7_DL", "M7_UL", "M8", "M9" }; + size_t sizeofArray = sizeof(measurement_nr_for_mdtArray) / sizeof(measurement_nr_for_mdtArray[0]); + if (measurement_nr_for_mdt < sizeofArray) + return (char *)measurement_nr_for_mdtArray[measurement_nr_for_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_measurement_nr_for_mdt_e OpenAPI_measurement_nr_for_mdt_FromString(char* measurement_nr_for_mdt) +{ + int stringToReturn = 0; + const char *measurement_nr_for_mdtArray[] = { "NULL", "M1", "M2", "M3", "M4_DL", "M4_UL", "M5_DL", "M5_UL", "M6_DL", "M6_UL", "M7_DL", "M7_UL", "M8", "M9" }; + size_t sizeofArray = sizeof(measurement_nr_for_mdtArray) / sizeof(measurement_nr_for_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(measurement_nr_for_mdt, measurement_nr_for_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/measurement_nr_for_mdt.h b/lib/sbi/openapi/model/measurement_nr_for_mdt.h new file mode 100644 index 000000000..a6a5d42d4 --- /dev/null +++ b/lib/sbi/openapi/model/measurement_nr_for_mdt.h @@ -0,0 +1,31 @@ +/* + * measurement_nr_for_mdt.h + * + * + */ + +#ifndef _OpenAPI_measurement_nr_for_mdt_H_ +#define _OpenAPI_measurement_nr_for_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_measurement_nr_for_mdt_NULL = 0, OpenAPI_measurement_nr_for_mdt_M1, OpenAPI_measurement_nr_for_mdt_M2, OpenAPI_measurement_nr_for_mdt_M3, OpenAPI_measurement_nr_for_mdt_M4_DL, OpenAPI_measurement_nr_for_mdt_M4_UL, OpenAPI_measurement_nr_for_mdt_M5_DL, OpenAPI_measurement_nr_for_mdt_M5_UL, OpenAPI_measurement_nr_for_mdt_M6_DL, OpenAPI_measurement_nr_for_mdt_M6_UL, OpenAPI_measurement_nr_for_mdt_M7_DL, OpenAPI_measurement_nr_for_mdt_M7_UL, OpenAPI_measurement_nr_for_mdt_M8, OpenAPI_measurement_nr_for_mdt_M9 } OpenAPI_measurement_nr_for_mdt_e; + +char* OpenAPI_measurement_nr_for_mdt_ToString(OpenAPI_measurement_nr_for_mdt_e measurement_nr_for_mdt); + +OpenAPI_measurement_nr_for_mdt_e OpenAPI_measurement_nr_for_mdt_FromString(char* measurement_nr_for_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_measurement_nr_for_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/measurement_period_lte_mdt.c b/lib/sbi/openapi/model/measurement_period_lte_mdt.c new file mode 100644 index 000000000..42efc274f --- /dev/null +++ b/lib/sbi/openapi/model/measurement_period_lte_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "measurement_period_lte_mdt.h" + +char* OpenAPI_measurement_period_lte_mdt_ToString(OpenAPI_measurement_period_lte_mdt_e measurement_period_lte_mdt) +{ + const char *measurement_period_lte_mdtArray[] = { "NULL", "_1024", "_1280", "_2048", "_2560", "_5120", "_10240", "_60000" }; + size_t sizeofArray = sizeof(measurement_period_lte_mdtArray) / sizeof(measurement_period_lte_mdtArray[0]); + if (measurement_period_lte_mdt < sizeofArray) + return (char *)measurement_period_lte_mdtArray[measurement_period_lte_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_measurement_period_lte_mdt_e OpenAPI_measurement_period_lte_mdt_FromString(char* measurement_period_lte_mdt) +{ + int stringToReturn = 0; + const char *measurement_period_lte_mdtArray[] = { "NULL", "_1024", "_1280", "_2048", "_2560", "_5120", "_10240", "_60000" }; + size_t sizeofArray = sizeof(measurement_period_lte_mdtArray) / sizeof(measurement_period_lte_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(measurement_period_lte_mdt, measurement_period_lte_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/measurement_period_lte_mdt.h b/lib/sbi/openapi/model/measurement_period_lte_mdt.h new file mode 100644 index 000000000..ba1c7e960 --- /dev/null +++ b/lib/sbi/openapi/model/measurement_period_lte_mdt.h @@ -0,0 +1,31 @@ +/* + * measurement_period_lte_mdt.h + * + * + */ + +#ifndef _OpenAPI_measurement_period_lte_mdt_H_ +#define _OpenAPI_measurement_period_lte_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_measurement_period_lte_mdt_NULL = 0, OpenAPI_measurement_period_lte_mdt__1024, OpenAPI_measurement_period_lte_mdt__1280, OpenAPI_measurement_period_lte_mdt__2048, OpenAPI_measurement_period_lte_mdt__2560, OpenAPI_measurement_period_lte_mdt__5120, OpenAPI_measurement_period_lte_mdt__10240, OpenAPI_measurement_period_lte_mdt__60000 } OpenAPI_measurement_period_lte_mdt_e; + +char* OpenAPI_measurement_period_lte_mdt_ToString(OpenAPI_measurement_period_lte_mdt_e measurement_period_lte_mdt); + +OpenAPI_measurement_period_lte_mdt_e OpenAPI_measurement_period_lte_mdt_FromString(char* measurement_period_lte_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_measurement_period_lte_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/message_waiting_data.c b/lib/sbi/openapi/model/message_waiting_data.c new file mode 100644 index 000000000..d88b7b4de --- /dev/null +++ b/lib/sbi/openapi/model/message_waiting_data.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "message_waiting_data.h" + +OpenAPI_message_waiting_data_t *OpenAPI_message_waiting_data_create( + OpenAPI_list_t *mwd_list + ) +{ + OpenAPI_message_waiting_data_t *message_waiting_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_message_waiting_data_t)); + if (!message_waiting_data_local_var) { + return NULL; + } + message_waiting_data_local_var->mwd_list = mwd_list; + + return message_waiting_data_local_var; +} + +void OpenAPI_message_waiting_data_free(OpenAPI_message_waiting_data_t *message_waiting_data) +{ + if (NULL == message_waiting_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(message_waiting_data->mwd_list, node) { + OpenAPI_smsc_data_free(node->data); + } + OpenAPI_list_free(message_waiting_data->mwd_list); + ogs_free(message_waiting_data); +} + +cJSON *OpenAPI_message_waiting_data_convertToJSON(OpenAPI_message_waiting_data_t *message_waiting_data) +{ + cJSON *item = NULL; + + if (message_waiting_data == NULL) { + ogs_error("OpenAPI_message_waiting_data_convertToJSON() failed [MessageWaitingData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (message_waiting_data->mwd_list) { + cJSON *mwd_listList = cJSON_AddArrayToObject(item, "mwdList"); + if (mwd_listList == NULL) { + ogs_error("OpenAPI_message_waiting_data_convertToJSON() failed [mwd_list]"); + goto end; + } + + OpenAPI_lnode_t *mwd_list_node; + if (message_waiting_data->mwd_list) { + OpenAPI_list_for_each(message_waiting_data->mwd_list, mwd_list_node) { + cJSON *itemLocal = OpenAPI_smsc_data_convertToJSON(mwd_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_message_waiting_data_convertToJSON() failed [mwd_list]"); + goto end; + } + cJSON_AddItemToArray(mwd_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_message_waiting_data_t *OpenAPI_message_waiting_data_parseFromJSON(cJSON *message_waiting_dataJSON) +{ + OpenAPI_message_waiting_data_t *message_waiting_data_local_var = NULL; + cJSON *mwd_list = cJSON_GetObjectItemCaseSensitive(message_waiting_dataJSON, "mwdList"); + + OpenAPI_list_t *mwd_listList; + if (mwd_list) { + cJSON *mwd_list_local_nonprimitive; + if (!cJSON_IsArray(mwd_list)) { + ogs_error("OpenAPI_message_waiting_data_parseFromJSON() failed [mwd_list]"); + goto end; + } + + mwd_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mwd_list_local_nonprimitive, mwd_list ) { + if (!cJSON_IsObject(mwd_list_local_nonprimitive)) { + ogs_error("OpenAPI_message_waiting_data_parseFromJSON() failed [mwd_list]"); + goto end; + } + OpenAPI_smsc_data_t *mwd_listItem = OpenAPI_smsc_data_parseFromJSON(mwd_list_local_nonprimitive); + + OpenAPI_list_add(mwd_listList, mwd_listItem); + } + } + + message_waiting_data_local_var = OpenAPI_message_waiting_data_create ( + mwd_list ? mwd_listList : NULL + ); + + return message_waiting_data_local_var; +end: + return NULL; +} + +OpenAPI_message_waiting_data_t *OpenAPI_message_waiting_data_copy(OpenAPI_message_waiting_data_t *dst, OpenAPI_message_waiting_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_message_waiting_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_message_waiting_data_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_message_waiting_data_free(dst); + dst = OpenAPI_message_waiting_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/message_waiting_data.h b/lib/sbi/openapi/model/message_waiting_data.h new file mode 100644 index 000000000..72830fd25 --- /dev/null +++ b/lib/sbi/openapi/model/message_waiting_data.h @@ -0,0 +1,39 @@ +/* + * message_waiting_data.h + * + * + */ + +#ifndef _OpenAPI_message_waiting_data_H_ +#define _OpenAPI_message_waiting_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "smsc_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_message_waiting_data_s OpenAPI_message_waiting_data_t; +typedef struct OpenAPI_message_waiting_data_s { + OpenAPI_list_t *mwd_list; +} OpenAPI_message_waiting_data_t; + +OpenAPI_message_waiting_data_t *OpenAPI_message_waiting_data_create( + OpenAPI_list_t *mwd_list + ); +void OpenAPI_message_waiting_data_free(OpenAPI_message_waiting_data_t *message_waiting_data); +OpenAPI_message_waiting_data_t *OpenAPI_message_waiting_data_parseFromJSON(cJSON *message_waiting_dataJSON); +cJSON *OpenAPI_message_waiting_data_convertToJSON(OpenAPI_message_waiting_data_t *message_waiting_data); +OpenAPI_message_waiting_data_t *OpenAPI_message_waiting_data_copy(OpenAPI_message_waiting_data_t *dst, OpenAPI_message_waiting_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_message_waiting_data_H_ */ + diff --git a/lib/sbi/openapi/model/mo_exception_data_flag.c b/lib/sbi/openapi/model/mo_exception_data_flag.c deleted file mode 100644 index 529461452..000000000 --- a/lib/sbi/openapi/model/mo_exception_data_flag.c +++ /dev/null @@ -1,85 +0,0 @@ - -#include -#include -#include -#include "mo_exception_data_flag.h" - -OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_create( - ) -{ - OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag_local_var = OpenAPI_malloc(sizeof(OpenAPI_mo_exception_data_flag_t)); - if (!mo_exception_data_flag_local_var) { - return NULL; - } - - return mo_exception_data_flag_local_var; -} - -void OpenAPI_mo_exception_data_flag_free(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag) -{ - if (NULL == mo_exception_data_flag) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(mo_exception_data_flag); -} - -cJSON *OpenAPI_mo_exception_data_flag_convertToJSON(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag) -{ - cJSON *item = NULL; - - if (mo_exception_data_flag == NULL) { - ogs_error("OpenAPI_mo_exception_data_flag_convertToJSON() failed [MoExceptionDataFlag]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_parseFromJSON(cJSON *mo_exception_data_flagJSON) -{ - OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag_local_var = NULL; - mo_exception_data_flag_local_var = OpenAPI_mo_exception_data_flag_create ( - ); - - return mo_exception_data_flag_local_var; -end: - return NULL; -} - -OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_copy(OpenAPI_mo_exception_data_flag_t *dst, OpenAPI_mo_exception_data_flag_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_mo_exception_data_flag_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_mo_exception_data_flag_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_mo_exception_data_flag_free(dst); - dst = OpenAPI_mo_exception_data_flag_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/mo_exception_data_flag.h b/lib/sbi/openapi/model/mo_exception_data_flag.h deleted file mode 100644 index 827eb05f8..000000000 --- a/lib/sbi/openapi/model/mo_exception_data_flag.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * mo_exception_data_flag.h - * - * Possible values are - \"START\": Indicates the start of MO Exception Data delivery. - \"STOP\": Indicates the stop of MO Exception Data delivery. - */ - -#ifndef _OpenAPI_mo_exception_data_flag_H_ -#define _OpenAPI_mo_exception_data_flag_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_mo_exception_data_flag_s OpenAPI_mo_exception_data_flag_t; -typedef struct OpenAPI_mo_exception_data_flag_s { -} OpenAPI_mo_exception_data_flag_t; - -OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_create( - ); -void OpenAPI_mo_exception_data_flag_free(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag); -OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_parseFromJSON(cJSON *mo_exception_data_flagJSON); -cJSON *OpenAPI_mo_exception_data_flag_convertToJSON(OpenAPI_mo_exception_data_flag_t *mo_exception_data_flag); -OpenAPI_mo_exception_data_flag_t *OpenAPI_mo_exception_data_flag_copy(OpenAPI_mo_exception_data_flag_t *dst, OpenAPI_mo_exception_data_flag_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_mo_exception_data_flag_H_ */ - diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c index fb9d1a62c..17ff8272b 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c +++ b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.c @@ -9,7 +9,8 @@ OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configura OpenAPI_list_t *members, int reference_id, char *af_instance_id, - char *internal_group_identifier + char *internal_group_identifier, + char *mtc_provider_information ) { OpenAPI_model_5_g_vn_group_configuration_t *model_5_g_vn_group_configuration_local_var = OpenAPI_malloc(sizeof(OpenAPI_model_5_g_vn_group_configuration_t)); @@ -21,6 +22,7 @@ OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configura model_5_g_vn_group_configuration_local_var->reference_id = reference_id; model_5_g_vn_group_configuration_local_var->af_instance_id = af_instance_id; model_5_g_vn_group_configuration_local_var->internal_group_identifier = internal_group_identifier; + model_5_g_vn_group_configuration_local_var->mtc_provider_information = mtc_provider_information; return model_5_g_vn_group_configuration_local_var; } @@ -38,6 +40,7 @@ void OpenAPI_model_5_g_vn_group_configuration_free(OpenAPI_model_5_g_vn_group_co OpenAPI_list_free(model_5_g_vn_group_configuration->members); ogs_free(model_5_g_vn_group_configuration->af_instance_id); ogs_free(model_5_g_vn_group_configuration->internal_group_identifier); + ogs_free(model_5_g_vn_group_configuration->mtc_provider_information); ogs_free(model_5_g_vn_group_configuration); } @@ -101,6 +104,13 @@ cJSON *OpenAPI_model_5_g_vn_group_configuration_convertToJSON(OpenAPI_model_5_g_ } } + if (model_5_g_vn_group_configuration->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", model_5_g_vn_group_configuration->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_model_5_g_vn_group_configuration_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -162,12 +172,22 @@ OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configura } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(model_5_g_vn_group_configurationJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_model_5_g_vn_group_configuration_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + model_5_g_vn_group_configuration_local_var = OpenAPI_model_5_g_vn_group_configuration_create ( _5g_vn_group_data ? _5g_vn_group_data_local_nonprim : NULL, members ? membersList : NULL, reference_id ? reference_id->valuedouble : 0, af_instance_id ? ogs_strdup(af_instance_id->valuestring) : NULL, - internal_group_identifier ? ogs_strdup(internal_group_identifier->valuestring) : NULL + internal_group_identifier ? ogs_strdup(internal_group_identifier->valuestring) : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return model_5_g_vn_group_configuration_local_var; diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h index 95db09f23..ddf32f541 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h +++ b/lib/sbi/openapi/model/model_5_g_vn_group_configuration.h @@ -25,6 +25,7 @@ typedef struct OpenAPI_model_5_g_vn_group_configuration_s { int reference_id; char *af_instance_id; char *internal_group_identifier; + char *mtc_provider_information; } OpenAPI_model_5_g_vn_group_configuration_t; OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configuration_create( @@ -32,7 +33,8 @@ OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configura OpenAPI_list_t *members, int reference_id, char *af_instance_id, - char *internal_group_identifier + char *internal_group_identifier, + char *mtc_provider_information ); void OpenAPI_model_5_g_vn_group_configuration_free(OpenAPI_model_5_g_vn_group_configuration_t *model_5_g_vn_group_configuration); OpenAPI_model_5_g_vn_group_configuration_t *OpenAPI_model_5_g_vn_group_configuration_parseFromJSON(cJSON *model_5_g_vn_group_configurationJSON); diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_data.c b/lib/sbi/openapi/model/model_5_g_vn_group_data.c index 6cf5b1535..fdcc1f774 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_data.c +++ b/lib/sbi/openapi/model/model_5_g_vn_group_data.c @@ -8,7 +8,9 @@ OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_create( char *dnn, OpenAPI_snssai_t *s_nssai, OpenAPI_list_t *pdu_session_types, - OpenAPI_list_t *app_descriptors + OpenAPI_list_t *app_descriptors, + int secondary_auth, + OpenAPI_ip_address_t *dn_aaa_address ) { OpenAPI_model_5_g_vn_group_data_t *model_5_g_vn_group_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_model_5_g_vn_group_data_t)); @@ -19,6 +21,8 @@ OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_create( model_5_g_vn_group_data_local_var->s_nssai = s_nssai; model_5_g_vn_group_data_local_var->pdu_session_types = pdu_session_types; model_5_g_vn_group_data_local_var->app_descriptors = app_descriptors; + model_5_g_vn_group_data_local_var->secondary_auth = secondary_auth; + model_5_g_vn_group_data_local_var->dn_aaa_address = dn_aaa_address; return model_5_g_vn_group_data_local_var; } @@ -36,6 +40,7 @@ void OpenAPI_model_5_g_vn_group_data_free(OpenAPI_model_5_g_vn_group_data_t *mod OpenAPI_app_descriptor_free(node->data); } OpenAPI_list_free(model_5_g_vn_group_data->app_descriptors); + OpenAPI_ip_address_free(model_5_g_vn_group_data->dn_aaa_address); ogs_free(model_5_g_vn_group_data); } @@ -108,6 +113,26 @@ cJSON *OpenAPI_model_5_g_vn_group_data_convertToJSON(OpenAPI_model_5_g_vn_group_ } } + if (model_5_g_vn_group_data->secondary_auth) { + if (cJSON_AddBoolToObject(item, "secondaryAuth", model_5_g_vn_group_data->secondary_auth) == NULL) { + ogs_error("OpenAPI_model_5_g_vn_group_data_convertToJSON() failed [secondary_auth]"); + goto end; + } + } + + if (model_5_g_vn_group_data->dn_aaa_address) { + cJSON *dn_aaa_address_local_JSON = OpenAPI_ip_address_convertToJSON(model_5_g_vn_group_data->dn_aaa_address); + if (dn_aaa_address_local_JSON == NULL) { + ogs_error("OpenAPI_model_5_g_vn_group_data_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + cJSON_AddItemToObject(item, "dnAaaAddress", dn_aaa_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_model_5_g_vn_group_data_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + } + end: return item; } @@ -182,11 +207,29 @@ OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_parseFromJSON } } + cJSON *secondary_auth = cJSON_GetObjectItemCaseSensitive(model_5_g_vn_group_dataJSON, "secondaryAuth"); + + if (secondary_auth) { + if (!cJSON_IsBool(secondary_auth)) { + ogs_error("OpenAPI_model_5_g_vn_group_data_parseFromJSON() failed [secondary_auth]"); + goto end; + } + } + + cJSON *dn_aaa_address = cJSON_GetObjectItemCaseSensitive(model_5_g_vn_group_dataJSON, "dnAaaAddress"); + + OpenAPI_ip_address_t *dn_aaa_address_local_nonprim = NULL; + if (dn_aaa_address) { + dn_aaa_address_local_nonprim = OpenAPI_ip_address_parseFromJSON(dn_aaa_address); + } + model_5_g_vn_group_data_local_var = OpenAPI_model_5_g_vn_group_data_create ( ogs_strdup(dnn->valuestring), s_nssai_local_nonprim, pdu_session_types ? pdu_session_typesList : NULL, - app_descriptors ? app_descriptorsList : NULL + app_descriptors ? app_descriptorsList : NULL, + secondary_auth ? secondary_auth->valueint : 0, + dn_aaa_address ? dn_aaa_address_local_nonprim : NULL ); return model_5_g_vn_group_data_local_var; diff --git a/lib/sbi/openapi/model/model_5_g_vn_group_data.h b/lib/sbi/openapi/model/model_5_g_vn_group_data.h index d6b4cc707..ffdf2ef83 100644 --- a/lib/sbi/openapi/model/model_5_g_vn_group_data.h +++ b/lib/sbi/openapi/model/model_5_g_vn_group_data.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "app_descriptor.h" +#include "ip_address.h" #include "pdu_session_type.h" #include "snssai.h" @@ -26,13 +27,17 @@ typedef struct OpenAPI_model_5_g_vn_group_data_s { struct OpenAPI_snssai_s *s_nssai; OpenAPI_list_t *pdu_session_types; OpenAPI_list_t *app_descriptors; + int secondary_auth; + struct OpenAPI_ip_address_s *dn_aaa_address; } OpenAPI_model_5_g_vn_group_data_t; OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_create( char *dnn, OpenAPI_snssai_t *s_nssai, OpenAPI_list_t *pdu_session_types, - OpenAPI_list_t *app_descriptors + OpenAPI_list_t *app_descriptors, + int secondary_auth, + OpenAPI_ip_address_t *dn_aaa_address ); void OpenAPI_model_5_g_vn_group_data_free(OpenAPI_model_5_g_vn_group_data_t *model_5_g_vn_group_data); OpenAPI_model_5_g_vn_group_data_t *OpenAPI_model_5_g_vn_group_data_parseFromJSON(cJSON *model_5_g_vn_group_dataJSON); diff --git a/lib/sbi/openapi/model/monitoring_configuration.c b/lib/sbi/openapi/model/monitoring_configuration.c index d2d680eca..98e4f3b3b 100644 --- a/lib/sbi/openapi/model/monitoring_configuration.c +++ b/lib/sbi/openapi/model/monitoring_configuration.c @@ -9,7 +9,15 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( int immediate_flag, OpenAPI_location_reporting_configuration_t *location_reporting_configuration, OpenAPI_association_type_t *association_type, - OpenAPI_datalink_reporting_configuration_t *datalink_report_cfg + OpenAPI_datalink_reporting_configuration_t *datalink_report_cfg, + OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg, + int maximum_latency, + int maximum_response_time, + int suggested_packet_num_dl, + OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg, + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg, + char *mtc_provider_information, + char *af_id ) { OpenAPI_monitoring_configuration_t *monitoring_configuration_local_var = OpenAPI_malloc(sizeof(OpenAPI_monitoring_configuration_t)); @@ -21,6 +29,14 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( monitoring_configuration_local_var->location_reporting_configuration = location_reporting_configuration; monitoring_configuration_local_var->association_type = association_type; monitoring_configuration_local_var->datalink_report_cfg = datalink_report_cfg; + monitoring_configuration_local_var->loss_connectivity_cfg = loss_connectivity_cfg; + monitoring_configuration_local_var->maximum_latency = maximum_latency; + monitoring_configuration_local_var->maximum_response_time = maximum_response_time; + monitoring_configuration_local_var->suggested_packet_num_dl = suggested_packet_num_dl; + monitoring_configuration_local_var->pdu_session_status_cfg = pdu_session_status_cfg; + monitoring_configuration_local_var->reachability_for_sms_cfg = reachability_for_sms_cfg; + monitoring_configuration_local_var->mtc_provider_information = mtc_provider_information; + monitoring_configuration_local_var->af_id = af_id; return monitoring_configuration_local_var; } @@ -35,6 +51,11 @@ void OpenAPI_monitoring_configuration_free(OpenAPI_monitoring_configuration_t *m OpenAPI_location_reporting_configuration_free(monitoring_configuration->location_reporting_configuration); OpenAPI_association_type_free(monitoring_configuration->association_type); OpenAPI_datalink_reporting_configuration_free(monitoring_configuration->datalink_report_cfg); + OpenAPI_loss_connectivity_cfg_free(monitoring_configuration->loss_connectivity_cfg); + OpenAPI_pdu_session_status_cfg_free(monitoring_configuration->pdu_session_status_cfg); + OpenAPI_reachability_for_sms_configuration_free(monitoring_configuration->reachability_for_sms_cfg); + ogs_free(monitoring_configuration->mtc_provider_information); + ogs_free(monitoring_configuration->af_id); ogs_free(monitoring_configuration); } @@ -109,6 +130,80 @@ cJSON *OpenAPI_monitoring_configuration_convertToJSON(OpenAPI_monitoring_configu } } + if (monitoring_configuration->loss_connectivity_cfg) { + cJSON *loss_connectivity_cfg_local_JSON = OpenAPI_loss_connectivity_cfg_convertToJSON(monitoring_configuration->loss_connectivity_cfg); + if (loss_connectivity_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [loss_connectivity_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "lossConnectivityCfg", loss_connectivity_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [loss_connectivity_cfg]"); + goto end; + } + } + + if (monitoring_configuration->maximum_latency) { + if (cJSON_AddNumberToObject(item, "maximumLatency", monitoring_configuration->maximum_latency) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [maximum_latency]"); + goto end; + } + } + + if (monitoring_configuration->maximum_response_time) { + if (cJSON_AddNumberToObject(item, "maximumResponseTime", monitoring_configuration->maximum_response_time) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [maximum_response_time]"); + goto end; + } + } + + if (monitoring_configuration->suggested_packet_num_dl) { + if (cJSON_AddNumberToObject(item, "suggestedPacketNumDl", monitoring_configuration->suggested_packet_num_dl) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [suggested_packet_num_dl]"); + goto end; + } + } + + if (monitoring_configuration->pdu_session_status_cfg) { + cJSON *pdu_session_status_cfg_local_JSON = OpenAPI_pdu_session_status_cfg_convertToJSON(monitoring_configuration->pdu_session_status_cfg); + if (pdu_session_status_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [pdu_session_status_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "pduSessionStatusCfg", pdu_session_status_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [pdu_session_status_cfg]"); + goto end; + } + } + + if (monitoring_configuration->reachability_for_sms_cfg) { + cJSON *reachability_for_sms_cfg_local_JSON = OpenAPI_reachability_for_sms_configuration_convertToJSON(monitoring_configuration->reachability_for_sms_cfg); + if (reachability_for_sms_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [reachability_for_sms_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "reachabilityForSmsCfg", reachability_for_sms_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [reachability_for_sms_cfg]"); + goto end; + } + } + + if (monitoring_configuration->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", monitoring_configuration->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + + if (monitoring_configuration->af_id) { + if (cJSON_AddStringToObject(item, "afId", monitoring_configuration->af_id) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [af_id]"); + goto end; + } + } + end: return item; } @@ -156,12 +251,86 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJS datalink_report_cfg_local_nonprim = OpenAPI_datalink_reporting_configuration_parseFromJSON(datalink_report_cfg); } + cJSON *loss_connectivity_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "lossConnectivityCfg"); + + OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg_local_nonprim = NULL; + if (loss_connectivity_cfg) { + loss_connectivity_cfg_local_nonprim = OpenAPI_loss_connectivity_cfg_parseFromJSON(loss_connectivity_cfg); + } + + cJSON *maximum_latency = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "maximumLatency"); + + if (maximum_latency) { + if (!cJSON_IsNumber(maximum_latency)) { + ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [maximum_latency]"); + goto end; + } + } + + cJSON *maximum_response_time = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "maximumResponseTime"); + + if (maximum_response_time) { + if (!cJSON_IsNumber(maximum_response_time)) { + ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [maximum_response_time]"); + goto end; + } + } + + cJSON *suggested_packet_num_dl = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "suggestedPacketNumDl"); + + if (suggested_packet_num_dl) { + if (!cJSON_IsNumber(suggested_packet_num_dl)) { + ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [suggested_packet_num_dl]"); + goto end; + } + } + + cJSON *pdu_session_status_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "pduSessionStatusCfg"); + + OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg_local_nonprim = NULL; + if (pdu_session_status_cfg) { + pdu_session_status_cfg_local_nonprim = OpenAPI_pdu_session_status_cfg_parseFromJSON(pdu_session_status_cfg); + } + + cJSON *reachability_for_sms_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "reachabilityForSmsCfg"); + + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg_local_nonprim = NULL; + if (reachability_for_sms_cfg) { + reachability_for_sms_cfg_local_nonprim = OpenAPI_reachability_for_sms_configuration_parseFromJSON(reachability_for_sms_cfg); + } + + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + + cJSON *af_id = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "afId"); + + if (af_id) { + if (!cJSON_IsString(af_id)) { + ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [af_id]"); + goto end; + } + } + monitoring_configuration_local_var = OpenAPI_monitoring_configuration_create ( event_type_local_nonprim, immediate_flag ? immediate_flag->valueint : 0, location_reporting_configuration ? location_reporting_configuration_local_nonprim : NULL, association_type ? association_type_local_nonprim : NULL, - datalink_report_cfg ? datalink_report_cfg_local_nonprim : NULL + datalink_report_cfg ? datalink_report_cfg_local_nonprim : NULL, + loss_connectivity_cfg ? loss_connectivity_cfg_local_nonprim : NULL, + maximum_latency ? maximum_latency->valuedouble : 0, + maximum_response_time ? maximum_response_time->valuedouble : 0, + suggested_packet_num_dl ? suggested_packet_num_dl->valuedouble : 0, + pdu_session_status_cfg ? pdu_session_status_cfg_local_nonprim : NULL, + reachability_for_sms_cfg ? reachability_for_sms_cfg_local_nonprim : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL, + af_id ? ogs_strdup(af_id->valuestring) : NULL ); return monitoring_configuration_local_var; diff --git a/lib/sbi/openapi/model/monitoring_configuration.h b/lib/sbi/openapi/model/monitoring_configuration.h index 83e297e9c..d9dd797a9 100644 --- a/lib/sbi/openapi/model/monitoring_configuration.h +++ b/lib/sbi/openapi/model/monitoring_configuration.h @@ -16,6 +16,9 @@ #include "datalink_reporting_configuration.h" #include "event_type.h" #include "location_reporting_configuration.h" +#include "loss_connectivity_cfg.h" +#include "pdu_session_status_cfg.h" +#include "reachability_for_sms_configuration.h" #ifdef __cplusplus extern "C" { @@ -28,6 +31,14 @@ typedef struct OpenAPI_monitoring_configuration_s { struct OpenAPI_location_reporting_configuration_s *location_reporting_configuration; struct OpenAPI_association_type_s *association_type; struct OpenAPI_datalink_reporting_configuration_s *datalink_report_cfg; + struct OpenAPI_loss_connectivity_cfg_s *loss_connectivity_cfg; + int maximum_latency; + int maximum_response_time; + int suggested_packet_num_dl; + struct OpenAPI_pdu_session_status_cfg_s *pdu_session_status_cfg; + struct OpenAPI_reachability_for_sms_configuration_s *reachability_for_sms_cfg; + char *mtc_provider_information; + char *af_id; } OpenAPI_monitoring_configuration_t; OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( @@ -35,7 +46,15 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( int immediate_flag, OpenAPI_location_reporting_configuration_t *location_reporting_configuration, OpenAPI_association_type_t *association_type, - OpenAPI_datalink_reporting_configuration_t *datalink_report_cfg + OpenAPI_datalink_reporting_configuration_t *datalink_report_cfg, + OpenAPI_loss_connectivity_cfg_t *loss_connectivity_cfg, + int maximum_latency, + int maximum_response_time, + int suggested_packet_num_dl, + OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg, + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg, + char *mtc_provider_information, + char *af_id ); void OpenAPI_monitoring_configuration_free(OpenAPI_monitoring_configuration_t *monitoring_configuration); OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJSON(cJSON *monitoring_configurationJSON); diff --git a/lib/sbi/openapi/model/n2_sm_info_type.c b/lib/sbi/openapi/model/n2_sm_info_type.c index 0329a59fd..96d6f42bb 100644 --- a/lib/sbi/openapi/model/n2_sm_info_type.c +++ b/lib/sbi/openapi/model/n2_sm_info_type.c @@ -6,7 +6,7 @@ char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type) { - const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE" }; + const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE", "PDU_RES_MOD_IND_FAIL" }; size_t sizeofArray = sizeof(n2_sm_info_typeArray) / sizeof(n2_sm_info_typeArray[0]); if (n2_sm_info_type < sizeofArray) return (char *)n2_sm_info_typeArray[n2_sm_info_type]; @@ -17,7 +17,7 @@ char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type OpenAPI_n2_sm_info_type_e OpenAPI_n2_sm_info_type_FromString(char* n2_sm_info_type) { int stringToReturn = 0; - const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE" }; + const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE", "PDU_RES_MOD_IND_FAIL" }; size_t sizeofArray = sizeof(n2_sm_info_typeArray) / sizeof(n2_sm_info_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(n2_sm_info_type, n2_sm_info_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/n2_sm_info_type.h b/lib/sbi/openapi/model/n2_sm_info_type.h index dcbf19272..dc9417c82 100644 --- a/lib/sbi/openapi/model/n2_sm_info_type.h +++ b/lib/sbi/openapi/model/n2_sm_info_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_n2_sm_info_type_NULL = 0, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_REQ, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_REL_CMD, OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_REQ, OpenAPI_n2_sm_info_type_PDU_RES_MOD_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_NTY, OpenAPI_n2_sm_info_type_PDU_RES_NTY_REL, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND, OpenAPI_n2_sm_info_type_PDU_RES_MOD_CFM, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ, OpenAPI_n2_sm_info_type_PATH_SWITCH_SETUP_FAIL, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQUIRED, OpenAPI_n2_sm_info_type_HANDOVER_CMD, OpenAPI_n2_sm_info_type_HANDOVER_PREP_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQ_ACK, OpenAPI_n2_sm_info_type_HANDOVER_RES_ALLOC_FAIL, OpenAPI_n2_sm_info_type_SECONDARY_RAT_USAGE } OpenAPI_n2_sm_info_type_e; +typedef enum { OpenAPI_n2_sm_info_type_NULL = 0, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_REQ, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_REL_CMD, OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_REQ, OpenAPI_n2_sm_info_type_PDU_RES_MOD_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_NTY, OpenAPI_n2_sm_info_type_PDU_RES_NTY_REL, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND, OpenAPI_n2_sm_info_type_PDU_RES_MOD_CFM, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ, OpenAPI_n2_sm_info_type_PATH_SWITCH_SETUP_FAIL, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQUIRED, OpenAPI_n2_sm_info_type_HANDOVER_CMD, OpenAPI_n2_sm_info_type_HANDOVER_PREP_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQ_ACK, OpenAPI_n2_sm_info_type_HANDOVER_RES_ALLOC_FAIL, OpenAPI_n2_sm_info_type_SECONDARY_RAT_USAGE, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND_FAIL } OpenAPI_n2_sm_info_type_e; char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type); diff --git a/lib/sbi/openapi/model/n3ga_location.c b/lib/sbi/openapi/model/n3ga_location.c index a9f7927f9..a748e7d3b 100644 --- a/lib/sbi/openapi/model/n3ga_location.c +++ b/lib/sbi/openapi/model/n3ga_location.c @@ -10,11 +10,12 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( char *ue_ipv4_addr, char *ue_ipv6_addr, int port_number, - char *ss_id, - char *bss_id, - char civic_address, + OpenAPI_tnap_id_t *tnap_id, + OpenAPI_twap_id_t *twap_id, OpenAPI_hfc_node_id_t *hfc_node_id, - char gli + char gli, + OpenAPI_line_type_e w5gban_line_type, + char *gci ) { OpenAPI_n3ga_location_t *n3ga_location_local_var = OpenAPI_malloc(sizeof(OpenAPI_n3ga_location_t)); @@ -26,11 +27,12 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( n3ga_location_local_var->ue_ipv4_addr = ue_ipv4_addr; n3ga_location_local_var->ue_ipv6_addr = ue_ipv6_addr; n3ga_location_local_var->port_number = port_number; - n3ga_location_local_var->ss_id = ss_id; - n3ga_location_local_var->bss_id = bss_id; - n3ga_location_local_var->civic_address = civic_address; + n3ga_location_local_var->tnap_id = tnap_id; + n3ga_location_local_var->twap_id = twap_id; n3ga_location_local_var->hfc_node_id = hfc_node_id; n3ga_location_local_var->gli = gli; + n3ga_location_local_var->w5gban_line_type = w5gban_line_type; + n3ga_location_local_var->gci = gci; return n3ga_location_local_var; } @@ -45,9 +47,10 @@ void OpenAPI_n3ga_location_free(OpenAPI_n3ga_location_t *n3ga_location) ogs_free(n3ga_location->n3_iwf_id); ogs_free(n3ga_location->ue_ipv4_addr); ogs_free(n3ga_location->ue_ipv6_addr); - ogs_free(n3ga_location->ss_id); - ogs_free(n3ga_location->bss_id); + OpenAPI_tnap_id_free(n3ga_location->tnap_id); + OpenAPI_twap_id_free(n3ga_location->twap_id); OpenAPI_hfc_node_id_free(n3ga_location->hfc_node_id); + ogs_free(n3ga_location->gci); ogs_free(n3ga_location); } @@ -102,23 +105,28 @@ cJSON *OpenAPI_n3ga_location_convertToJSON(OpenAPI_n3ga_location_t *n3ga_locatio } } - if (n3ga_location->ss_id) { - if (cJSON_AddStringToObject(item, "ssId", n3ga_location->ss_id) == NULL) { - ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [ss_id]"); + if (n3ga_location->tnap_id) { + cJSON *tnap_id_local_JSON = OpenAPI_tnap_id_convertToJSON(n3ga_location->tnap_id); + if (tnap_id_local_JSON == NULL) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [tnap_id]"); + goto end; + } + cJSON_AddItemToObject(item, "tnapId", tnap_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [tnap_id]"); goto end; } } - if (n3ga_location->bss_id) { - if (cJSON_AddStringToObject(item, "bssId", n3ga_location->bss_id) == NULL) { - ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [bss_id]"); + if (n3ga_location->twap_id) { + cJSON *twap_id_local_JSON = OpenAPI_twap_id_convertToJSON(n3ga_location->twap_id); + if (twap_id_local_JSON == NULL) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [twap_id]"); goto end; } - } - - if (n3ga_location->civic_address) { - if (cJSON_AddNumberToObject(item, "civicAddress", n3ga_location->civic_address) == NULL) { - ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [civic_address]"); + cJSON_AddItemToObject(item, "twapId", twap_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [twap_id]"); goto end; } } @@ -143,6 +151,20 @@ cJSON *OpenAPI_n3ga_location_convertToJSON(OpenAPI_n3ga_location_t *n3ga_locatio } } + if (n3ga_location->w5gban_line_type) { + if (cJSON_AddStringToObject(item, "w5gbanLineType", OpenAPI_line_type_ToString(n3ga_location->w5gban_line_type)) == NULL) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [w5gban_line_type]"); + goto end; + } + } + + if (n3ga_location->gci) { + if (cJSON_AddStringToObject(item, "gci", n3ga_location->gci) == NULL) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [gci]"); + goto end; + } + } + end: return item; } @@ -193,31 +215,18 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_parseFromJSON(cJSON *n3ga_locatio } } - cJSON *ss_id = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "ssId"); + cJSON *tnap_id = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "tnapId"); - if (ss_id) { - if (!cJSON_IsString(ss_id)) { - ogs_error("OpenAPI_n3ga_location_parseFromJSON() failed [ss_id]"); - goto end; - } + OpenAPI_tnap_id_t *tnap_id_local_nonprim = NULL; + if (tnap_id) { + tnap_id_local_nonprim = OpenAPI_tnap_id_parseFromJSON(tnap_id); } - cJSON *bss_id = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "bssId"); + cJSON *twap_id = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "twapId"); - if (bss_id) { - if (!cJSON_IsString(bss_id)) { - ogs_error("OpenAPI_n3ga_location_parseFromJSON() failed [bss_id]"); - goto end; - } - } - - cJSON *civic_address = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "civicAddress"); - - if (civic_address) { - if (!cJSON_IsNumber(civic_address)) { - ogs_error("OpenAPI_n3ga_location_parseFromJSON() failed [civic_address]"); - goto end; - } + OpenAPI_twap_id_t *twap_id_local_nonprim = NULL; + if (twap_id) { + twap_id_local_nonprim = OpenAPI_twap_id_parseFromJSON(twap_id); } cJSON *hfc_node_id = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "hfcNodeId"); @@ -236,17 +245,38 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_parseFromJSON(cJSON *n3ga_locatio } } + cJSON *w5gban_line_type = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "w5gbanLineType"); + + OpenAPI_line_type_e w5gban_line_typeVariable; + if (w5gban_line_type) { + if (!cJSON_IsString(w5gban_line_type)) { + ogs_error("OpenAPI_n3ga_location_parseFromJSON() failed [w5gban_line_type]"); + goto end; + } + w5gban_line_typeVariable = OpenAPI_line_type_FromString(w5gban_line_type->valuestring); + } + + cJSON *gci = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "gci"); + + if (gci) { + if (!cJSON_IsString(gci)) { + ogs_error("OpenAPI_n3ga_location_parseFromJSON() failed [gci]"); + goto end; + } + } + n3ga_location_local_var = OpenAPI_n3ga_location_create ( n3gpp_tai ? n3gpp_tai_local_nonprim : NULL, n3_iwf_id ? ogs_strdup(n3_iwf_id->valuestring) : NULL, ue_ipv4_addr ? ogs_strdup(ue_ipv4_addr->valuestring) : NULL, ue_ipv6_addr ? ogs_strdup(ue_ipv6_addr->valuestring) : NULL, port_number ? port_number->valuedouble : 0, - ss_id ? ogs_strdup(ss_id->valuestring) : NULL, - bss_id ? ogs_strdup(bss_id->valuestring) : NULL, - civic_address ? civic_address->valueint : 0, + tnap_id ? tnap_id_local_nonprim : NULL, + twap_id ? twap_id_local_nonprim : NULL, hfc_node_id ? hfc_node_id_local_nonprim : NULL, - gli ? gli->valueint : 0 + gli ? gli->valueint : 0, + w5gban_line_type ? w5gban_line_typeVariable : 0, + gci ? ogs_strdup(gci->valuestring) : NULL ); return n3ga_location_local_var; diff --git a/lib/sbi/openapi/model/n3ga_location.h b/lib/sbi/openapi/model/n3ga_location.h index fa0efc2ad..4e1f87263 100644 --- a/lib/sbi/openapi/model/n3ga_location.h +++ b/lib/sbi/openapi/model/n3ga_location.h @@ -13,7 +13,10 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "hfc_node_id.h" +#include "line_type.h" #include "tai.h" +#include "tnap_id.h" +#include "twap_id.h" #ifdef __cplusplus extern "C" { @@ -26,11 +29,12 @@ typedef struct OpenAPI_n3ga_location_s { char *ue_ipv4_addr; char *ue_ipv6_addr; int port_number; - char *ss_id; - char *bss_id; - char civic_address; + struct OpenAPI_tnap_id_s *tnap_id; + struct OpenAPI_twap_id_s *twap_id; struct OpenAPI_hfc_node_id_s *hfc_node_id; char gli; + OpenAPI_line_type_e w5gban_line_type; + char *gci; } OpenAPI_n3ga_location_t; OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( @@ -39,11 +43,12 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( char *ue_ipv4_addr, char *ue_ipv6_addr, int port_number, - char *ss_id, - char *bss_id, - char civic_address, + OpenAPI_tnap_id_t *tnap_id, + OpenAPI_twap_id_t *twap_id, OpenAPI_hfc_node_id_t *hfc_node_id, - char gli + char gli, + OpenAPI_line_type_e w5gban_line_type, + char *gci ); void OpenAPI_n3ga_location_free(OpenAPI_n3ga_location_t *n3ga_location); OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_parseFromJSON(cJSON *n3ga_locationJSON); diff --git a/lib/sbi/openapi/model/nef_cond.c b/lib/sbi/openapi/model/nef_cond.c new file mode 100644 index 000000000..e85a78bc1 --- /dev/null +++ b/lib/sbi/openapi/model/nef_cond.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "nef_cond.h" + +OpenAPI_nef_cond_t *OpenAPI_nef_cond_create( + OpenAPI_list_t *event_ids + ) +{ + OpenAPI_nef_cond_t *nef_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_nef_cond_t)); + if (!nef_cond_local_var) { + return NULL; + } + nef_cond_local_var->event_ids = event_ids; + + return nef_cond_local_var; +} + +void OpenAPI_nef_cond_free(OpenAPI_nef_cond_t *nef_cond) +{ + if (NULL == nef_cond) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(nef_cond->event_ids, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(nef_cond->event_ids); + ogs_free(nef_cond); +} + +cJSON *OpenAPI_nef_cond_convertToJSON(OpenAPI_nef_cond_t *nef_cond) +{ + cJSON *item = NULL; + + if (nef_cond == NULL) { + ogs_error("OpenAPI_nef_cond_convertToJSON() failed [NefCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nef_cond->event_ids) { + cJSON *event_idsList = cJSON_AddArrayToObject(item, "eventIds"); + if (event_idsList == NULL) { + ogs_error("OpenAPI_nef_cond_convertToJSON() failed [event_ids]"); + goto end; + } + + OpenAPI_lnode_t *event_ids_node; + if (nef_cond->event_ids) { + OpenAPI_list_for_each(nef_cond->event_ids, event_ids_node) { + cJSON *itemLocal = OpenAPI_event_id_convertToJSON(event_ids_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nef_cond_convertToJSON() failed [event_ids]"); + goto end; + } + cJSON_AddItemToArray(event_idsList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_nef_cond_t *OpenAPI_nef_cond_parseFromJSON(cJSON *nef_condJSON) +{ + OpenAPI_nef_cond_t *nef_cond_local_var = NULL; + cJSON *event_ids = cJSON_GetObjectItemCaseSensitive(nef_condJSON, "eventIds"); + + OpenAPI_list_t *event_idsList; + if (event_ids) { + cJSON *event_ids_local_nonprimitive; + if (!cJSON_IsArray(event_ids)) { + ogs_error("OpenAPI_nef_cond_parseFromJSON() failed [event_ids]"); + goto end; + } + + event_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_ids_local_nonprimitive, event_ids ) { + if (!cJSON_IsObject(event_ids_local_nonprimitive)) { + ogs_error("OpenAPI_nef_cond_parseFromJSON() failed [event_ids]"); + goto end; + } + OpenAPI_event_id_t *event_idsItem = OpenAPI_event_id_parseFromJSON(event_ids_local_nonprimitive); + + OpenAPI_list_add(event_idsList, event_idsItem); + } + } + + nef_cond_local_var = OpenAPI_nef_cond_create ( + event_ids ? event_idsList : NULL + ); + + return nef_cond_local_var; +end: + return NULL; +} + +OpenAPI_nef_cond_t *OpenAPI_nef_cond_copy(OpenAPI_nef_cond_t *dst, OpenAPI_nef_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nef_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nef_cond_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_nef_cond_free(dst); + dst = OpenAPI_nef_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nef_cond.h b/lib/sbi/openapi/model/nef_cond.h new file mode 100644 index 000000000..5c7d40fde --- /dev/null +++ b/lib/sbi/openapi/model/nef_cond.h @@ -0,0 +1,39 @@ +/* + * nef_cond.h + * + * Subscription to a set of NF Instances (NEFs), identified by Event ID(s) provided by AF. + */ + +#ifndef _OpenAPI_nef_cond_H_ +#define _OpenAPI_nef_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "event_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nef_cond_s OpenAPI_nef_cond_t; +typedef struct OpenAPI_nef_cond_s { + OpenAPI_list_t *event_ids; +} OpenAPI_nef_cond_t; + +OpenAPI_nef_cond_t *OpenAPI_nef_cond_create( + OpenAPI_list_t *event_ids + ); +void OpenAPI_nef_cond_free(OpenAPI_nef_cond_t *nef_cond); +OpenAPI_nef_cond_t *OpenAPI_nef_cond_parseFromJSON(cJSON *nef_condJSON); +cJSON *OpenAPI_nef_cond_convertToJSON(OpenAPI_nef_cond_t *nef_cond); +OpenAPI_nef_cond_t *OpenAPI_nef_cond_copy(OpenAPI_nef_cond_t *dst, OpenAPI_nef_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nef_cond_H_ */ + diff --git a/lib/sbi/openapi/model/nef_info.c b/lib/sbi/openapi/model/nef_info.c index d2f8609ee..622aee92a 100644 --- a/lib/sbi/openapi/model/nef_info.c +++ b/lib/sbi/openapi/model/nef_info.c @@ -7,7 +7,10 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_create( char *nef_id, OpenAPI_pfd_data_t *pfd_data, - OpenAPI_af_event_exposure_data_t *af_ee_data + OpenAPI_af_event_exposure_data_t *af_ee_data, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *served_fqdn_list ) { OpenAPI_nef_info_t *nef_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_nef_info_t)); @@ -17,6 +20,9 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_create( nef_info_local_var->nef_id = nef_id; nef_info_local_var->pfd_data = pfd_data; nef_info_local_var->af_ee_data = af_ee_data; + nef_info_local_var->gpsi_ranges = gpsi_ranges; + nef_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + nef_info_local_var->served_fqdn_list = served_fqdn_list; return nef_info_local_var; } @@ -30,6 +36,18 @@ void OpenAPI_nef_info_free(OpenAPI_nef_info_t *nef_info) ogs_free(nef_info->nef_id); OpenAPI_pfd_data_free(nef_info->pfd_data); OpenAPI_af_event_exposure_data_free(nef_info->af_ee_data); + OpenAPI_list_for_each(nef_info->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nef_info->gpsi_ranges); + OpenAPI_list_for_each(nef_info->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nef_info->external_group_identifiers_ranges); + OpenAPI_list_for_each(nef_info->served_fqdn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nef_info->served_fqdn_list); ogs_free(nef_info); } @@ -76,6 +94,62 @@ cJSON *OpenAPI_nef_info_convertToJSON(OpenAPI_nef_info_t *nef_info) } } + if (nef_info->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *gpsi_ranges_node; + if (nef_info->gpsi_ranges) { + OpenAPI_list_for_each(nef_info->gpsi_ranges, gpsi_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(gpsi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + } + + if (nef_info->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + OpenAPI_lnode_t *external_group_identifiers_ranges_node; + if (nef_info->external_group_identifiers_ranges) { + OpenAPI_list_for_each(nef_info->external_group_identifiers_ranges, external_group_identifiers_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(external_group_identifiers_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + } + + if (nef_info->served_fqdn_list) { + cJSON *served_fqdn_list = cJSON_AddArrayToObject(item, "servedFqdnList"); + if (served_fqdn_list == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [served_fqdn_list]"); + goto end; + } + + OpenAPI_lnode_t *served_fqdn_list_node; + OpenAPI_list_for_each(nef_info->served_fqdn_list, served_fqdn_list_node) { + if (cJSON_AddStringToObject(served_fqdn_list, "", (char*)served_fqdn_list_node->data) == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [served_fqdn_list]"); + goto end; + } + } + } + end: return item; } @@ -106,10 +180,79 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_parseFromJSON(cJSON *nef_infoJSON) af_ee_data_local_nonprim = OpenAPI_af_event_exposure_data_parseFromJSON(af_ee_data); } + cJSON *gpsi_ranges = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "gpsiRanges"); + + OpenAPI_list_t *gpsi_rangesList; + if (gpsi_ranges) { + cJSON *gpsi_ranges_local_nonprimitive; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local_nonprimitive, gpsi_ranges ) { + if (!cJSON_IsObject(gpsi_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local_nonprimitive); + + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + cJSON *external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "externalGroupIdentifiersRanges"); + + OpenAPI_list_t *external_group_identifiers_rangesList; + if (external_group_identifiers_ranges) { + cJSON *external_group_identifiers_ranges_local_nonprimitive; + if (!cJSON_IsArray(external_group_identifiers_ranges)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + external_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(external_group_identifiers_ranges_local_nonprimitive, external_group_identifiers_ranges ) { + if (!cJSON_IsObject(external_group_identifiers_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local_nonprimitive); + + OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); + } + } + + cJSON *served_fqdn_list = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "servedFqdnList"); + + OpenAPI_list_t *served_fqdn_listList; + if (served_fqdn_list) { + cJSON *served_fqdn_list_local; + if (!cJSON_IsArray(served_fqdn_list)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [served_fqdn_list]"); + goto end; + } + served_fqdn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(served_fqdn_list_local, served_fqdn_list) { + if (!cJSON_IsString(served_fqdn_list_local)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [served_fqdn_list]"); + goto end; + } + OpenAPI_list_add(served_fqdn_listList, ogs_strdup(served_fqdn_list_local->valuestring)); + } + } + nef_info_local_var = OpenAPI_nef_info_create ( nef_id ? ogs_strdup(nef_id->valuestring) : NULL, pfd_data ? pfd_data_local_nonprim : NULL, - af_ee_data ? af_ee_data_local_nonprim : NULL + af_ee_data ? af_ee_data_local_nonprim : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + served_fqdn_list ? served_fqdn_listList : NULL ); return nef_info_local_var; diff --git a/lib/sbi/openapi/model/nef_info.h b/lib/sbi/openapi/model/nef_info.h index da1bb61f4..82f9a556f 100644 --- a/lib/sbi/openapi/model/nef_info.h +++ b/lib/sbi/openapi/model/nef_info.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "af_event_exposure_data.h" +#include "identity_range.h" #include "pfd_data.h" #ifdef __cplusplus @@ -24,12 +25,18 @@ typedef struct OpenAPI_nef_info_s { char *nef_id; struct OpenAPI_pfd_data_s *pfd_data; struct OpenAPI_af_event_exposure_data_s *af_ee_data; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + OpenAPI_list_t *served_fqdn_list; } OpenAPI_nef_info_t; OpenAPI_nef_info_t *OpenAPI_nef_info_create( char *nef_id, OpenAPI_pfd_data_t *pfd_data, - OpenAPI_af_event_exposure_data_t *af_ee_data + OpenAPI_af_event_exposure_data_t *af_ee_data, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *served_fqdn_list ); void OpenAPI_nef_info_free(OpenAPI_nef_info_t *nef_info); OpenAPI_nef_info_t *OpenAPI_nef_info_parseFromJSON(cJSON *nef_infoJSON); diff --git a/lib/sbi/openapi/model/nf_instance_id_list_cond.c b/lib/sbi/openapi/model/nf_instance_id_list_cond.c new file mode 100644 index 000000000..b5e1d846b --- /dev/null +++ b/lib/sbi/openapi/model/nf_instance_id_list_cond.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "nf_instance_id_list_cond.h" + +OpenAPI_nf_instance_id_list_cond_t *OpenAPI_nf_instance_id_list_cond_create( + OpenAPI_list_t *nf_instance_id_list + ) +{ + OpenAPI_nf_instance_id_list_cond_t *nf_instance_id_list_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_instance_id_list_cond_t)); + if (!nf_instance_id_list_cond_local_var) { + return NULL; + } + nf_instance_id_list_cond_local_var->nf_instance_id_list = nf_instance_id_list; + + return nf_instance_id_list_cond_local_var; +} + +void OpenAPI_nf_instance_id_list_cond_free(OpenAPI_nf_instance_id_list_cond_t *nf_instance_id_list_cond) +{ + if (NULL == nf_instance_id_list_cond) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(nf_instance_id_list_cond->nf_instance_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_instance_id_list_cond->nf_instance_id_list); + ogs_free(nf_instance_id_list_cond); +} + +cJSON *OpenAPI_nf_instance_id_list_cond_convertToJSON(OpenAPI_nf_instance_id_list_cond_t *nf_instance_id_list_cond) +{ + cJSON *item = NULL; + + if (nf_instance_id_list_cond == NULL) { + ogs_error("OpenAPI_nf_instance_id_list_cond_convertToJSON() failed [NfInstanceIdListCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nf_instance_id_list_cond->nf_instance_id_list) { + ogs_error("OpenAPI_nf_instance_id_list_cond_convertToJSON() failed [nf_instance_id_list]"); + goto end; + } + cJSON *nf_instance_id_list = cJSON_AddArrayToObject(item, "nfInstanceIdList"); + if (nf_instance_id_list == NULL) { + ogs_error("OpenAPI_nf_instance_id_list_cond_convertToJSON() failed [nf_instance_id_list]"); + goto end; + } + + OpenAPI_lnode_t *nf_instance_id_list_node; + OpenAPI_list_for_each(nf_instance_id_list_cond->nf_instance_id_list, nf_instance_id_list_node) { + if (cJSON_AddStringToObject(nf_instance_id_list, "", (char*)nf_instance_id_list_node->data) == NULL) { + ogs_error("OpenAPI_nf_instance_id_list_cond_convertToJSON() failed [nf_instance_id_list]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nf_instance_id_list_cond_t *OpenAPI_nf_instance_id_list_cond_parseFromJSON(cJSON *nf_instance_id_list_condJSON) +{ + OpenAPI_nf_instance_id_list_cond_t *nf_instance_id_list_cond_local_var = NULL; + cJSON *nf_instance_id_list = cJSON_GetObjectItemCaseSensitive(nf_instance_id_list_condJSON, "nfInstanceIdList"); + if (!nf_instance_id_list) { + ogs_error("OpenAPI_nf_instance_id_list_cond_parseFromJSON() failed [nf_instance_id_list]"); + goto end; + } + + OpenAPI_list_t *nf_instance_id_listList; + + cJSON *nf_instance_id_list_local; + if (!cJSON_IsArray(nf_instance_id_list)) { + ogs_error("OpenAPI_nf_instance_id_list_cond_parseFromJSON() failed [nf_instance_id_list]"); + goto end; + } + nf_instance_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_instance_id_list_local, nf_instance_id_list) { + if (!cJSON_IsString(nf_instance_id_list_local)) { + ogs_error("OpenAPI_nf_instance_id_list_cond_parseFromJSON() failed [nf_instance_id_list]"); + goto end; + } + OpenAPI_list_add(nf_instance_id_listList, ogs_strdup(nf_instance_id_list_local->valuestring)); + } + + nf_instance_id_list_cond_local_var = OpenAPI_nf_instance_id_list_cond_create ( + nf_instance_id_listList + ); + + return nf_instance_id_list_cond_local_var; +end: + return NULL; +} + +OpenAPI_nf_instance_id_list_cond_t *OpenAPI_nf_instance_id_list_cond_copy(OpenAPI_nf_instance_id_list_cond_t *dst, OpenAPI_nf_instance_id_list_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_instance_id_list_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_instance_id_list_cond_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_nf_instance_id_list_cond_free(dst); + dst = OpenAPI_nf_instance_id_list_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_instance_id_list_cond.h b/lib/sbi/openapi/model/nf_instance_id_list_cond.h new file mode 100644 index 000000000..00152e46d --- /dev/null +++ b/lib/sbi/openapi/model/nf_instance_id_list_cond.h @@ -0,0 +1,38 @@ +/* + * nf_instance_id_list_cond.h + * + * Subscription to a list of NF Instances + */ + +#ifndef _OpenAPI_nf_instance_id_list_cond_H_ +#define _OpenAPI_nf_instance_id_list_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_instance_id_list_cond_s OpenAPI_nf_instance_id_list_cond_t; +typedef struct OpenAPI_nf_instance_id_list_cond_s { + OpenAPI_list_t *nf_instance_id_list; +} OpenAPI_nf_instance_id_list_cond_t; + +OpenAPI_nf_instance_id_list_cond_t *OpenAPI_nf_instance_id_list_cond_create( + OpenAPI_list_t *nf_instance_id_list + ); +void OpenAPI_nf_instance_id_list_cond_free(OpenAPI_nf_instance_id_list_cond_t *nf_instance_id_list_cond); +OpenAPI_nf_instance_id_list_cond_t *OpenAPI_nf_instance_id_list_cond_parseFromJSON(cJSON *nf_instance_id_list_condJSON); +cJSON *OpenAPI_nf_instance_id_list_cond_convertToJSON(OpenAPI_nf_instance_id_list_cond_t *nf_instance_id_list_cond); +OpenAPI_nf_instance_id_list_cond_t *OpenAPI_nf_instance_id_list_cond_copy(OpenAPI_nf_instance_id_list_cond_t *dst, OpenAPI_nf_instance_id_list_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_instance_id_list_cond_H_ */ + diff --git a/lib/sbi/openapi/model/nf_profile.c b/lib/sbi/openapi/model/nf_profile.c index 3b12c965f..c9ea44f1b 100644 --- a/lib/sbi/openapi/model/nf_profile.c +++ b/lib/sbi/openapi/model/nf_profile.c @@ -30,34 +30,35 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( char *load_time_stamp, char *locality, OpenAPI_udr_info_t *udr_info, - OpenAPI_list_t *udr_info_ext, + OpenAPI_list_t* udr_info_list, OpenAPI_udm_info_t *udm_info, - OpenAPI_list_t *udm_info_ext, + OpenAPI_list_t* udm_info_list, OpenAPI_ausf_info_t *ausf_info, - OpenAPI_list_t *ausf_info_ext, + OpenAPI_list_t* ausf_info_list, OpenAPI_amf_info_t *amf_info, - OpenAPI_list_t *amf_info_ext, + OpenAPI_list_t* amf_info_list, OpenAPI_smf_info_t *smf_info, - OpenAPI_list_t *smf_info_ext, + OpenAPI_list_t* smf_info_list, OpenAPI_upf_info_t *upf_info, - OpenAPI_list_t *upf_info_ext, + OpenAPI_list_t* upf_info_list, OpenAPI_pcf_info_t *pcf_info, - OpenAPI_list_t *pcf_info_ext, + OpenAPI_list_t* pcf_info_list, OpenAPI_bsf_info_t *bsf_info, - OpenAPI_list_t *bsf_info_ext, + OpenAPI_list_t* bsf_info_list, OpenAPI_chf_info_t *chf_info, - OpenAPI_list_t *chf_info_ext, + OpenAPI_list_t* chf_info_list, OpenAPI_nef_info_t *nef_info, OpenAPI_nrf_info_t *nrf_info, OpenAPI_udsf_info_t *udsf_info, - OpenAPI_list_t *udsf_info_ext, + OpenAPI_list_t* udsf_info_list, OpenAPI_nwdaf_info_t *nwdaf_info, - OpenAPI_list_t *pcscf_info, - OpenAPI_list_t *hss_info, + OpenAPI_list_t* pcscf_info_list, + OpenAPI_list_t* hss_info_list, OpenAPI_object_t *custom_info, char *recovery_time, int nf_service_persistence, OpenAPI_list_t *nf_services, + OpenAPI_list_t* nf_service_list, int nf_profile_changes_support_ind, int nf_profile_changes_ind, OpenAPI_list_t *default_notification_subscriptions, @@ -66,7 +67,11 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( OpenAPI_list_t *nf_set_id_list, OpenAPI_list_t *serving_scope, int lc_h_support_ind, - int olc_h_support_ind + int olc_h_support_ind, + OpenAPI_list_t* nf_set_recovery_time_list, + OpenAPI_list_t* service_set_recovery_time_list, + OpenAPI_list_t *scp_domains, + OpenAPI_scp_info_t *scp_info ) { OpenAPI_nf_profile_t *nf_profile_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_profile_t)); @@ -98,34 +103,35 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( nf_profile_local_var->load_time_stamp = load_time_stamp; nf_profile_local_var->locality = locality; nf_profile_local_var->udr_info = udr_info; - nf_profile_local_var->udr_info_ext = udr_info_ext; + nf_profile_local_var->udr_info_list = udr_info_list; nf_profile_local_var->udm_info = udm_info; - nf_profile_local_var->udm_info_ext = udm_info_ext; + nf_profile_local_var->udm_info_list = udm_info_list; nf_profile_local_var->ausf_info = ausf_info; - nf_profile_local_var->ausf_info_ext = ausf_info_ext; + nf_profile_local_var->ausf_info_list = ausf_info_list; nf_profile_local_var->amf_info = amf_info; - nf_profile_local_var->amf_info_ext = amf_info_ext; + nf_profile_local_var->amf_info_list = amf_info_list; nf_profile_local_var->smf_info = smf_info; - nf_profile_local_var->smf_info_ext = smf_info_ext; + nf_profile_local_var->smf_info_list = smf_info_list; nf_profile_local_var->upf_info = upf_info; - nf_profile_local_var->upf_info_ext = upf_info_ext; + nf_profile_local_var->upf_info_list = upf_info_list; nf_profile_local_var->pcf_info = pcf_info; - nf_profile_local_var->pcf_info_ext = pcf_info_ext; + nf_profile_local_var->pcf_info_list = pcf_info_list; nf_profile_local_var->bsf_info = bsf_info; - nf_profile_local_var->bsf_info_ext = bsf_info_ext; + nf_profile_local_var->bsf_info_list = bsf_info_list; nf_profile_local_var->chf_info = chf_info; - nf_profile_local_var->chf_info_ext = chf_info_ext; + nf_profile_local_var->chf_info_list = chf_info_list; nf_profile_local_var->nef_info = nef_info; nf_profile_local_var->nrf_info = nrf_info; nf_profile_local_var->udsf_info = udsf_info; - nf_profile_local_var->udsf_info_ext = udsf_info_ext; + nf_profile_local_var->udsf_info_list = udsf_info_list; nf_profile_local_var->nwdaf_info = nwdaf_info; - nf_profile_local_var->pcscf_info = pcscf_info; - nf_profile_local_var->hss_info = hss_info; + nf_profile_local_var->pcscf_info_list = pcscf_info_list; + nf_profile_local_var->hss_info_list = hss_info_list; nf_profile_local_var->custom_info = custom_info; nf_profile_local_var->recovery_time = recovery_time; nf_profile_local_var->nf_service_persistence = nf_service_persistence; nf_profile_local_var->nf_services = nf_services; + nf_profile_local_var->nf_service_list = nf_service_list; nf_profile_local_var->nf_profile_changes_support_ind = nf_profile_changes_support_ind; nf_profile_local_var->nf_profile_changes_ind = nf_profile_changes_ind; nf_profile_local_var->default_notification_subscriptions = default_notification_subscriptions; @@ -135,6 +141,10 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( nf_profile_local_var->serving_scope = serving_scope; nf_profile_local_var->lc_h_support_ind = lc_h_support_ind; nf_profile_local_var->olc_h_support_ind = olc_h_support_ind; + nf_profile_local_var->nf_set_recovery_time_list = nf_set_recovery_time_list; + nf_profile_local_var->service_set_recovery_time_list = service_set_recovery_time_list; + nf_profile_local_var->scp_domains = scp_domains; + nf_profile_local_var->scp_info = scp_info; return nf_profile_local_var; } @@ -156,7 +166,7 @@ void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile) } OpenAPI_list_free(nf_profile->snpn_list); OpenAPI_list_for_each(nf_profile->s_nssais, node) { - OpenAPI_snssai_free(node->data); + OpenAPI_ext_snssai_free(node->data); } OpenAPI_list_free(nf_profile->s_nssais); OpenAPI_list_for_each(nf_profile->per_plmn_snssai_list, node) { @@ -191,78 +201,108 @@ void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile) } OpenAPI_list_free(nf_profile->allowed_nf_domains); OpenAPI_list_for_each(nf_profile->allowed_nssais, node) { - OpenAPI_snssai_free(node->data); + OpenAPI_ext_snssai_free(node->data); } OpenAPI_list_free(nf_profile->allowed_nssais); ogs_free(nf_profile->load_time_stamp); ogs_free(nf_profile->locality); OpenAPI_udr_info_free(nf_profile->udr_info); - OpenAPI_list_for_each(nf_profile->udr_info_ext, node) { - OpenAPI_udr_info_free(node->data); + OpenAPI_list_for_each(nf_profile->udr_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_udr_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->udr_info_ext); + OpenAPI_list_free(nf_profile->udr_info_list); OpenAPI_udm_info_free(nf_profile->udm_info); - OpenAPI_list_for_each(nf_profile->udm_info_ext, node) { - OpenAPI_udm_info_free(node->data); + OpenAPI_list_for_each(nf_profile->udm_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_udm_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->udm_info_ext); + OpenAPI_list_free(nf_profile->udm_info_list); OpenAPI_ausf_info_free(nf_profile->ausf_info); - OpenAPI_list_for_each(nf_profile->ausf_info_ext, node) { - OpenAPI_ausf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->ausf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_ausf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->ausf_info_ext); + OpenAPI_list_free(nf_profile->ausf_info_list); OpenAPI_amf_info_free(nf_profile->amf_info); - OpenAPI_list_for_each(nf_profile->amf_info_ext, node) { - OpenAPI_amf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->amf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_amf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->amf_info_ext); + OpenAPI_list_free(nf_profile->amf_info_list); OpenAPI_smf_info_free(nf_profile->smf_info); - OpenAPI_list_for_each(nf_profile->smf_info_ext, node) { - OpenAPI_smf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->smf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_smf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->smf_info_ext); + OpenAPI_list_free(nf_profile->smf_info_list); OpenAPI_upf_info_free(nf_profile->upf_info); - OpenAPI_list_for_each(nf_profile->upf_info_ext, node) { - OpenAPI_upf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->upf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_upf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->upf_info_ext); + OpenAPI_list_free(nf_profile->upf_info_list); OpenAPI_pcf_info_free(nf_profile->pcf_info); - OpenAPI_list_for_each(nf_profile->pcf_info_ext, node) { - OpenAPI_pcf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->pcf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_pcf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->pcf_info_ext); + OpenAPI_list_free(nf_profile->pcf_info_list); OpenAPI_bsf_info_free(nf_profile->bsf_info); - OpenAPI_list_for_each(nf_profile->bsf_info_ext, node) { - OpenAPI_bsf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->bsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_bsf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->bsf_info_ext); + OpenAPI_list_free(nf_profile->bsf_info_list); OpenAPI_chf_info_free(nf_profile->chf_info); - OpenAPI_list_for_each(nf_profile->chf_info_ext, node) { - OpenAPI_chf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->chf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_chf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->chf_info_ext); + OpenAPI_list_free(nf_profile->chf_info_list); OpenAPI_nef_info_free(nf_profile->nef_info); OpenAPI_nrf_info_free(nf_profile->nrf_info); OpenAPI_udsf_info_free(nf_profile->udsf_info); - OpenAPI_list_for_each(nf_profile->udsf_info_ext, node) { - OpenAPI_udsf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->udsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_udsf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->udsf_info_ext); + OpenAPI_list_free(nf_profile->udsf_info_list); OpenAPI_nwdaf_info_free(nf_profile->nwdaf_info); - OpenAPI_list_for_each(nf_profile->pcscf_info, node) { - OpenAPI_pcscf_info_free(node->data); + OpenAPI_list_for_each(nf_profile->pcscf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_pcscf_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->pcscf_info); - OpenAPI_list_for_each(nf_profile->hss_info, node) { - OpenAPI_hss_info_free(node->data); + OpenAPI_list_free(nf_profile->pcscf_info_list); + OpenAPI_list_for_each(nf_profile->hss_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_hss_info_free(localKeyValue->value); + ogs_free(localKeyValue); } - OpenAPI_list_free(nf_profile->hss_info); + OpenAPI_list_free(nf_profile->hss_info_list); OpenAPI_object_free(nf_profile->custom_info); ogs_free(nf_profile->recovery_time); OpenAPI_list_for_each(nf_profile->nf_services, node) { OpenAPI_nf_service_free(node->data); } OpenAPI_list_free(nf_profile->nf_services); + OpenAPI_list_for_each(nf_profile->nf_service_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_nf_service_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->nf_service_list); OpenAPI_list_for_each(nf_profile->default_notification_subscriptions, node) { OpenAPI_default_notification_subscription_free(node->data); } @@ -277,6 +317,23 @@ void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile) ogs_free(node->data); } OpenAPI_list_free(nf_profile->serving_scope); + OpenAPI_list_for_each(nf_profile->nf_set_recovery_time_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->nf_set_recovery_time_list); + OpenAPI_list_for_each(nf_profile->service_set_recovery_time_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->service_set_recovery_time_list); + OpenAPI_list_for_each(nf_profile->scp_domains, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_profile->scp_domains); + OpenAPI_scp_info_free(nf_profile->scp_info); ogs_free(nf_profile); } @@ -381,7 +438,7 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) OpenAPI_lnode_t *s_nssais_node; if (nf_profile->s_nssais) { OpenAPI_list_for_each(nf_profile->s_nssais, s_nssais_node) { - cJSON *itemLocal = OpenAPI_snssai_convertToJSON(s_nssais_node->data); + cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(s_nssais_node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [s_nssais]"); goto end; @@ -554,7 +611,7 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) OpenAPI_lnode_t *allowed_nssais_node; if (nf_profile->allowed_nssais) { OpenAPI_list_for_each(nf_profile->allowed_nssais, allowed_nssais_node) { - cJSON *itemLocal = OpenAPI_snssai_convertToJSON(allowed_nssais_node->data); + cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(allowed_nssais_node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_nssais]"); goto end; @@ -612,22 +669,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->udr_info_ext) { - cJSON *udr_info_extList = cJSON_AddArrayToObject(item, "udrInfoExt"); - if (udr_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udr_info_ext]"); + if (nf_profile->udr_info_list) { + cJSON *udr_info_list = cJSON_AddObjectToObject(item, "udrInfoList"); + if (udr_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udr_info_list]"); goto end; } - - OpenAPI_lnode_t *udr_info_ext_node; - if (nf_profile->udr_info_ext) { - OpenAPI_list_for_each(nf_profile->udr_info_ext, udr_info_ext_node) { - cJSON *itemLocal = OpenAPI_udr_info_convertToJSON(udr_info_ext_node->data); + cJSON *localMapObject = udr_info_list; + OpenAPI_lnode_t *udr_info_list_node; + if (nf_profile->udr_info_list) { + OpenAPI_list_for_each(nf_profile->udr_info_list, udr_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)udr_info_list_node->data; + cJSON *itemLocal = OpenAPI_udr_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udr_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udr_info_list]"); goto end; } - cJSON_AddItemToArray(udr_info_extList, itemLocal); + cJSON_AddItemToObject(udr_info_list, localKeyValue->key, itemLocal); } } } @@ -645,22 +703,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->udm_info_ext) { - cJSON *udm_info_extList = cJSON_AddArrayToObject(item, "udmInfoExt"); - if (udm_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udm_info_ext]"); + if (nf_profile->udm_info_list) { + cJSON *udm_info_list = cJSON_AddObjectToObject(item, "udmInfoList"); + if (udm_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udm_info_list]"); goto end; } - - OpenAPI_lnode_t *udm_info_ext_node; - if (nf_profile->udm_info_ext) { - OpenAPI_list_for_each(nf_profile->udm_info_ext, udm_info_ext_node) { - cJSON *itemLocal = OpenAPI_udm_info_convertToJSON(udm_info_ext_node->data); + cJSON *localMapObject = udm_info_list; + OpenAPI_lnode_t *udm_info_list_node; + if (nf_profile->udm_info_list) { + OpenAPI_list_for_each(nf_profile->udm_info_list, udm_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)udm_info_list_node->data; + cJSON *itemLocal = OpenAPI_udm_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udm_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udm_info_list]"); goto end; } - cJSON_AddItemToArray(udm_info_extList, itemLocal); + cJSON_AddItemToObject(udm_info_list, localKeyValue->key, itemLocal); } } } @@ -678,22 +737,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->ausf_info_ext) { - cJSON *ausf_info_extList = cJSON_AddArrayToObject(item, "ausfInfoExt"); - if (ausf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ausf_info_ext]"); + if (nf_profile->ausf_info_list) { + cJSON *ausf_info_list = cJSON_AddObjectToObject(item, "ausfInfoList"); + if (ausf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ausf_info_list]"); goto end; } - - OpenAPI_lnode_t *ausf_info_ext_node; - if (nf_profile->ausf_info_ext) { - OpenAPI_list_for_each(nf_profile->ausf_info_ext, ausf_info_ext_node) { - cJSON *itemLocal = OpenAPI_ausf_info_convertToJSON(ausf_info_ext_node->data); + cJSON *localMapObject = ausf_info_list; + OpenAPI_lnode_t *ausf_info_list_node; + if (nf_profile->ausf_info_list) { + OpenAPI_list_for_each(nf_profile->ausf_info_list, ausf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)ausf_info_list_node->data; + cJSON *itemLocal = OpenAPI_ausf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ausf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ausf_info_list]"); goto end; } - cJSON_AddItemToArray(ausf_info_extList, itemLocal); + cJSON_AddItemToObject(ausf_info_list, localKeyValue->key, itemLocal); } } } @@ -711,22 +771,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->amf_info_ext) { - cJSON *amf_info_extList = cJSON_AddArrayToObject(item, "amfInfoExt"); - if (amf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [amf_info_ext]"); + if (nf_profile->amf_info_list) { + cJSON *amf_info_list = cJSON_AddObjectToObject(item, "amfInfoList"); + if (amf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [amf_info_list]"); goto end; } - - OpenAPI_lnode_t *amf_info_ext_node; - if (nf_profile->amf_info_ext) { - OpenAPI_list_for_each(nf_profile->amf_info_ext, amf_info_ext_node) { - cJSON *itemLocal = OpenAPI_amf_info_convertToJSON(amf_info_ext_node->data); + cJSON *localMapObject = amf_info_list; + OpenAPI_lnode_t *amf_info_list_node; + if (nf_profile->amf_info_list) { + OpenAPI_list_for_each(nf_profile->amf_info_list, amf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)amf_info_list_node->data; + cJSON *itemLocal = OpenAPI_amf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [amf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [amf_info_list]"); goto end; } - cJSON_AddItemToArray(amf_info_extList, itemLocal); + cJSON_AddItemToObject(amf_info_list, localKeyValue->key, itemLocal); } } } @@ -744,22 +805,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->smf_info_ext) { - cJSON *smf_info_extList = cJSON_AddArrayToObject(item, "smfInfoExt"); - if (smf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [smf_info_ext]"); + if (nf_profile->smf_info_list) { + cJSON *smf_info_list = cJSON_AddObjectToObject(item, "smfInfoList"); + if (smf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [smf_info_list]"); goto end; } - - OpenAPI_lnode_t *smf_info_ext_node; - if (nf_profile->smf_info_ext) { - OpenAPI_list_for_each(nf_profile->smf_info_ext, smf_info_ext_node) { - cJSON *itemLocal = OpenAPI_smf_info_convertToJSON(smf_info_ext_node->data); + cJSON *localMapObject = smf_info_list; + OpenAPI_lnode_t *smf_info_list_node; + if (nf_profile->smf_info_list) { + OpenAPI_list_for_each(nf_profile->smf_info_list, smf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)smf_info_list_node->data; + cJSON *itemLocal = OpenAPI_smf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [smf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [smf_info_list]"); goto end; } - cJSON_AddItemToArray(smf_info_extList, itemLocal); + cJSON_AddItemToObject(smf_info_list, localKeyValue->key, itemLocal); } } } @@ -777,22 +839,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->upf_info_ext) { - cJSON *upf_info_extList = cJSON_AddArrayToObject(item, "upfInfoExt"); - if (upf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [upf_info_ext]"); + if (nf_profile->upf_info_list) { + cJSON *upf_info_list = cJSON_AddObjectToObject(item, "upfInfoList"); + if (upf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [upf_info_list]"); goto end; } - - OpenAPI_lnode_t *upf_info_ext_node; - if (nf_profile->upf_info_ext) { - OpenAPI_list_for_each(nf_profile->upf_info_ext, upf_info_ext_node) { - cJSON *itemLocal = OpenAPI_upf_info_convertToJSON(upf_info_ext_node->data); + cJSON *localMapObject = upf_info_list; + OpenAPI_lnode_t *upf_info_list_node; + if (nf_profile->upf_info_list) { + OpenAPI_list_for_each(nf_profile->upf_info_list, upf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)upf_info_list_node->data; + cJSON *itemLocal = OpenAPI_upf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [upf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [upf_info_list]"); goto end; } - cJSON_AddItemToArray(upf_info_extList, itemLocal); + cJSON_AddItemToObject(upf_info_list, localKeyValue->key, itemLocal); } } } @@ -810,22 +873,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->pcf_info_ext) { - cJSON *pcf_info_extList = cJSON_AddArrayToObject(item, "pcfInfoExt"); - if (pcf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcf_info_ext]"); + if (nf_profile->pcf_info_list) { + cJSON *pcf_info_list = cJSON_AddObjectToObject(item, "pcfInfoList"); + if (pcf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcf_info_list]"); goto end; } - - OpenAPI_lnode_t *pcf_info_ext_node; - if (nf_profile->pcf_info_ext) { - OpenAPI_list_for_each(nf_profile->pcf_info_ext, pcf_info_ext_node) { - cJSON *itemLocal = OpenAPI_pcf_info_convertToJSON(pcf_info_ext_node->data); + cJSON *localMapObject = pcf_info_list; + OpenAPI_lnode_t *pcf_info_list_node; + if (nf_profile->pcf_info_list) { + OpenAPI_list_for_each(nf_profile->pcf_info_list, pcf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)pcf_info_list_node->data; + cJSON *itemLocal = OpenAPI_pcf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcf_info_list]"); goto end; } - cJSON_AddItemToArray(pcf_info_extList, itemLocal); + cJSON_AddItemToObject(pcf_info_list, localKeyValue->key, itemLocal); } } } @@ -843,22 +907,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->bsf_info_ext) { - cJSON *bsf_info_extList = cJSON_AddArrayToObject(item, "bsfInfoExt"); - if (bsf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [bsf_info_ext]"); + if (nf_profile->bsf_info_list) { + cJSON *bsf_info_list = cJSON_AddObjectToObject(item, "bsfInfoList"); + if (bsf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [bsf_info_list]"); goto end; } - - OpenAPI_lnode_t *bsf_info_ext_node; - if (nf_profile->bsf_info_ext) { - OpenAPI_list_for_each(nf_profile->bsf_info_ext, bsf_info_ext_node) { - cJSON *itemLocal = OpenAPI_bsf_info_convertToJSON(bsf_info_ext_node->data); + cJSON *localMapObject = bsf_info_list; + OpenAPI_lnode_t *bsf_info_list_node; + if (nf_profile->bsf_info_list) { + OpenAPI_list_for_each(nf_profile->bsf_info_list, bsf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)bsf_info_list_node->data; + cJSON *itemLocal = OpenAPI_bsf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [bsf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [bsf_info_list]"); goto end; } - cJSON_AddItemToArray(bsf_info_extList, itemLocal); + cJSON_AddItemToObject(bsf_info_list, localKeyValue->key, itemLocal); } } } @@ -876,22 +941,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->chf_info_ext) { - cJSON *chf_info_extList = cJSON_AddArrayToObject(item, "chfInfoExt"); - if (chf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [chf_info_ext]"); + if (nf_profile->chf_info_list) { + cJSON *chf_info_list = cJSON_AddObjectToObject(item, "chfInfoList"); + if (chf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [chf_info_list]"); goto end; } - - OpenAPI_lnode_t *chf_info_ext_node; - if (nf_profile->chf_info_ext) { - OpenAPI_list_for_each(nf_profile->chf_info_ext, chf_info_ext_node) { - cJSON *itemLocal = OpenAPI_chf_info_convertToJSON(chf_info_ext_node->data); + cJSON *localMapObject = chf_info_list; + OpenAPI_lnode_t *chf_info_list_node; + if (nf_profile->chf_info_list) { + OpenAPI_list_for_each(nf_profile->chf_info_list, chf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)chf_info_list_node->data; + cJSON *itemLocal = OpenAPI_chf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [chf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [chf_info_list]"); goto end; } - cJSON_AddItemToArray(chf_info_extList, itemLocal); + cJSON_AddItemToObject(chf_info_list, localKeyValue->key, itemLocal); } } } @@ -935,22 +1001,23 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->udsf_info_ext) { - cJSON *udsf_info_extList = cJSON_AddArrayToObject(item, "udsfInfoExt"); - if (udsf_info_extList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udsf_info_ext]"); + if (nf_profile->udsf_info_list) { + cJSON *udsf_info_list = cJSON_AddObjectToObject(item, "udsfInfoList"); + if (udsf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udsf_info_list]"); goto end; } - - OpenAPI_lnode_t *udsf_info_ext_node; - if (nf_profile->udsf_info_ext) { - OpenAPI_list_for_each(nf_profile->udsf_info_ext, udsf_info_ext_node) { - cJSON *itemLocal = OpenAPI_udsf_info_convertToJSON(udsf_info_ext_node->data); + cJSON *localMapObject = udsf_info_list; + OpenAPI_lnode_t *udsf_info_list_node; + if (nf_profile->udsf_info_list) { + OpenAPI_list_for_each(nf_profile->udsf_info_list, udsf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)udsf_info_list_node->data; + cJSON *itemLocal = OpenAPI_udsf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udsf_info_ext]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udsf_info_list]"); goto end; } - cJSON_AddItemToArray(udsf_info_extList, itemLocal); + cJSON_AddItemToObject(udsf_info_list, localKeyValue->key, itemLocal); } } } @@ -968,42 +1035,44 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } - if (nf_profile->pcscf_info) { - cJSON *pcscf_infoList = cJSON_AddArrayToObject(item, "pcscfInfo"); - if (pcscf_infoList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcscf_info]"); + if (nf_profile->pcscf_info_list) { + cJSON *pcscf_info_list = cJSON_AddObjectToObject(item, "pcscfInfoList"); + if (pcscf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcscf_info_list]"); goto end; } - - OpenAPI_lnode_t *pcscf_info_node; - if (nf_profile->pcscf_info) { - OpenAPI_list_for_each(nf_profile->pcscf_info, pcscf_info_node) { - cJSON *itemLocal = OpenAPI_pcscf_info_convertToJSON(pcscf_info_node->data); + cJSON *localMapObject = pcscf_info_list; + OpenAPI_lnode_t *pcscf_info_list_node; + if (nf_profile->pcscf_info_list) { + OpenAPI_list_for_each(nf_profile->pcscf_info_list, pcscf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)pcscf_info_list_node->data; + cJSON *itemLocal = OpenAPI_pcscf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcscf_info]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcscf_info_list]"); goto end; } - cJSON_AddItemToArray(pcscf_infoList, itemLocal); + cJSON_AddItemToObject(pcscf_info_list, localKeyValue->key, itemLocal); } } } - if (nf_profile->hss_info) { - cJSON *hss_infoList = cJSON_AddArrayToObject(item, "hssInfo"); - if (hss_infoList == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [hss_info]"); + if (nf_profile->hss_info_list) { + cJSON *hss_info_list = cJSON_AddObjectToObject(item, "hssInfoList"); + if (hss_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [hss_info_list]"); goto end; } - - OpenAPI_lnode_t *hss_info_node; - if (nf_profile->hss_info) { - OpenAPI_list_for_each(nf_profile->hss_info, hss_info_node) { - cJSON *itemLocal = OpenAPI_hss_info_convertToJSON(hss_info_node->data); + cJSON *localMapObject = hss_info_list; + OpenAPI_lnode_t *hss_info_list_node; + if (nf_profile->hss_info_list) { + OpenAPI_list_for_each(nf_profile->hss_info_list, hss_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)hss_info_list_node->data; + cJSON *itemLocal = OpenAPI_hss_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nf_profile_convertToJSON() failed [hss_info]"); + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [hss_info_list]"); goto end; } - cJSON_AddItemToArray(hss_infoList, itemLocal); + cJSON_AddItemToObject(hss_info_list, localKeyValue->key, itemLocal); } } } @@ -1055,6 +1124,27 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } + if (nf_profile->nf_service_list) { + cJSON *nf_service_list = cJSON_AddObjectToObject(item, "nfServiceList"); + if (nf_service_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_service_list]"); + goto end; + } + cJSON *localMapObject = nf_service_list; + OpenAPI_lnode_t *nf_service_list_node; + if (nf_profile->nf_service_list) { + OpenAPI_list_for_each(nf_profile->nf_service_list, nf_service_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)nf_service_list_node->data; + cJSON *itemLocal = OpenAPI_nf_service_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_service_list]"); + goto end; + } + cJSON_AddItemToObject(nf_service_list, localKeyValue->key, itemLocal); + } + } + } + if (nf_profile->nf_profile_changes_support_ind) { if (cJSON_AddBoolToObject(item, "nfProfileChangesSupportInd", nf_profile->nf_profile_changes_support_ind) == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_profile_changes_support_ind]"); @@ -1161,6 +1251,65 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } + if (nf_profile->nf_set_recovery_time_list) { + cJSON *nf_set_recovery_time_list = cJSON_AddObjectToObject(item, "nfSetRecoveryTimeList"); + if (nf_set_recovery_time_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_set_recovery_time_list]"); + goto end; + } + cJSON *localMapObject = nf_set_recovery_time_list; + OpenAPI_lnode_t *nf_set_recovery_time_list_node; + if (nf_profile->nf_set_recovery_time_list) { + OpenAPI_list_for_each(nf_profile->nf_set_recovery_time_list, nf_set_recovery_time_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)nf_set_recovery_time_list_node->data; + } + } + } + + if (nf_profile->service_set_recovery_time_list) { + cJSON *service_set_recovery_time_list = cJSON_AddObjectToObject(item, "serviceSetRecoveryTimeList"); + if (service_set_recovery_time_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [service_set_recovery_time_list]"); + goto end; + } + cJSON *localMapObject = service_set_recovery_time_list; + OpenAPI_lnode_t *service_set_recovery_time_list_node; + if (nf_profile->service_set_recovery_time_list) { + OpenAPI_list_for_each(nf_profile->service_set_recovery_time_list, service_set_recovery_time_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)service_set_recovery_time_list_node->data; + } + } + } + + if (nf_profile->scp_domains) { + cJSON *scp_domains = cJSON_AddArrayToObject(item, "scpDomains"); + if (scp_domains == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [scp_domains]"); + goto end; + } + + OpenAPI_lnode_t *scp_domains_node; + OpenAPI_list_for_each(nf_profile->scp_domains, scp_domains_node) { + if (cJSON_AddStringToObject(scp_domains, "", (char*)scp_domains_node->data) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [scp_domains]"); + goto end; + } + } + } + + if (nf_profile->scp_info) { + cJSON *scp_info_local_JSON = OpenAPI_scp_info_convertToJSON(nf_profile->scp_info); + if (scp_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [scp_info]"); + goto end; + } + cJSON_AddItemToObject(item, "scpInfo", scp_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [scp_info]"); + goto end; + } + } + end: return item; } @@ -1289,7 +1438,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [s_nssais]"); goto end; } - OpenAPI_snssai_t *s_nssaisItem = OpenAPI_snssai_parseFromJSON(s_nssais_local_nonprimitive); + OpenAPI_ext_snssai_t *s_nssaisItem = OpenAPI_ext_snssai_parseFromJSON(s_nssais_local_nonprimitive); OpenAPI_list_add(s_nssaisList, s_nssaisItem); } @@ -1501,7 +1650,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_nssais]"); goto end; } - OpenAPI_snssai_t *allowed_nssaisItem = OpenAPI_snssai_parseFromJSON(allowed_nssais_local_nonprimitive); + OpenAPI_ext_snssai_t *allowed_nssaisItem = OpenAPI_ext_snssai_parseFromJSON(allowed_nssais_local_nonprimitive); OpenAPI_list_add(allowed_nssaisList, allowed_nssaisItem); } @@ -1559,26 +1708,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) udr_info_local_nonprim = OpenAPI_udr_info_parseFromJSON(udr_info); } - cJSON *udr_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udrInfoExt"); + cJSON *udr_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udrInfoList"); - OpenAPI_list_t *udr_info_extList; - if (udr_info_ext) { - cJSON *udr_info_ext_local_nonprimitive; - if (!cJSON_IsArray(udr_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udr_info_ext]"); + OpenAPI_list_t *udr_info_listList; + if (udr_info_list) { + cJSON *udr_info_list_local_map; + if (!cJSON_IsObject(udr_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udr_info_list]"); goto end; } - - udr_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(udr_info_ext_local_nonprimitive, udr_info_ext ) { - if (!cJSON_IsObject(udr_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udr_info_ext]"); + udr_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(udr_info_list_local_map, udr_info_list) { + cJSON *localMapObject = udr_info_list_local_map; + if (!cJSON_IsObject(udr_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udr_info_list]"); goto end; } - OpenAPI_udr_info_t *udr_info_extItem = OpenAPI_udr_info_parseFromJSON(udr_info_ext_local_nonprimitive); - - OpenAPI_list_add(udr_info_extList, udr_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_udr_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(udr_info_listList, localMapKeyPair); } } @@ -1589,26 +1738,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) udm_info_local_nonprim = OpenAPI_udm_info_parseFromJSON(udm_info); } - cJSON *udm_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udmInfoExt"); + cJSON *udm_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udmInfoList"); - OpenAPI_list_t *udm_info_extList; - if (udm_info_ext) { - cJSON *udm_info_ext_local_nonprimitive; - if (!cJSON_IsArray(udm_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udm_info_ext]"); + OpenAPI_list_t *udm_info_listList; + if (udm_info_list) { + cJSON *udm_info_list_local_map; + if (!cJSON_IsObject(udm_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udm_info_list]"); goto end; } - - udm_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(udm_info_ext_local_nonprimitive, udm_info_ext ) { - if (!cJSON_IsObject(udm_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udm_info_ext]"); + udm_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(udm_info_list_local_map, udm_info_list) { + cJSON *localMapObject = udm_info_list_local_map; + if (!cJSON_IsObject(udm_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udm_info_list]"); goto end; } - OpenAPI_udm_info_t *udm_info_extItem = OpenAPI_udm_info_parseFromJSON(udm_info_ext_local_nonprimitive); - - OpenAPI_list_add(udm_info_extList, udm_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_udm_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(udm_info_listList, localMapKeyPair); } } @@ -1619,26 +1768,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) ausf_info_local_nonprim = OpenAPI_ausf_info_parseFromJSON(ausf_info); } - cJSON *ausf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "ausfInfoExt"); + cJSON *ausf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "ausfInfoList"); - OpenAPI_list_t *ausf_info_extList; - if (ausf_info_ext) { - cJSON *ausf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(ausf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [ausf_info_ext]"); + OpenAPI_list_t *ausf_info_listList; + if (ausf_info_list) { + cJSON *ausf_info_list_local_map; + if (!cJSON_IsObject(ausf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [ausf_info_list]"); goto end; } - - ausf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(ausf_info_ext_local_nonprimitive, ausf_info_ext ) { - if (!cJSON_IsObject(ausf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [ausf_info_ext]"); + ausf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(ausf_info_list_local_map, ausf_info_list) { + cJSON *localMapObject = ausf_info_list_local_map; + if (!cJSON_IsObject(ausf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [ausf_info_list]"); goto end; } - OpenAPI_ausf_info_t *ausf_info_extItem = OpenAPI_ausf_info_parseFromJSON(ausf_info_ext_local_nonprimitive); - - OpenAPI_list_add(ausf_info_extList, ausf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_ausf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(ausf_info_listList, localMapKeyPair); } } @@ -1649,26 +1798,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) amf_info_local_nonprim = OpenAPI_amf_info_parseFromJSON(amf_info); } - cJSON *amf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "amfInfoExt"); + cJSON *amf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "amfInfoList"); - OpenAPI_list_t *amf_info_extList; - if (amf_info_ext) { - cJSON *amf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(amf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [amf_info_ext]"); + OpenAPI_list_t *amf_info_listList; + if (amf_info_list) { + cJSON *amf_info_list_local_map; + if (!cJSON_IsObject(amf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [amf_info_list]"); goto end; } - - amf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(amf_info_ext_local_nonprimitive, amf_info_ext ) { - if (!cJSON_IsObject(amf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [amf_info_ext]"); + amf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(amf_info_list_local_map, amf_info_list) { + cJSON *localMapObject = amf_info_list_local_map; + if (!cJSON_IsObject(amf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [amf_info_list]"); goto end; } - OpenAPI_amf_info_t *amf_info_extItem = OpenAPI_amf_info_parseFromJSON(amf_info_ext_local_nonprimitive); - - OpenAPI_list_add(amf_info_extList, amf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_amf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(amf_info_listList, localMapKeyPair); } } @@ -1679,26 +1828,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) smf_info_local_nonprim = OpenAPI_smf_info_parseFromJSON(smf_info); } - cJSON *smf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "smfInfoExt"); + cJSON *smf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "smfInfoList"); - OpenAPI_list_t *smf_info_extList; - if (smf_info_ext) { - cJSON *smf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(smf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [smf_info_ext]"); + OpenAPI_list_t *smf_info_listList; + if (smf_info_list) { + cJSON *smf_info_list_local_map; + if (!cJSON_IsObject(smf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [smf_info_list]"); goto end; } - - smf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(smf_info_ext_local_nonprimitive, smf_info_ext ) { - if (!cJSON_IsObject(smf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [smf_info_ext]"); + smf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(smf_info_list_local_map, smf_info_list) { + cJSON *localMapObject = smf_info_list_local_map; + if (!cJSON_IsObject(smf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [smf_info_list]"); goto end; } - OpenAPI_smf_info_t *smf_info_extItem = OpenAPI_smf_info_parseFromJSON(smf_info_ext_local_nonprimitive); - - OpenAPI_list_add(smf_info_extList, smf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_smf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(smf_info_listList, localMapKeyPair); } } @@ -1709,26 +1858,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) upf_info_local_nonprim = OpenAPI_upf_info_parseFromJSON(upf_info); } - cJSON *upf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "upfInfoExt"); + cJSON *upf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "upfInfoList"); - OpenAPI_list_t *upf_info_extList; - if (upf_info_ext) { - cJSON *upf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(upf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [upf_info_ext]"); + OpenAPI_list_t *upf_info_listList; + if (upf_info_list) { + cJSON *upf_info_list_local_map; + if (!cJSON_IsObject(upf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [upf_info_list]"); goto end; } - - upf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(upf_info_ext_local_nonprimitive, upf_info_ext ) { - if (!cJSON_IsObject(upf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [upf_info_ext]"); + upf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(upf_info_list_local_map, upf_info_list) { + cJSON *localMapObject = upf_info_list_local_map; + if (!cJSON_IsObject(upf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [upf_info_list]"); goto end; } - OpenAPI_upf_info_t *upf_info_extItem = OpenAPI_upf_info_parseFromJSON(upf_info_ext_local_nonprimitive); - - OpenAPI_list_add(upf_info_extList, upf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_upf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(upf_info_listList, localMapKeyPair); } } @@ -1739,26 +1888,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) pcf_info_local_nonprim = OpenAPI_pcf_info_parseFromJSON(pcf_info); } - cJSON *pcf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "pcfInfoExt"); + cJSON *pcf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "pcfInfoList"); - OpenAPI_list_t *pcf_info_extList; - if (pcf_info_ext) { - cJSON *pcf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(pcf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcf_info_ext]"); + OpenAPI_list_t *pcf_info_listList; + if (pcf_info_list) { + cJSON *pcf_info_list_local_map; + if (!cJSON_IsObject(pcf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcf_info_list]"); goto end; } - - pcf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(pcf_info_ext_local_nonprimitive, pcf_info_ext ) { - if (!cJSON_IsObject(pcf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcf_info_ext]"); + pcf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(pcf_info_list_local_map, pcf_info_list) { + cJSON *localMapObject = pcf_info_list_local_map; + if (!cJSON_IsObject(pcf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcf_info_list]"); goto end; } - OpenAPI_pcf_info_t *pcf_info_extItem = OpenAPI_pcf_info_parseFromJSON(pcf_info_ext_local_nonprimitive); - - OpenAPI_list_add(pcf_info_extList, pcf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_pcf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(pcf_info_listList, localMapKeyPair); } } @@ -1769,26 +1918,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) bsf_info_local_nonprim = OpenAPI_bsf_info_parseFromJSON(bsf_info); } - cJSON *bsf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "bsfInfoExt"); + cJSON *bsf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "bsfInfoList"); - OpenAPI_list_t *bsf_info_extList; - if (bsf_info_ext) { - cJSON *bsf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(bsf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [bsf_info_ext]"); + OpenAPI_list_t *bsf_info_listList; + if (bsf_info_list) { + cJSON *bsf_info_list_local_map; + if (!cJSON_IsObject(bsf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [bsf_info_list]"); goto end; } - - bsf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(bsf_info_ext_local_nonprimitive, bsf_info_ext ) { - if (!cJSON_IsObject(bsf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [bsf_info_ext]"); + bsf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(bsf_info_list_local_map, bsf_info_list) { + cJSON *localMapObject = bsf_info_list_local_map; + if (!cJSON_IsObject(bsf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [bsf_info_list]"); goto end; } - OpenAPI_bsf_info_t *bsf_info_extItem = OpenAPI_bsf_info_parseFromJSON(bsf_info_ext_local_nonprimitive); - - OpenAPI_list_add(bsf_info_extList, bsf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_bsf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(bsf_info_listList, localMapKeyPair); } } @@ -1799,26 +1948,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) chf_info_local_nonprim = OpenAPI_chf_info_parseFromJSON(chf_info); } - cJSON *chf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "chfInfoExt"); + cJSON *chf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "chfInfoList"); - OpenAPI_list_t *chf_info_extList; - if (chf_info_ext) { - cJSON *chf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(chf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [chf_info_ext]"); + OpenAPI_list_t *chf_info_listList; + if (chf_info_list) { + cJSON *chf_info_list_local_map; + if (!cJSON_IsObject(chf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [chf_info_list]"); goto end; } - - chf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(chf_info_ext_local_nonprimitive, chf_info_ext ) { - if (!cJSON_IsObject(chf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [chf_info_ext]"); + chf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(chf_info_list_local_map, chf_info_list) { + cJSON *localMapObject = chf_info_list_local_map; + if (!cJSON_IsObject(chf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [chf_info_list]"); goto end; } - OpenAPI_chf_info_t *chf_info_extItem = OpenAPI_chf_info_parseFromJSON(chf_info_ext_local_nonprimitive); - - OpenAPI_list_add(chf_info_extList, chf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_chf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(chf_info_listList, localMapKeyPair); } } @@ -1843,26 +1992,26 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) udsf_info_local_nonprim = OpenAPI_udsf_info_parseFromJSON(udsf_info); } - cJSON *udsf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udsfInfoExt"); + cJSON *udsf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udsfInfoList"); - OpenAPI_list_t *udsf_info_extList; - if (udsf_info_ext) { - cJSON *udsf_info_ext_local_nonprimitive; - if (!cJSON_IsArray(udsf_info_ext)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udsf_info_ext]"); + OpenAPI_list_t *udsf_info_listList; + if (udsf_info_list) { + cJSON *udsf_info_list_local_map; + if (!cJSON_IsObject(udsf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udsf_info_list]"); goto end; } - - udsf_info_extList = OpenAPI_list_create(); - - cJSON_ArrayForEach(udsf_info_ext_local_nonprimitive, udsf_info_ext ) { - if (!cJSON_IsObject(udsf_info_ext_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udsf_info_ext]"); + udsf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(udsf_info_list_local_map, udsf_info_list) { + cJSON *localMapObject = udsf_info_list_local_map; + if (!cJSON_IsObject(udsf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [udsf_info_list]"); goto end; } - OpenAPI_udsf_info_t *udsf_info_extItem = OpenAPI_udsf_info_parseFromJSON(udsf_info_ext_local_nonprimitive); - - OpenAPI_list_add(udsf_info_extList, udsf_info_extItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_udsf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(udsf_info_listList, localMapKeyPair); } } @@ -1873,49 +2022,49 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) nwdaf_info_local_nonprim = OpenAPI_nwdaf_info_parseFromJSON(nwdaf_info); } - cJSON *pcscf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "pcscfInfo"); + cJSON *pcscf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "pcscfInfoList"); - OpenAPI_list_t *pcscf_infoList; - if (pcscf_info) { - cJSON *pcscf_info_local_nonprimitive; - if (!cJSON_IsArray(pcscf_info)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcscf_info]"); + OpenAPI_list_t *pcscf_info_listList; + if (pcscf_info_list) { + cJSON *pcscf_info_list_local_map; + if (!cJSON_IsObject(pcscf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcscf_info_list]"); goto end; } - - pcscf_infoList = OpenAPI_list_create(); - - cJSON_ArrayForEach(pcscf_info_local_nonprimitive, pcscf_info ) { - if (!cJSON_IsObject(pcscf_info_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcscf_info]"); + pcscf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(pcscf_info_list_local_map, pcscf_info_list) { + cJSON *localMapObject = pcscf_info_list_local_map; + if (!cJSON_IsObject(pcscf_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [pcscf_info_list]"); goto end; } - OpenAPI_pcscf_info_t *pcscf_infoItem = OpenAPI_pcscf_info_parseFromJSON(pcscf_info_local_nonprimitive); - - OpenAPI_list_add(pcscf_infoList, pcscf_infoItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_pcscf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(pcscf_info_listList, localMapKeyPair); } } - cJSON *hss_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "hssInfo"); + cJSON *hss_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "hssInfoList"); - OpenAPI_list_t *hss_infoList; - if (hss_info) { - cJSON *hss_info_local_nonprimitive; - if (!cJSON_IsArray(hss_info)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [hss_info]"); + OpenAPI_list_t *hss_info_listList; + if (hss_info_list) { + cJSON *hss_info_list_local_map; + if (!cJSON_IsObject(hss_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [hss_info_list]"); goto end; } - - hss_infoList = OpenAPI_list_create(); - - cJSON_ArrayForEach(hss_info_local_nonprimitive, hss_info ) { - if (!cJSON_IsObject(hss_info_local_nonprimitive)) { - ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [hss_info]"); + hss_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(hss_info_list_local_map, hss_info_list) { + cJSON *localMapObject = hss_info_list_local_map; + if (!cJSON_IsObject(hss_info_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [hss_info_list]"); goto end; } - OpenAPI_hss_info_t *hss_infoItem = OpenAPI_hss_info_parseFromJSON(hss_info_local_nonprimitive); - - OpenAPI_list_add(hss_infoList, hss_infoItem); + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_hss_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(hss_info_listList, localMapKeyPair); } } @@ -1967,6 +2116,29 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) } } + cJSON *nf_service_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfServiceList"); + + OpenAPI_list_t *nf_service_listList; + if (nf_service_list) { + cJSON *nf_service_list_local_map; + if (!cJSON_IsObject(nf_service_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_service_list]"); + goto end; + } + nf_service_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nf_service_list_local_map, nf_service_list) { + cJSON *localMapObject = nf_service_list_local_map; + if (!cJSON_IsObject(nf_service_list_local_map)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_service_list]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_nf_service_parseFromJSON(localMapObject)); + OpenAPI_list_add(nf_service_listList, localMapKeyPair); + } + } + cJSON *nf_profile_changes_support_ind = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfProfileChangesSupportInd"); if (nf_profile_changes_support_ind) { @@ -2080,6 +2252,67 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) } } + cJSON *nf_set_recovery_time_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfSetRecoveryTimeList"); + + OpenAPI_list_t *nf_set_recovery_time_listList; + if (nf_set_recovery_time_list) { + cJSON *nf_set_recovery_time_list_local_map; + if (!cJSON_IsObject(nf_set_recovery_time_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_set_recovery_time_list]"); + goto end; + } + nf_set_recovery_time_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nf_set_recovery_time_list_local_map, nf_set_recovery_time_list) { + cJSON *localMapObject = nf_set_recovery_time_list_local_map; + OpenAPI_list_add(nf_set_recovery_time_listList, localMapKeyPair); + } + } + + cJSON *service_set_recovery_time_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "serviceSetRecoveryTimeList"); + + OpenAPI_list_t *service_set_recovery_time_listList; + if (service_set_recovery_time_list) { + cJSON *service_set_recovery_time_list_local_map; + if (!cJSON_IsObject(service_set_recovery_time_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [service_set_recovery_time_list]"); + goto end; + } + service_set_recovery_time_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(service_set_recovery_time_list_local_map, service_set_recovery_time_list) { + cJSON *localMapObject = service_set_recovery_time_list_local_map; + OpenAPI_list_add(service_set_recovery_time_listList, localMapKeyPair); + } + } + + cJSON *scp_domains = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "scpDomains"); + + OpenAPI_list_t *scp_domainsList; + if (scp_domains) { + cJSON *scp_domains_local; + if (!cJSON_IsArray(scp_domains)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [scp_domains]"); + goto end; + } + scp_domainsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(scp_domains_local, scp_domains) { + if (!cJSON_IsString(scp_domains_local)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [scp_domains]"); + goto end; + } + OpenAPI_list_add(scp_domainsList, ogs_strdup(scp_domains_local->valuestring)); + } + } + + cJSON *scp_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "scpInfo"); + + OpenAPI_scp_info_t *scp_info_local_nonprim = NULL; + if (scp_info) { + scp_info_local_nonprim = OpenAPI_scp_info_parseFromJSON(scp_info); + } + nf_profile_local_var = OpenAPI_nf_profile_create ( ogs_strdup(nf_instance_id->valuestring), nf_instance_name ? ogs_strdup(nf_instance_name->valuestring) : NULL, @@ -2106,34 +2339,35 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) load_time_stamp ? ogs_strdup(load_time_stamp->valuestring) : NULL, locality ? ogs_strdup(locality->valuestring) : NULL, udr_info ? udr_info_local_nonprim : NULL, - udr_info_ext ? udr_info_extList : NULL, + udr_info_list ? udr_info_listList : NULL, udm_info ? udm_info_local_nonprim : NULL, - udm_info_ext ? udm_info_extList : NULL, + udm_info_list ? udm_info_listList : NULL, ausf_info ? ausf_info_local_nonprim : NULL, - ausf_info_ext ? ausf_info_extList : NULL, + ausf_info_list ? ausf_info_listList : NULL, amf_info ? amf_info_local_nonprim : NULL, - amf_info_ext ? amf_info_extList : NULL, + amf_info_list ? amf_info_listList : NULL, smf_info ? smf_info_local_nonprim : NULL, - smf_info_ext ? smf_info_extList : NULL, + smf_info_list ? smf_info_listList : NULL, upf_info ? upf_info_local_nonprim : NULL, - upf_info_ext ? upf_info_extList : NULL, + upf_info_list ? upf_info_listList : NULL, pcf_info ? pcf_info_local_nonprim : NULL, - pcf_info_ext ? pcf_info_extList : NULL, + pcf_info_list ? pcf_info_listList : NULL, bsf_info ? bsf_info_local_nonprim : NULL, - bsf_info_ext ? bsf_info_extList : NULL, + bsf_info_list ? bsf_info_listList : NULL, chf_info ? chf_info_local_nonprim : NULL, - chf_info_ext ? chf_info_extList : NULL, + chf_info_list ? chf_info_listList : NULL, nef_info ? nef_info_local_nonprim : NULL, nrf_info ? nrf_info_local_nonprim : NULL, udsf_info ? udsf_info_local_nonprim : NULL, - udsf_info_ext ? udsf_info_extList : NULL, + udsf_info_list ? udsf_info_listList : NULL, nwdaf_info ? nwdaf_info_local_nonprim : NULL, - pcscf_info ? pcscf_infoList : NULL, - hss_info ? hss_infoList : NULL, + pcscf_info_list ? pcscf_info_listList : NULL, + hss_info_list ? hss_info_listList : NULL, custom_info ? custom_info_local_object : NULL, recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, nf_service_persistence ? nf_service_persistence->valueint : 0, nf_services ? nf_servicesList : NULL, + nf_service_list ? nf_service_listList : NULL, nf_profile_changes_support_ind ? nf_profile_changes_support_ind->valueint : 0, nf_profile_changes_ind ? nf_profile_changes_ind->valueint : 0, default_notification_subscriptions ? default_notification_subscriptionsList : NULL, @@ -2142,7 +2376,11 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) nf_set_id_list ? nf_set_id_listList : NULL, serving_scope ? serving_scopeList : NULL, lc_h_support_ind ? lc_h_support_ind->valueint : 0, - olc_h_support_ind ? olc_h_support_ind->valueint : 0 + olc_h_support_ind ? olc_h_support_ind->valueint : 0, + nf_set_recovery_time_list ? nf_set_recovery_time_listList : NULL, + service_set_recovery_time_list ? service_set_recovery_time_listList : NULL, + scp_domains ? scp_domainsList : NULL, + scp_info ? scp_info_local_nonprim : NULL ); return nf_profile_local_var; diff --git a/lib/sbi/openapi/model/nf_profile.h b/lib/sbi/openapi/model/nf_profile.h index 008fa1b8b..c92f4f9b8 100644 --- a/lib/sbi/openapi/model/nf_profile.h +++ b/lib/sbi/openapi/model/nf_profile.h @@ -17,6 +17,7 @@ #include "bsf_info.h" #include "chf_info.h" #include "default_notification_subscription.h" +#include "ext_snssai.h" #include "gmlc_info.h" #include "hss_info.h" #include "lmf_info.h" @@ -32,8 +33,8 @@ #include "plmn_id.h" #include "plmn_id_nid.h" #include "plmn_snssai.h" +#include "scp_info.h" #include "smf_info.h" -#include "snssai.h" #include "udm_info.h" #include "udr_info.h" #include "udsf_info.h" @@ -70,34 +71,35 @@ typedef struct OpenAPI_nf_profile_s { char *load_time_stamp; char *locality; struct OpenAPI_udr_info_s *udr_info; - OpenAPI_list_t *udr_info_ext; + OpenAPI_list_t* udr_info_list; struct OpenAPI_udm_info_s *udm_info; - OpenAPI_list_t *udm_info_ext; + OpenAPI_list_t* udm_info_list; struct OpenAPI_ausf_info_s *ausf_info; - OpenAPI_list_t *ausf_info_ext; + OpenAPI_list_t* ausf_info_list; struct OpenAPI_amf_info_s *amf_info; - OpenAPI_list_t *amf_info_ext; + OpenAPI_list_t* amf_info_list; struct OpenAPI_smf_info_s *smf_info; - OpenAPI_list_t *smf_info_ext; + OpenAPI_list_t* smf_info_list; struct OpenAPI_upf_info_s *upf_info; - OpenAPI_list_t *upf_info_ext; + OpenAPI_list_t* upf_info_list; struct OpenAPI_pcf_info_s *pcf_info; - OpenAPI_list_t *pcf_info_ext; + OpenAPI_list_t* pcf_info_list; struct OpenAPI_bsf_info_s *bsf_info; - OpenAPI_list_t *bsf_info_ext; + OpenAPI_list_t* bsf_info_list; struct OpenAPI_chf_info_s *chf_info; - OpenAPI_list_t *chf_info_ext; + OpenAPI_list_t* chf_info_list; struct OpenAPI_nef_info_s *nef_info; struct OpenAPI_nrf_info_s *nrf_info; struct OpenAPI_udsf_info_s *udsf_info; - OpenAPI_list_t *udsf_info_ext; + OpenAPI_list_t* udsf_info_list; struct OpenAPI_nwdaf_info_s *nwdaf_info; - OpenAPI_list_t *pcscf_info; - OpenAPI_list_t *hss_info; + OpenAPI_list_t* pcscf_info_list; + OpenAPI_list_t* hss_info_list; OpenAPI_object_t *custom_info; char *recovery_time; int nf_service_persistence; OpenAPI_list_t *nf_services; + OpenAPI_list_t* nf_service_list; int nf_profile_changes_support_ind; int nf_profile_changes_ind; OpenAPI_list_t *default_notification_subscriptions; @@ -107,6 +109,10 @@ typedef struct OpenAPI_nf_profile_s { OpenAPI_list_t *serving_scope; int lc_h_support_ind; int olc_h_support_ind; + OpenAPI_list_t* nf_set_recovery_time_list; + OpenAPI_list_t* service_set_recovery_time_list; + OpenAPI_list_t *scp_domains; + struct OpenAPI_scp_info_s *scp_info; } OpenAPI_nf_profile_t; OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( @@ -135,34 +141,35 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( char *load_time_stamp, char *locality, OpenAPI_udr_info_t *udr_info, - OpenAPI_list_t *udr_info_ext, + OpenAPI_list_t* udr_info_list, OpenAPI_udm_info_t *udm_info, - OpenAPI_list_t *udm_info_ext, + OpenAPI_list_t* udm_info_list, OpenAPI_ausf_info_t *ausf_info, - OpenAPI_list_t *ausf_info_ext, + OpenAPI_list_t* ausf_info_list, OpenAPI_amf_info_t *amf_info, - OpenAPI_list_t *amf_info_ext, + OpenAPI_list_t* amf_info_list, OpenAPI_smf_info_t *smf_info, - OpenAPI_list_t *smf_info_ext, + OpenAPI_list_t* smf_info_list, OpenAPI_upf_info_t *upf_info, - OpenAPI_list_t *upf_info_ext, + OpenAPI_list_t* upf_info_list, OpenAPI_pcf_info_t *pcf_info, - OpenAPI_list_t *pcf_info_ext, + OpenAPI_list_t* pcf_info_list, OpenAPI_bsf_info_t *bsf_info, - OpenAPI_list_t *bsf_info_ext, + OpenAPI_list_t* bsf_info_list, OpenAPI_chf_info_t *chf_info, - OpenAPI_list_t *chf_info_ext, + OpenAPI_list_t* chf_info_list, OpenAPI_nef_info_t *nef_info, OpenAPI_nrf_info_t *nrf_info, OpenAPI_udsf_info_t *udsf_info, - OpenAPI_list_t *udsf_info_ext, + OpenAPI_list_t* udsf_info_list, OpenAPI_nwdaf_info_t *nwdaf_info, - OpenAPI_list_t *pcscf_info, - OpenAPI_list_t *hss_info, + OpenAPI_list_t* pcscf_info_list, + OpenAPI_list_t* hss_info_list, OpenAPI_object_t *custom_info, char *recovery_time, int nf_service_persistence, OpenAPI_list_t *nf_services, + OpenAPI_list_t* nf_service_list, int nf_profile_changes_support_ind, int nf_profile_changes_ind, OpenAPI_list_t *default_notification_subscriptions, @@ -171,7 +178,11 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( OpenAPI_list_t *nf_set_id_list, OpenAPI_list_t *serving_scope, int lc_h_support_ind, - int olc_h_support_ind + int olc_h_support_ind, + OpenAPI_list_t* nf_set_recovery_time_list, + OpenAPI_list_t* service_set_recovery_time_list, + OpenAPI_list_t *scp_domains, + OpenAPI_scp_info_t *scp_info ); void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile); OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON); diff --git a/lib/sbi/openapi/model/nf_service.c b/lib/sbi/openapi/model/nf_service.c index 838c9fa84..7840f32b2 100644 --- a/lib/sbi/openapi/model/nf_service.c +++ b/lib/sbi/openapi/model/nf_service.c @@ -20,6 +20,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_create( OpenAPI_list_t *allowed_nf_types, OpenAPI_list_t *allowed_nf_domains, OpenAPI_list_t *allowed_nssais, + OpenAPI_list_t* allowed_operations_per_nf_type, + OpenAPI_list_t* allowed_operations_per_nf_instance, int priority, int capacity, int load, @@ -54,6 +56,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_create( nf_service_local_var->allowed_nf_types = allowed_nf_types; nf_service_local_var->allowed_nf_domains = allowed_nf_domains; nf_service_local_var->allowed_nssais = allowed_nssais; + nf_service_local_var->allowed_operations_per_nf_type = allowed_operations_per_nf_type; + nf_service_local_var->allowed_operations_per_nf_instance = allowed_operations_per_nf_instance; nf_service_local_var->priority = priority; nf_service_local_var->capacity = capacity; nf_service_local_var->load = load; @@ -108,9 +112,21 @@ void OpenAPI_nf_service_free(OpenAPI_nf_service_t *nf_service) } OpenAPI_list_free(nf_service->allowed_nf_domains); OpenAPI_list_for_each(nf_service->allowed_nssais, node) { - OpenAPI_snssai_free(node->data); + OpenAPI_ext_snssai_free(node->data); } OpenAPI_list_free(nf_service->allowed_nssais); + OpenAPI_list_for_each(nf_service->allowed_operations_per_nf_type, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nf_service->allowed_operations_per_nf_type); + OpenAPI_list_for_each(nf_service->allowed_operations_per_nf_instance, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nf_service->allowed_operations_per_nf_instance); ogs_free(nf_service->load_time_stamp); ogs_free(nf_service->recovery_time); OpenAPI_chf_service_info_free(nf_service->chf_service_info); @@ -120,7 +136,7 @@ void OpenAPI_nf_service_free(OpenAPI_nf_service_t *nf_service) } OpenAPI_list_free(nf_service->nf_service_set_id_list); OpenAPI_list_for_each(nf_service->s_nssais, node) { - OpenAPI_snssai_free(node->data); + OpenAPI_ext_snssai_free(node->data); } OpenAPI_list_free(nf_service->s_nssais); OpenAPI_list_for_each(nf_service->per_plmn_snssai_list, node) { @@ -347,7 +363,7 @@ cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service) OpenAPI_lnode_t *allowed_nssais_node; if (nf_service->allowed_nssais) { OpenAPI_list_for_each(nf_service->allowed_nssais, allowed_nssais_node) { - cJSON *itemLocal = OpenAPI_snssai_convertToJSON(allowed_nssais_node->data); + cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(allowed_nssais_node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_nssais]"); goto end; @@ -357,6 +373,36 @@ cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service) } } + if (nf_service->allowed_operations_per_nf_type) { + cJSON *allowed_operations_per_nf_type = cJSON_AddObjectToObject(item, "allowedOperationsPerNfType"); + if (allowed_operations_per_nf_type == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_operations_per_nf_type]"); + goto end; + } + cJSON *localMapObject = allowed_operations_per_nf_type; + OpenAPI_lnode_t *allowed_operations_per_nf_type_node; + if (nf_service->allowed_operations_per_nf_type) { + OpenAPI_list_for_each(nf_service->allowed_operations_per_nf_type, allowed_operations_per_nf_type_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)allowed_operations_per_nf_type_node->data; + } + } + } + + if (nf_service->allowed_operations_per_nf_instance) { + cJSON *allowed_operations_per_nf_instance = cJSON_AddObjectToObject(item, "allowedOperationsPerNfInstance"); + if (allowed_operations_per_nf_instance == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_operations_per_nf_instance]"); + goto end; + } + cJSON *localMapObject = allowed_operations_per_nf_instance; + OpenAPI_lnode_t *allowed_operations_per_nf_instance_node; + if (nf_service->allowed_operations_per_nf_instance) { + OpenAPI_list_for_each(nf_service->allowed_operations_per_nf_instance, allowed_operations_per_nf_instance_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)allowed_operations_per_nf_instance_node->data; + } + } + } + if (nf_service->priority) { if (cJSON_AddNumberToObject(item, "priority", nf_service->priority) == NULL) { ogs_error("OpenAPI_nf_service_convertToJSON() failed [priority]"); @@ -438,7 +484,7 @@ cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service) OpenAPI_lnode_t *s_nssais_node; if (nf_service->s_nssais) { OpenAPI_list_for_each(nf_service->s_nssais, s_nssais_node) { - cJSON *itemLocal = OpenAPI_snssai_convertToJSON(s_nssais_node->data); + cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(s_nssais_node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_nf_service_convertToJSON() failed [s_nssais]"); goto end; @@ -760,12 +806,46 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON) ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_nssais]"); goto end; } - OpenAPI_snssai_t *allowed_nssaisItem = OpenAPI_snssai_parseFromJSON(allowed_nssais_local_nonprimitive); + OpenAPI_ext_snssai_t *allowed_nssaisItem = OpenAPI_ext_snssai_parseFromJSON(allowed_nssais_local_nonprimitive); OpenAPI_list_add(allowed_nssaisList, allowed_nssaisItem); } } + cJSON *allowed_operations_per_nf_type = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "allowedOperationsPerNfType"); + + OpenAPI_list_t *allowed_operations_per_nf_typeList; + if (allowed_operations_per_nf_type) { + cJSON *allowed_operations_per_nf_type_local_map; + if (!cJSON_IsObject(allowed_operations_per_nf_type)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_operations_per_nf_type]"); + goto end; + } + allowed_operations_per_nf_typeList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(allowed_operations_per_nf_type_local_map, allowed_operations_per_nf_type) { + cJSON *localMapObject = allowed_operations_per_nf_type_local_map; + OpenAPI_list_add(allowed_operations_per_nf_typeList, localMapKeyPair); + } + } + + cJSON *allowed_operations_per_nf_instance = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "allowedOperationsPerNfInstance"); + + OpenAPI_list_t *allowed_operations_per_nf_instanceList; + if (allowed_operations_per_nf_instance) { + cJSON *allowed_operations_per_nf_instance_local_map; + if (!cJSON_IsObject(allowed_operations_per_nf_instance)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_operations_per_nf_instance]"); + goto end; + } + allowed_operations_per_nf_instanceList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(allowed_operations_per_nf_instance_local_map, allowed_operations_per_nf_instance) { + cJSON *localMapObject = allowed_operations_per_nf_instance_local_map; + OpenAPI_list_add(allowed_operations_per_nf_instanceList, localMapKeyPair); + } + } + cJSON *priority = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "priority"); if (priority) { @@ -864,7 +944,7 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON) ogs_error("OpenAPI_nf_service_parseFromJSON() failed [s_nssais]"); goto end; } - OpenAPI_snssai_t *s_nssaisItem = OpenAPI_snssai_parseFromJSON(s_nssais_local_nonprimitive); + OpenAPI_ext_snssai_t *s_nssaisItem = OpenAPI_ext_snssai_parseFromJSON(s_nssais_local_nonprimitive); OpenAPI_list_add(s_nssaisList, s_nssaisItem); } @@ -944,6 +1024,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON) allowed_nf_types ? allowed_nf_typesList : NULL, allowed_nf_domains ? allowed_nf_domainsList : NULL, allowed_nssais ? allowed_nssaisList : NULL, + allowed_operations_per_nf_type ? allowed_operations_per_nf_typeList : NULL, + allowed_operations_per_nf_instance ? allowed_operations_per_nf_instanceList : NULL, priority ? priority->valuedouble : 0, capacity ? capacity->valuedouble : 0, load ? load->valuedouble : 0, diff --git a/lib/sbi/openapi/model/nf_service.h b/lib/sbi/openapi/model/nf_service.h index d31bd0c66..e4b4cdb21 100644 --- a/lib/sbi/openapi/model/nf_service.h +++ b/lib/sbi/openapi/model/nf_service.h @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "chf_service_info.h" #include "default_notification_subscription.h" +#include "ext_snssai.h" #include "ip_end_point.h" #include "nf_service_status.h" #include "nf_service_version.h" @@ -21,7 +22,6 @@ #include "plmn_id.h" #include "plmn_id_nid.h" #include "plmn_snssai.h" -#include "snssai.h" #include "uri_scheme.h" #include "vendor_specific_feature.h" @@ -46,6 +46,8 @@ typedef struct OpenAPI_nf_service_s { OpenAPI_list_t *allowed_nf_types; OpenAPI_list_t *allowed_nf_domains; OpenAPI_list_t *allowed_nssais; + OpenAPI_list_t* allowed_operations_per_nf_type; + OpenAPI_list_t* allowed_operations_per_nf_instance; int priority; int capacity; int load; @@ -77,6 +79,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_create( OpenAPI_list_t *allowed_nf_types, OpenAPI_list_t *allowed_nf_domains, OpenAPI_list_t *allowed_nssais, + OpenAPI_list_t* allowed_operations_per_nf_type, + OpenAPI_list_t* allowed_operations_per_nf_instance, int priority, int capacity, int load, diff --git a/lib/sbi/openapi/model/nf_type.c b/lib/sbi/openapi/model/nf_type.c index 2548af8f8..7a3950afa 100644 --- a/lib/sbi/openapi/model/nf_type.c +++ b/lib/sbi/openapi/model/nf_type.c @@ -6,7 +6,7 @@ char* OpenAPI_nf_type_ToString(OpenAPI_nf_type_e nf_type) { - const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP" }; + const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP", "NSSAAF", "ICSCF", "SCSCF" }; size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); if (nf_type < sizeofArray) return (char *)nf_typeArray[nf_type]; @@ -17,7 +17,7 @@ char* OpenAPI_nf_type_ToString(OpenAPI_nf_type_e nf_type) OpenAPI_nf_type_e OpenAPI_nf_type_FromString(char* nf_type) { int stringToReturn = 0; - const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP" }; + const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP", "NSSAAF", "ICSCF", "SCSCF" }; size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(nf_type, nf_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/nf_type.h b/lib/sbi/openapi/model/nf_type.h index b8a1f1b72..a6ac9c0a7 100644 --- a/lib/sbi/openapi/model/nf_type.h +++ b/lib/sbi/openapi/model/nf_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_nf_type_NULL = 0, OpenAPI_nf_type_NRF, OpenAPI_nf_type_UDM, OpenAPI_nf_type_AMF, OpenAPI_nf_type_SMF, OpenAPI_nf_type_AUSF, OpenAPI_nf_type_NEF, OpenAPI_nf_type_PCF, OpenAPI_nf_type_SMSF, OpenAPI_nf_type_NSSF, OpenAPI_nf_type_UDR, OpenAPI_nf_type_LMF, OpenAPI_nf_type_GMLC, OpenAPI_nf_type_5G_EIR, OpenAPI_nf_type_SEPP, OpenAPI_nf_type_UPF, OpenAPI_nf_type_N3IWF, OpenAPI_nf_type_AF, OpenAPI_nf_type_UDSF, OpenAPI_nf_type_BSF, OpenAPI_nf_type_CHF, OpenAPI_nf_type_NWDAF, OpenAPI_nf_type_PCSCF, OpenAPI_nf_type_CBCF, OpenAPI_nf_type_HSS, OpenAPI_nf_type_UCMF, OpenAPI_nf_type_SOR_AF, OpenAPI_nf_type_SPAF, OpenAPI_nf_type_MME, OpenAPI_nf_type_SCSAS, OpenAPI_nf_type_SCEF, OpenAPI_nf_type_SCP } OpenAPI_nf_type_e; +typedef enum { OpenAPI_nf_type_NULL = 0, OpenAPI_nf_type_NRF, OpenAPI_nf_type_UDM, OpenAPI_nf_type_AMF, OpenAPI_nf_type_SMF, OpenAPI_nf_type_AUSF, OpenAPI_nf_type_NEF, OpenAPI_nf_type_PCF, OpenAPI_nf_type_SMSF, OpenAPI_nf_type_NSSF, OpenAPI_nf_type_UDR, OpenAPI_nf_type_LMF, OpenAPI_nf_type_GMLC, OpenAPI_nf_type_5G_EIR, OpenAPI_nf_type_SEPP, OpenAPI_nf_type_UPF, OpenAPI_nf_type_N3IWF, OpenAPI_nf_type_AF, OpenAPI_nf_type_UDSF, OpenAPI_nf_type_BSF, OpenAPI_nf_type_CHF, OpenAPI_nf_type_NWDAF, OpenAPI_nf_type_PCSCF, OpenAPI_nf_type_CBCF, OpenAPI_nf_type_HSS, OpenAPI_nf_type_UCMF, OpenAPI_nf_type_SOR_AF, OpenAPI_nf_type_SPAF, OpenAPI_nf_type_MME, OpenAPI_nf_type_SCSAS, OpenAPI_nf_type_SCEF, OpenAPI_nf_type_SCP, OpenAPI_nf_type_NSSAAF, OpenAPI_nf_type_ICSCF, OpenAPI_nf_type_SCSCF } OpenAPI_nf_type_e; char* OpenAPI_nf_type_ToString(OpenAPI_nf_type_e nf_type); diff --git a/lib/sbi/openapi/model/node_type.c b/lib/sbi/openapi/model/node_type.c new file mode 100644 index 000000000..9de2eff51 --- /dev/null +++ b/lib/sbi/openapi/model/node_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "node_type.h" + +char* OpenAPI_node_type_ToString(OpenAPI_node_type_e node_type) +{ + const char *node_typeArray[] = { "NULL", "AUSF", "VLR", "SGSN", "S_CSCF", "BSF", "GAN_AAA_SERVER", "WLAN_AAA_SERVER", "MME" }; + size_t sizeofArray = sizeof(node_typeArray) / sizeof(node_typeArray[0]); + if (node_type < sizeofArray) + return (char *)node_typeArray[node_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_node_type_e OpenAPI_node_type_FromString(char* node_type) +{ + int stringToReturn = 0; + const char *node_typeArray[] = { "NULL", "AUSF", "VLR", "SGSN", "S_CSCF", "BSF", "GAN_AAA_SERVER", "WLAN_AAA_SERVER", "MME" }; + size_t sizeofArray = sizeof(node_typeArray) / sizeof(node_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(node_type, node_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/node_type.h b/lib/sbi/openapi/model/node_type.h new file mode 100644 index 000000000..847527a8c --- /dev/null +++ b/lib/sbi/openapi/model/node_type.h @@ -0,0 +1,31 @@ +/* + * node_type.h + * + * + */ + +#ifndef _OpenAPI_node_type_H_ +#define _OpenAPI_node_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_node_type_NULL = 0, OpenAPI_node_type_AUSF, OpenAPI_node_type_VLR, OpenAPI_node_type_SGSN, OpenAPI_node_type_S_CSCF, OpenAPI_node_type_BSF, OpenAPI_node_type_GAN_AAA_SERVER, OpenAPI_node_type_WLAN_AAA_SERVER, OpenAPI_node_type_MME } OpenAPI_node_type_e; + +char* OpenAPI_node_type_ToString(OpenAPI_node_type_e node_type); + +OpenAPI_node_type_e OpenAPI_node_type_FromString(char* node_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_node_type_H_ */ + diff --git a/lib/sbi/openapi/model/non_dynamic5_qi.c b/lib/sbi/openapi/model/non_dynamic5_qi.c index 45105c9e3..8be1a75d7 100644 --- a/lib/sbi/openapi/model/non_dynamic5_qi.c +++ b/lib/sbi/openapi/model/non_dynamic5_qi.c @@ -8,7 +8,9 @@ OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_create( int priority_level, int aver_window, int max_data_burst_vol, - int ext_max_data_burst_vol + int ext_max_data_burst_vol, + int cn_packet_delay_budget_dl, + int cn_packet_delay_budget_ul ) { OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi_local_var = OpenAPI_malloc(sizeof(OpenAPI_non_dynamic5_qi_t)); @@ -19,6 +21,8 @@ OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_create( non_dynamic5_qi_local_var->aver_window = aver_window; non_dynamic5_qi_local_var->max_data_burst_vol = max_data_burst_vol; non_dynamic5_qi_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol; + non_dynamic5_qi_local_var->cn_packet_delay_budget_dl = cn_packet_delay_budget_dl; + non_dynamic5_qi_local_var->cn_packet_delay_budget_ul = cn_packet_delay_budget_ul; return non_dynamic5_qi_local_var; } @@ -70,6 +74,20 @@ cJSON *OpenAPI_non_dynamic5_qi_convertToJSON(OpenAPI_non_dynamic5_qi_t *non_dyna } } + if (non_dynamic5_qi->cn_packet_delay_budget_dl) { + if (cJSON_AddNumberToObject(item, "cnPacketDelayBudgetDl", non_dynamic5_qi->cn_packet_delay_budget_dl) == NULL) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed [cn_packet_delay_budget_dl]"); + goto end; + } + } + + if (non_dynamic5_qi->cn_packet_delay_budget_ul) { + if (cJSON_AddNumberToObject(item, "cnPacketDelayBudgetUl", non_dynamic5_qi->cn_packet_delay_budget_ul) == NULL) { + ogs_error("OpenAPI_non_dynamic5_qi_convertToJSON() failed [cn_packet_delay_budget_ul]"); + goto end; + } + } + end: return item; } @@ -113,11 +131,31 @@ OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_parseFromJSON(cJSON *non_dyna } } + cJSON *cn_packet_delay_budget_dl = cJSON_GetObjectItemCaseSensitive(non_dynamic5_qiJSON, "cnPacketDelayBudgetDl"); + + if (cn_packet_delay_budget_dl) { + if (!cJSON_IsNumber(cn_packet_delay_budget_dl)) { + ogs_error("OpenAPI_non_dynamic5_qi_parseFromJSON() failed [cn_packet_delay_budget_dl]"); + goto end; + } + } + + cJSON *cn_packet_delay_budget_ul = cJSON_GetObjectItemCaseSensitive(non_dynamic5_qiJSON, "cnPacketDelayBudgetUl"); + + if (cn_packet_delay_budget_ul) { + if (!cJSON_IsNumber(cn_packet_delay_budget_ul)) { + ogs_error("OpenAPI_non_dynamic5_qi_parseFromJSON() failed [cn_packet_delay_budget_ul]"); + goto end; + } + } + non_dynamic5_qi_local_var = OpenAPI_non_dynamic5_qi_create ( priority_level ? priority_level->valuedouble : 0, aver_window ? aver_window->valuedouble : 0, max_data_burst_vol ? max_data_burst_vol->valuedouble : 0, - ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0 + ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0, + cn_packet_delay_budget_dl ? cn_packet_delay_budget_dl->valuedouble : 0, + cn_packet_delay_budget_ul ? cn_packet_delay_budget_ul->valuedouble : 0 ); return non_dynamic5_qi_local_var; diff --git a/lib/sbi/openapi/model/non_dynamic5_qi.h b/lib/sbi/openapi/model/non_dynamic5_qi.h index bf176bd56..b1d2b0c04 100644 --- a/lib/sbi/openapi/model/non_dynamic5_qi.h +++ b/lib/sbi/openapi/model/non_dynamic5_qi.h @@ -23,13 +23,17 @@ typedef struct OpenAPI_non_dynamic5_qi_s { int aver_window; int max_data_burst_vol; int ext_max_data_burst_vol; + int cn_packet_delay_budget_dl; + int cn_packet_delay_budget_ul; } OpenAPI_non_dynamic5_qi_t; OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_create( int priority_level, int aver_window, int max_data_burst_vol, - int ext_max_data_burst_vol + int ext_max_data_burst_vol, + int cn_packet_delay_budget_dl, + int cn_packet_delay_budget_ul ); void OpenAPI_non_dynamic5_qi_free(OpenAPI_non_dynamic5_qi_t *non_dynamic5_qi); OpenAPI_non_dynamic5_qi_t *OpenAPI_non_dynamic5_qi_parseFromJSON(cJSON *non_dynamic5_qiJSON); diff --git a/lib/sbi/openapi/model/non_external_unrelated_class.c b/lib/sbi/openapi/model/non_external_unrelated_class.c deleted file mode 100644 index de9c620bc..000000000 --- a/lib/sbi/openapi/model/non_external_unrelated_class.c +++ /dev/null @@ -1,185 +0,0 @@ - -#include -#include -#include -#include "non_external_unrelated_class.h" - -OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_create( - OpenAPI_list_t *lcs_client_non_externals, - OpenAPI_list_t *af_non_externals - ) -{ - OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class_local_var = OpenAPI_malloc(sizeof(OpenAPI_non_external_unrelated_class_t)); - if (!non_external_unrelated_class_local_var) { - return NULL; - } - non_external_unrelated_class_local_var->lcs_client_non_externals = lcs_client_non_externals; - non_external_unrelated_class_local_var->af_non_externals = af_non_externals; - - return non_external_unrelated_class_local_var; -} - -void OpenAPI_non_external_unrelated_class_free(OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class) -{ - if (NULL == non_external_unrelated_class) { - return; - } - OpenAPI_lnode_t *node; - OpenAPI_list_for_each(non_external_unrelated_class->lcs_client_non_externals, node) { - OpenAPI_lcs_client_non_external_free(node->data); - } - OpenAPI_list_free(non_external_unrelated_class->lcs_client_non_externals); - OpenAPI_list_for_each(non_external_unrelated_class->af_non_externals, node) { - OpenAPI_af_non_external_free(node->data); - } - OpenAPI_list_free(non_external_unrelated_class->af_non_externals); - ogs_free(non_external_unrelated_class); -} - -cJSON *OpenAPI_non_external_unrelated_class_convertToJSON(OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class) -{ - cJSON *item = NULL; - - if (non_external_unrelated_class == NULL) { - ogs_error("OpenAPI_non_external_unrelated_class_convertToJSON() failed [NonExternalUnrelatedClass]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (non_external_unrelated_class->lcs_client_non_externals) { - cJSON *lcs_client_non_externalsList = cJSON_AddArrayToObject(item, "lcsClientNonExternals"); - if (lcs_client_non_externalsList == NULL) { - ogs_error("OpenAPI_non_external_unrelated_class_convertToJSON() failed [lcs_client_non_externals]"); - goto end; - } - - OpenAPI_lnode_t *lcs_client_non_externals_node; - if (non_external_unrelated_class->lcs_client_non_externals) { - OpenAPI_list_for_each(non_external_unrelated_class->lcs_client_non_externals, lcs_client_non_externals_node) { - cJSON *itemLocal = OpenAPI_lcs_client_non_external_convertToJSON(lcs_client_non_externals_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_non_external_unrelated_class_convertToJSON() failed [lcs_client_non_externals]"); - goto end; - } - cJSON_AddItemToArray(lcs_client_non_externalsList, itemLocal); - } - } - } - - if (non_external_unrelated_class->af_non_externals) { - cJSON *af_non_externalsList = cJSON_AddArrayToObject(item, "afNonExternals"); - if (af_non_externalsList == NULL) { - ogs_error("OpenAPI_non_external_unrelated_class_convertToJSON() failed [af_non_externals]"); - goto end; - } - - OpenAPI_lnode_t *af_non_externals_node; - if (non_external_unrelated_class->af_non_externals) { - OpenAPI_list_for_each(non_external_unrelated_class->af_non_externals, af_non_externals_node) { - cJSON *itemLocal = OpenAPI_af_non_external_convertToJSON(af_non_externals_node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_non_external_unrelated_class_convertToJSON() failed [af_non_externals]"); - goto end; - } - cJSON_AddItemToArray(af_non_externalsList, itemLocal); - } - } - } - -end: - return item; -} - -OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_parseFromJSON(cJSON *non_external_unrelated_classJSON) -{ - OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class_local_var = NULL; - cJSON *lcs_client_non_externals = cJSON_GetObjectItemCaseSensitive(non_external_unrelated_classJSON, "lcsClientNonExternals"); - - OpenAPI_list_t *lcs_client_non_externalsList; - if (lcs_client_non_externals) { - cJSON *lcs_client_non_externals_local_nonprimitive; - if (!cJSON_IsArray(lcs_client_non_externals)) { - ogs_error("OpenAPI_non_external_unrelated_class_parseFromJSON() failed [lcs_client_non_externals]"); - goto end; - } - - lcs_client_non_externalsList = OpenAPI_list_create(); - - cJSON_ArrayForEach(lcs_client_non_externals_local_nonprimitive, lcs_client_non_externals ) { - if (!cJSON_IsObject(lcs_client_non_externals_local_nonprimitive)) { - ogs_error("OpenAPI_non_external_unrelated_class_parseFromJSON() failed [lcs_client_non_externals]"); - goto end; - } - OpenAPI_lcs_client_non_external_t *lcs_client_non_externalsItem = OpenAPI_lcs_client_non_external_parseFromJSON(lcs_client_non_externals_local_nonprimitive); - - OpenAPI_list_add(lcs_client_non_externalsList, lcs_client_non_externalsItem); - } - } - - cJSON *af_non_externals = cJSON_GetObjectItemCaseSensitive(non_external_unrelated_classJSON, "afNonExternals"); - - OpenAPI_list_t *af_non_externalsList; - if (af_non_externals) { - cJSON *af_non_externals_local_nonprimitive; - if (!cJSON_IsArray(af_non_externals)) { - ogs_error("OpenAPI_non_external_unrelated_class_parseFromJSON() failed [af_non_externals]"); - goto end; - } - - af_non_externalsList = OpenAPI_list_create(); - - cJSON_ArrayForEach(af_non_externals_local_nonprimitive, af_non_externals ) { - if (!cJSON_IsObject(af_non_externals_local_nonprimitive)) { - ogs_error("OpenAPI_non_external_unrelated_class_parseFromJSON() failed [af_non_externals]"); - goto end; - } - OpenAPI_af_non_external_t *af_non_externalsItem = OpenAPI_af_non_external_parseFromJSON(af_non_externals_local_nonprimitive); - - OpenAPI_list_add(af_non_externalsList, af_non_externalsItem); - } - } - - non_external_unrelated_class_local_var = OpenAPI_non_external_unrelated_class_create ( - lcs_client_non_externals ? lcs_client_non_externalsList : NULL, - af_non_externals ? af_non_externalsList : NULL - ); - - return non_external_unrelated_class_local_var; -end: - return NULL; -} - -OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_copy(OpenAPI_non_external_unrelated_class_t *dst, OpenAPI_non_external_unrelated_class_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_non_external_unrelated_class_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_non_external_unrelated_class_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_non_external_unrelated_class_free(dst); - dst = OpenAPI_non_external_unrelated_class_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/non_external_unrelated_class.h b/lib/sbi/openapi/model/non_external_unrelated_class.h deleted file mode 100644 index 08f09c451..000000000 --- a/lib/sbi/openapi/model/non_external_unrelated_class.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * non_external_unrelated_class.h - * - * - */ - -#ifndef _OpenAPI_non_external_unrelated_class_H_ -#define _OpenAPI_non_external_unrelated_class_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "af_non_external.h" -#include "lcs_client_non_external.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_non_external_unrelated_class_s OpenAPI_non_external_unrelated_class_t; -typedef struct OpenAPI_non_external_unrelated_class_s { - OpenAPI_list_t *lcs_client_non_externals; - OpenAPI_list_t *af_non_externals; -} OpenAPI_non_external_unrelated_class_t; - -OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_create( - OpenAPI_list_t *lcs_client_non_externals, - OpenAPI_list_t *af_non_externals - ); -void OpenAPI_non_external_unrelated_class_free(OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class); -OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_parseFromJSON(cJSON *non_external_unrelated_classJSON); -cJSON *OpenAPI_non_external_unrelated_class_convertToJSON(OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class); -OpenAPI_non_external_unrelated_class_t *OpenAPI_non_external_unrelated_class_copy(OpenAPI_non_external_unrelated_class_t *dst, OpenAPI_non_external_unrelated_class_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_non_external_unrelated_class_H_ */ - diff --git a/lib/sbi/openapi/model/notification_control.c b/lib/sbi/openapi/model/notification_control.c index 0381a1841..7ee9e2b57 100644 --- a/lib/sbi/openapi/model/notification_control.c +++ b/lib/sbi/openapi/model/notification_control.c @@ -4,82 +4,27 @@ #include #include "notification_control.h" -OpenAPI_notification_control_t *OpenAPI_notification_control_create( - ) +char* OpenAPI_notification_control_ToString(OpenAPI_notification_control_e notification_control) { - OpenAPI_notification_control_t *notification_control_local_var = OpenAPI_malloc(sizeof(OpenAPI_notification_control_t)); - if (!notification_control_local_var) { - return NULL; - } - - return notification_control_local_var; + const char *notification_controlArray[] = { "NULL", "REQUESTED", "NOT_REQUESTED" }; + size_t sizeofArray = sizeof(notification_controlArray) / sizeof(notification_controlArray[0]); + if (notification_control < sizeofArray) + return (char *)notification_controlArray[notification_control]; + else + return (char *)"Unknown"; } -void OpenAPI_notification_control_free(OpenAPI_notification_control_t *notification_control) +OpenAPI_notification_control_e OpenAPI_notification_control_FromString(char* notification_control) { - if (NULL == notification_control) { - return; + int stringToReturn = 0; + const char *notification_controlArray[] = { "NULL", "REQUESTED", "NOT_REQUESTED" }; + size_t sizeofArray = sizeof(notification_controlArray) / sizeof(notification_controlArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(notification_control, notification_controlArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(notification_control); -} - -cJSON *OpenAPI_notification_control_convertToJSON(OpenAPI_notification_control_t *notification_control) -{ - cJSON *item = NULL; - - if (notification_control == NULL) { - ogs_error("OpenAPI_notification_control_convertToJSON() failed [NotificationControl]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_notification_control_t *OpenAPI_notification_control_parseFromJSON(cJSON *notification_controlJSON) -{ - OpenAPI_notification_control_t *notification_control_local_var = NULL; - notification_control_local_var = OpenAPI_notification_control_create ( - ); - - return notification_control_local_var; -end: - return NULL; -} - -OpenAPI_notification_control_t *OpenAPI_notification_control_copy(OpenAPI_notification_control_t *dst, OpenAPI_notification_control_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_notification_control_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_notification_control_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_notification_control_free(dst); - dst = OpenAPI_notification_control_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/notification_control.h b/lib/sbi/openapi/model/notification_control.h index 9cca2ab26..ea459a667 100644 --- a/lib/sbi/openapi/model/notification_control.h +++ b/lib/sbi/openapi/model/notification_control.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_notification_control_s OpenAPI_notification_control_t; -typedef struct OpenAPI_notification_control_s { -} OpenAPI_notification_control_t; +typedef enum { OpenAPI_notification_control_NULL = 0, OpenAPI_notification_control_REQUESTED, OpenAPI_notification_control_NOT_REQUESTED } OpenAPI_notification_control_e; -OpenAPI_notification_control_t *OpenAPI_notification_control_create( - ); -void OpenAPI_notification_control_free(OpenAPI_notification_control_t *notification_control); -OpenAPI_notification_control_t *OpenAPI_notification_control_parseFromJSON(cJSON *notification_controlJSON); -cJSON *OpenAPI_notification_control_convertToJSON(OpenAPI_notification_control_t *notification_control); -OpenAPI_notification_control_t *OpenAPI_notification_control_copy(OpenAPI_notification_control_t *dst, OpenAPI_notification_control_t *src); +char* OpenAPI_notification_control_ToString(OpenAPI_notification_control_e notification_control); + +OpenAPI_notification_control_e OpenAPI_notification_control_FromString(char* notification_control); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/notification_data.c b/lib/sbi/openapi/model/notification_data.c index e8fef30c1..97abca23d 100644 --- a/lib/sbi/openapi/model/notification_data.c +++ b/lib/sbi/openapi/model/notification_data.c @@ -8,7 +8,8 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_create( OpenAPI_notification_event_type_e event, char *nf_instance_uri, OpenAPI_nf_profile_t *nf_profile, - OpenAPI_list_t *profile_changes + OpenAPI_list_t *profile_changes, + OpenAPI_condition_event_type_e condition_event ) { OpenAPI_notification_data_t *notification_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_notification_data_t)); @@ -19,6 +20,7 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_create( notification_data_local_var->nf_instance_uri = nf_instance_uri; notification_data_local_var->nf_profile = nf_profile; notification_data_local_var->profile_changes = profile_changes; + notification_data_local_var->condition_event = condition_event; return notification_data_local_var; } @@ -99,6 +101,13 @@ cJSON *OpenAPI_notification_data_convertToJSON(OpenAPI_notification_data_t *noti } } + if (notification_data->condition_event) { + if (cJSON_AddStringToObject(item, "conditionEvent", OpenAPI_condition_event_type_ToString(notification_data->condition_event)) == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [condition_event]"); + goto end; + } + } + end: return item; } @@ -162,11 +171,23 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *noti } } + cJSON *condition_event = cJSON_GetObjectItemCaseSensitive(notification_dataJSON, "conditionEvent"); + + OpenAPI_condition_event_type_e condition_eventVariable; + if (condition_event) { + if (!cJSON_IsString(condition_event)) { + ogs_error("OpenAPI_notification_data_parseFromJSON() failed [condition_event]"); + goto end; + } + condition_eventVariable = OpenAPI_condition_event_type_FromString(condition_event->valuestring); + } + notification_data_local_var = OpenAPI_notification_data_create ( eventVariable, ogs_strdup(nf_instance_uri->valuestring), nf_profile ? nf_profile_local_nonprim : NULL, - profile_changes ? profile_changesList : NULL + profile_changes ? profile_changesList : NULL, + condition_event ? condition_eventVariable : 0 ); return notification_data_local_var; diff --git a/lib/sbi/openapi/model/notification_data.h b/lib/sbi/openapi/model/notification_data.h index 13d40c18e..713a704c3 100644 --- a/lib/sbi/openapi/model/notification_data.h +++ b/lib/sbi/openapi/model/notification_data.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "change_item.h" +#include "condition_event_type.h" #include "nf_profile.h" #include "notification_event_type.h" @@ -26,13 +27,15 @@ typedef struct OpenAPI_notification_data_s { char *nf_instance_uri; struct OpenAPI_nf_profile_s *nf_profile; OpenAPI_list_t *profile_changes; + OpenAPI_condition_event_type_e condition_event; } OpenAPI_notification_data_t; OpenAPI_notification_data_t *OpenAPI_notification_data_create( OpenAPI_notification_event_type_e event, char *nf_instance_uri, OpenAPI_nf_profile_t *nf_profile, - OpenAPI_list_t *profile_changes + OpenAPI_list_t *profile_changes, + OpenAPI_condition_event_type_e condition_event ); void OpenAPI_notification_data_free(OpenAPI_notification_data_t *notification_data); OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *notification_dataJSON); diff --git a/lib/sbi/openapi/model/notification_type.c b/lib/sbi/openapi/model/notification_type.c index 9b80f0220..a6a29367d 100644 --- a/lib/sbi/openapi/model/notification_type.c +++ b/lib/sbi/openapi/model/notification_type.c @@ -6,7 +6,7 @@ char* OpenAPI_notification_type_ToString(OpenAPI_notification_type_e notification_type) { - const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION" }; + const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION", "NSSAA_REAUTH_NOTIFICATION", "NSSAA_REVOC_NOTIFICATION" }; size_t sizeofArray = sizeof(notification_typeArray) / sizeof(notification_typeArray[0]); if (notification_type < sizeofArray) return (char *)notification_typeArray[notification_type]; @@ -17,7 +17,7 @@ char* OpenAPI_notification_type_ToString(OpenAPI_notification_type_e notificatio OpenAPI_notification_type_e OpenAPI_notification_type_FromString(char* notification_type) { int stringToReturn = 0; - const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION" }; + const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION", "NSSAA_REAUTH_NOTIFICATION", "NSSAA_REVOC_NOTIFICATION" }; size_t sizeofArray = sizeof(notification_typeArray) / sizeof(notification_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(notification_type, notification_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/notification_type.h b/lib/sbi/openapi/model/notification_type.h index c5a937a12..d31ea2b06 100644 --- a/lib/sbi/openapi/model/notification_type.h +++ b/lib/sbi/openapi/model/notification_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_notification_type_NULL = 0, OpenAPI_notification_type_N1_MESSAGES, OpenAPI_notification_type_N2_INFORMATION, OpenAPI_notification_type_LOCATION_NOTIFICATION, OpenAPI_notification_type_DATA_REMOVAL_NOTIFICATION, OpenAPI_notification_type_DATA_CHANGE_NOTIFICATION, OpenAPI_notification_type_LOCATION_UPDATE_NOTIFICATION } OpenAPI_notification_type_e; +typedef enum { OpenAPI_notification_type_NULL = 0, OpenAPI_notification_type_N1_MESSAGES, OpenAPI_notification_type_N2_INFORMATION, OpenAPI_notification_type_LOCATION_NOTIFICATION, OpenAPI_notification_type_DATA_REMOVAL_NOTIFICATION, OpenAPI_notification_type_DATA_CHANGE_NOTIFICATION, OpenAPI_notification_type_LOCATION_UPDATE_NOTIFICATION, OpenAPI_notification_type_NSSAA_REAUTH_NOTIFICATION, OpenAPI_notification_type_NSSAA_REVOC_NOTIFICATION } OpenAPI_notification_type_e; char* OpenAPI_notification_type_ToString(OpenAPI_notification_type_e notification_type); diff --git a/lib/sbi/openapi/model/nr_v2x_auth.c b/lib/sbi/openapi/model/nr_v2x_auth.c index fded67537..cf3257ad0 100644 --- a/lib/sbi/openapi/model/nr_v2x_auth.c +++ b/lib/sbi/openapi/model/nr_v2x_auth.c @@ -5,8 +5,8 @@ #include "nr_v2x_auth.h" OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_create( - OpenAPI_ue_auth_t *vehicle_ue_auth, - OpenAPI_ue_auth_t *pedestrian_ue_auth + OpenAPI_ue_auth_e vehicle_ue_auth, + OpenAPI_ue_auth_e pedestrian_ue_auth ) { OpenAPI_nr_v2x_auth_t *nr_v2x_auth_local_var = OpenAPI_malloc(sizeof(OpenAPI_nr_v2x_auth_t)); @@ -25,8 +25,6 @@ void OpenAPI_nr_v2x_auth_free(OpenAPI_nr_v2x_auth_t *nr_v2x_auth) return; } OpenAPI_lnode_t *node; - OpenAPI_ue_auth_free(nr_v2x_auth->vehicle_ue_auth); - OpenAPI_ue_auth_free(nr_v2x_auth->pedestrian_ue_auth); ogs_free(nr_v2x_auth); } @@ -41,26 +39,14 @@ cJSON *OpenAPI_nr_v2x_auth_convertToJSON(OpenAPI_nr_v2x_auth_t *nr_v2x_auth) item = cJSON_CreateObject(); if (nr_v2x_auth->vehicle_ue_auth) { - cJSON *vehicle_ue_auth_local_JSON = OpenAPI_ue_auth_convertToJSON(nr_v2x_auth->vehicle_ue_auth); - if (vehicle_ue_auth_local_JSON == NULL) { - ogs_error("OpenAPI_nr_v2x_auth_convertToJSON() failed [vehicle_ue_auth]"); - goto end; - } - cJSON_AddItemToObject(item, "vehicleUeAuth", vehicle_ue_auth_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "vehicleUeAuth", OpenAPI_ue_auth_ToString(nr_v2x_auth->vehicle_ue_auth)) == NULL) { ogs_error("OpenAPI_nr_v2x_auth_convertToJSON() failed [vehicle_ue_auth]"); goto end; } } if (nr_v2x_auth->pedestrian_ue_auth) { - cJSON *pedestrian_ue_auth_local_JSON = OpenAPI_ue_auth_convertToJSON(nr_v2x_auth->pedestrian_ue_auth); - if (pedestrian_ue_auth_local_JSON == NULL) { - ogs_error("OpenAPI_nr_v2x_auth_convertToJSON() failed [pedestrian_ue_auth]"); - goto end; - } - cJSON_AddItemToObject(item, "pedestrianUeAuth", pedestrian_ue_auth_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "pedestrianUeAuth", OpenAPI_ue_auth_ToString(nr_v2x_auth->pedestrian_ue_auth)) == NULL) { ogs_error("OpenAPI_nr_v2x_auth_convertToJSON() failed [pedestrian_ue_auth]"); goto end; } @@ -75,21 +61,29 @@ OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_parseFromJSON(cJSON *nr_v2x_authJSON) OpenAPI_nr_v2x_auth_t *nr_v2x_auth_local_var = NULL; cJSON *vehicle_ue_auth = cJSON_GetObjectItemCaseSensitive(nr_v2x_authJSON, "vehicleUeAuth"); - OpenAPI_ue_auth_t *vehicle_ue_auth_local_nonprim = NULL; + OpenAPI_ue_auth_e vehicle_ue_authVariable; if (vehicle_ue_auth) { - vehicle_ue_auth_local_nonprim = OpenAPI_ue_auth_parseFromJSON(vehicle_ue_auth); + if (!cJSON_IsString(vehicle_ue_auth)) { + ogs_error("OpenAPI_nr_v2x_auth_parseFromJSON() failed [vehicle_ue_auth]"); + goto end; + } + vehicle_ue_authVariable = OpenAPI_ue_auth_FromString(vehicle_ue_auth->valuestring); } cJSON *pedestrian_ue_auth = cJSON_GetObjectItemCaseSensitive(nr_v2x_authJSON, "pedestrianUeAuth"); - OpenAPI_ue_auth_t *pedestrian_ue_auth_local_nonprim = NULL; + OpenAPI_ue_auth_e pedestrian_ue_authVariable; if (pedestrian_ue_auth) { - pedestrian_ue_auth_local_nonprim = OpenAPI_ue_auth_parseFromJSON(pedestrian_ue_auth); + if (!cJSON_IsString(pedestrian_ue_auth)) { + ogs_error("OpenAPI_nr_v2x_auth_parseFromJSON() failed [pedestrian_ue_auth]"); + goto end; + } + pedestrian_ue_authVariable = OpenAPI_ue_auth_FromString(pedestrian_ue_auth->valuestring); } nr_v2x_auth_local_var = OpenAPI_nr_v2x_auth_create ( - vehicle_ue_auth ? vehicle_ue_auth_local_nonprim : NULL, - pedestrian_ue_auth ? pedestrian_ue_auth_local_nonprim : NULL + vehicle_ue_auth ? vehicle_ue_authVariable : 0, + pedestrian_ue_auth ? pedestrian_ue_authVariable : 0 ); return nr_v2x_auth_local_var; diff --git a/lib/sbi/openapi/model/nr_v2x_auth.h b/lib/sbi/openapi/model/nr_v2x_auth.h index d13e7c31b..f945fbd85 100644 --- a/lib/sbi/openapi/model/nr_v2x_auth.h +++ b/lib/sbi/openapi/model/nr_v2x_auth.h @@ -20,13 +20,13 @@ extern "C" { typedef struct OpenAPI_nr_v2x_auth_s OpenAPI_nr_v2x_auth_t; typedef struct OpenAPI_nr_v2x_auth_s { - struct OpenAPI_ue_auth_s *vehicle_ue_auth; - struct OpenAPI_ue_auth_s *pedestrian_ue_auth; + OpenAPI_ue_auth_e vehicle_ue_auth; + OpenAPI_ue_auth_e pedestrian_ue_auth; } OpenAPI_nr_v2x_auth_t; OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_create( - OpenAPI_ue_auth_t *vehicle_ue_auth, - OpenAPI_ue_auth_t *pedestrian_ue_auth + OpenAPI_ue_auth_e vehicle_ue_auth, + OpenAPI_ue_auth_e pedestrian_ue_auth ); void OpenAPI_nr_v2x_auth_free(OpenAPI_nr_v2x_auth_t *nr_v2x_auth); OpenAPI_nr_v2x_auth_t *OpenAPI_nr_v2x_auth_parseFromJSON(cJSON *nr_v2x_authJSON); diff --git a/lib/sbi/openapi/model/nrf_info.c b/lib/sbi/openapi/model/nrf_info.c index 5a268dba4..d4624c71d 100644 --- a/lib/sbi/openapi/model/nrf_info.c +++ b/lib/sbi/openapi/model/nrf_info.c @@ -6,21 +6,33 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( OpenAPI_list_t* served_udr_info, + OpenAPI_list_t* served_udr_info_list, OpenAPI_list_t* served_udm_info, + OpenAPI_list_t* served_udm_info_list, OpenAPI_list_t* served_ausf_info, + OpenAPI_list_t* served_ausf_info_list, OpenAPI_list_t* served_amf_info, + OpenAPI_list_t* served_amf_info_list, OpenAPI_list_t* served_smf_info, + OpenAPI_list_t* served_smf_info_list, OpenAPI_list_t* served_upf_info, + OpenAPI_list_t* served_upf_info_list, OpenAPI_list_t* served_pcf_info, + OpenAPI_list_t* served_pcf_info_list, OpenAPI_list_t* served_bsf_info, + OpenAPI_list_t* served_bsf_info_list, OpenAPI_list_t* served_chf_info, + OpenAPI_list_t* served_chf_info_list, OpenAPI_list_t* served_nef_info, OpenAPI_list_t* served_nwdaf_info, - OpenAPI_list_t* served_pcscf_info, + OpenAPI_list_t* served_pcscf_info_list, OpenAPI_list_t* served_gmlc_info, OpenAPI_list_t* served_lmf_info, OpenAPI_list_t* served_nf_info, - OpenAPI_list_t* served_hss_info + OpenAPI_list_t* served_hss_info_list, + OpenAPI_list_t* served_udsf_info, + OpenAPI_list_t* served_udsf_info_list, + OpenAPI_list_t* served_scp_info_list ) { OpenAPI_nrf_info_t *nrf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_nrf_info_t)); @@ -28,21 +40,33 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( return NULL; } nrf_info_local_var->served_udr_info = served_udr_info; + nrf_info_local_var->served_udr_info_list = served_udr_info_list; nrf_info_local_var->served_udm_info = served_udm_info; + nrf_info_local_var->served_udm_info_list = served_udm_info_list; nrf_info_local_var->served_ausf_info = served_ausf_info; + nrf_info_local_var->served_ausf_info_list = served_ausf_info_list; nrf_info_local_var->served_amf_info = served_amf_info; + nrf_info_local_var->served_amf_info_list = served_amf_info_list; nrf_info_local_var->served_smf_info = served_smf_info; + nrf_info_local_var->served_smf_info_list = served_smf_info_list; nrf_info_local_var->served_upf_info = served_upf_info; + nrf_info_local_var->served_upf_info_list = served_upf_info_list; nrf_info_local_var->served_pcf_info = served_pcf_info; + nrf_info_local_var->served_pcf_info_list = served_pcf_info_list; nrf_info_local_var->served_bsf_info = served_bsf_info; + nrf_info_local_var->served_bsf_info_list = served_bsf_info_list; nrf_info_local_var->served_chf_info = served_chf_info; + nrf_info_local_var->served_chf_info_list = served_chf_info_list; nrf_info_local_var->served_nef_info = served_nef_info; nrf_info_local_var->served_nwdaf_info = served_nwdaf_info; - nrf_info_local_var->served_pcscf_info = served_pcscf_info; + nrf_info_local_var->served_pcscf_info_list = served_pcscf_info_list; nrf_info_local_var->served_gmlc_info = served_gmlc_info; nrf_info_local_var->served_lmf_info = served_lmf_info; nrf_info_local_var->served_nf_info = served_nf_info; - nrf_info_local_var->served_hss_info = served_hss_info; + nrf_info_local_var->served_hss_info_list = served_hss_info_list; + nrf_info_local_var->served_udsf_info = served_udsf_info; + nrf_info_local_var->served_udsf_info_list = served_udsf_info_list; + nrf_info_local_var->served_scp_info_list = served_scp_info_list; return nrf_info_local_var; } @@ -59,54 +83,108 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_udr_info); + OpenAPI_list_for_each(nrf_info->served_udr_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_udr_info_list); OpenAPI_list_for_each(nrf_info->served_udm_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_udm_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_udm_info); + OpenAPI_list_for_each(nrf_info->served_udm_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_udm_info_list); OpenAPI_list_for_each(nrf_info->served_ausf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_ausf_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_ausf_info); + OpenAPI_list_for_each(nrf_info->served_ausf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_ausf_info_list); OpenAPI_list_for_each(nrf_info->served_amf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_amf_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_amf_info); + OpenAPI_list_for_each(nrf_info->served_amf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_amf_info_list); OpenAPI_list_for_each(nrf_info->served_smf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_smf_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_smf_info); + OpenAPI_list_for_each(nrf_info->served_smf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_smf_info_list); OpenAPI_list_for_each(nrf_info->served_upf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_upf_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_upf_info); + OpenAPI_list_for_each(nrf_info->served_upf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_upf_info_list); OpenAPI_list_for_each(nrf_info->served_pcf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_pcf_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_pcf_info); + OpenAPI_list_for_each(nrf_info->served_pcf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_pcf_info_list); OpenAPI_list_for_each(nrf_info->served_bsf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_bsf_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_bsf_info); + OpenAPI_list_for_each(nrf_info->served_bsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_bsf_info_list); OpenAPI_list_for_each(nrf_info->served_chf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_chf_info_free(localKeyValue->value); ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_chf_info); + OpenAPI_list_for_each(nrf_info->served_chf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_chf_info_list); OpenAPI_list_for_each(nrf_info->served_nef_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_nef_info_free(localKeyValue->value); @@ -119,12 +197,12 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_nwdaf_info); - OpenAPI_list_for_each(nrf_info->served_pcscf_info, node) { + OpenAPI_list_for_each(nrf_info->served_pcscf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; - OpenAPI_pcscf_info_free(localKeyValue->value); + ogs_free(localKeyValue->value); ogs_free(localKeyValue); } - OpenAPI_list_free(nrf_info->served_pcscf_info); + OpenAPI_list_free(nrf_info->served_pcscf_info_list); OpenAPI_list_for_each(nrf_info->served_gmlc_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; OpenAPI_gmlc_info_free(localKeyValue->value); @@ -143,12 +221,30 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) ogs_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_nf_info); - OpenAPI_list_for_each(nrf_info->served_hss_info, node) { + OpenAPI_list_for_each(nrf_info->served_hss_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; - OpenAPI_hss_info_free(localKeyValue->value); + ogs_free(localKeyValue->value); ogs_free(localKeyValue); } - OpenAPI_list_free(nrf_info->served_hss_info); + OpenAPI_list_free(nrf_info->served_hss_info_list); + OpenAPI_list_for_each(nrf_info->served_udsf_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_udsf_info_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_udsf_info); + OpenAPI_list_for_each(nrf_info->served_udsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_udsf_info_list); + OpenAPI_list_for_each(nrf_info->served_scp_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_scp_info_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_scp_info_list); ogs_free(nrf_info); } @@ -183,6 +279,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_udr_info_list) { + cJSON *served_udr_info_list = cJSON_AddObjectToObject(item, "servedUdrInfoList"); + if (served_udr_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udr_info_list]"); + goto end; + } + cJSON *localMapObject = served_udr_info_list; + OpenAPI_lnode_t *served_udr_info_list_node; + if (nrf_info->served_udr_info_list) { + OpenAPI_list_for_each(nrf_info->served_udr_info_list, served_udr_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_udr_info_list_node->data; + } + } + } + if (nrf_info->served_udm_info) { cJSON *served_udm_info = cJSON_AddObjectToObject(item, "servedUdmInfo"); if (served_udm_info == NULL) { @@ -204,6 +315,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_udm_info_list) { + cJSON *served_udm_info_list = cJSON_AddObjectToObject(item, "servedUdmInfoList"); + if (served_udm_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udm_info_list]"); + goto end; + } + cJSON *localMapObject = served_udm_info_list; + OpenAPI_lnode_t *served_udm_info_list_node; + if (nrf_info->served_udm_info_list) { + OpenAPI_list_for_each(nrf_info->served_udm_info_list, served_udm_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_udm_info_list_node->data; + } + } + } + if (nrf_info->served_ausf_info) { cJSON *served_ausf_info = cJSON_AddObjectToObject(item, "servedAusfInfo"); if (served_ausf_info == NULL) { @@ -225,6 +351,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_ausf_info_list) { + cJSON *served_ausf_info_list = cJSON_AddObjectToObject(item, "servedAusfInfoList"); + if (served_ausf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_ausf_info_list]"); + goto end; + } + cJSON *localMapObject = served_ausf_info_list; + OpenAPI_lnode_t *served_ausf_info_list_node; + if (nrf_info->served_ausf_info_list) { + OpenAPI_list_for_each(nrf_info->served_ausf_info_list, served_ausf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_ausf_info_list_node->data; + } + } + } + if (nrf_info->served_amf_info) { cJSON *served_amf_info = cJSON_AddObjectToObject(item, "servedAmfInfo"); if (served_amf_info == NULL) { @@ -246,6 +387,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_amf_info_list) { + cJSON *served_amf_info_list = cJSON_AddObjectToObject(item, "servedAmfInfoList"); + if (served_amf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_amf_info_list]"); + goto end; + } + cJSON *localMapObject = served_amf_info_list; + OpenAPI_lnode_t *served_amf_info_list_node; + if (nrf_info->served_amf_info_list) { + OpenAPI_list_for_each(nrf_info->served_amf_info_list, served_amf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_amf_info_list_node->data; + } + } + } + if (nrf_info->served_smf_info) { cJSON *served_smf_info = cJSON_AddObjectToObject(item, "servedSmfInfo"); if (served_smf_info == NULL) { @@ -267,6 +423,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_smf_info_list) { + cJSON *served_smf_info_list = cJSON_AddObjectToObject(item, "servedSmfInfoList"); + if (served_smf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_smf_info_list]"); + goto end; + } + cJSON *localMapObject = served_smf_info_list; + OpenAPI_lnode_t *served_smf_info_list_node; + if (nrf_info->served_smf_info_list) { + OpenAPI_list_for_each(nrf_info->served_smf_info_list, served_smf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_smf_info_list_node->data; + } + } + } + if (nrf_info->served_upf_info) { cJSON *served_upf_info = cJSON_AddObjectToObject(item, "servedUpfInfo"); if (served_upf_info == NULL) { @@ -288,6 +459,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_upf_info_list) { + cJSON *served_upf_info_list = cJSON_AddObjectToObject(item, "servedUpfInfoList"); + if (served_upf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_upf_info_list]"); + goto end; + } + cJSON *localMapObject = served_upf_info_list; + OpenAPI_lnode_t *served_upf_info_list_node; + if (nrf_info->served_upf_info_list) { + OpenAPI_list_for_each(nrf_info->served_upf_info_list, served_upf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_upf_info_list_node->data; + } + } + } + if (nrf_info->served_pcf_info) { cJSON *served_pcf_info = cJSON_AddObjectToObject(item, "servedPcfInfo"); if (served_pcf_info == NULL) { @@ -309,6 +495,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_pcf_info_list) { + cJSON *served_pcf_info_list = cJSON_AddObjectToObject(item, "servedPcfInfoList"); + if (served_pcf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_pcf_info_list]"); + goto end; + } + cJSON *localMapObject = served_pcf_info_list; + OpenAPI_lnode_t *served_pcf_info_list_node; + if (nrf_info->served_pcf_info_list) { + OpenAPI_list_for_each(nrf_info->served_pcf_info_list, served_pcf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_pcf_info_list_node->data; + } + } + } + if (nrf_info->served_bsf_info) { cJSON *served_bsf_info = cJSON_AddObjectToObject(item, "servedBsfInfo"); if (served_bsf_info == NULL) { @@ -330,6 +531,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_bsf_info_list) { + cJSON *served_bsf_info_list = cJSON_AddObjectToObject(item, "servedBsfInfoList"); + if (served_bsf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_bsf_info_list]"); + goto end; + } + cJSON *localMapObject = served_bsf_info_list; + OpenAPI_lnode_t *served_bsf_info_list_node; + if (nrf_info->served_bsf_info_list) { + OpenAPI_list_for_each(nrf_info->served_bsf_info_list, served_bsf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_bsf_info_list_node->data; + } + } + } + if (nrf_info->served_chf_info) { cJSON *served_chf_info = cJSON_AddObjectToObject(item, "servedChfInfo"); if (served_chf_info == NULL) { @@ -351,6 +567,21 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } + if (nrf_info->served_chf_info_list) { + cJSON *served_chf_info_list = cJSON_AddObjectToObject(item, "servedChfInfoList"); + if (served_chf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_chf_info_list]"); + goto end; + } + cJSON *localMapObject = served_chf_info_list; + OpenAPI_lnode_t *served_chf_info_list_node; + if (nrf_info->served_chf_info_list) { + OpenAPI_list_for_each(nrf_info->served_chf_info_list, served_chf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_chf_info_list_node->data; + } + } + } + if (nrf_info->served_nef_info) { cJSON *served_nef_info = cJSON_AddObjectToObject(item, "servedNefInfo"); if (served_nef_info == NULL) { @@ -393,23 +624,17 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } - if (nrf_info->served_pcscf_info) { - cJSON *served_pcscf_info = cJSON_AddObjectToObject(item, "servedPcscfInfo"); - if (served_pcscf_info == NULL) { - ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_pcscf_info]"); + if (nrf_info->served_pcscf_info_list) { + cJSON *served_pcscf_info_list = cJSON_AddObjectToObject(item, "servedPcscfInfoList"); + if (served_pcscf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_pcscf_info_list]"); goto end; } - cJSON *localMapObject = served_pcscf_info; - OpenAPI_lnode_t *served_pcscf_info_node; - if (nrf_info->served_pcscf_info) { - OpenAPI_list_for_each(nrf_info->served_pcscf_info, served_pcscf_info_node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_pcscf_info_node->data; - cJSON *itemLocal = OpenAPI_pcscf_info_convertToJSON(localKeyValue->value); - if (itemLocal == NULL) { - ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_pcscf_info]"); - goto end; - } - cJSON_AddItemToObject(served_pcscf_info, localKeyValue->key, itemLocal); + cJSON *localMapObject = served_pcscf_info_list; + OpenAPI_lnode_t *served_pcscf_info_list_node; + if (nrf_info->served_pcscf_info_list) { + OpenAPI_list_for_each(nrf_info->served_pcscf_info_list, served_pcscf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_pcscf_info_list_node->data; } } } @@ -477,23 +702,74 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) } } - if (nrf_info->served_hss_info) { - cJSON *served_hss_info = cJSON_AddObjectToObject(item, "servedHssInfo"); - if (served_hss_info == NULL) { - ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_hss_info]"); + if (nrf_info->served_hss_info_list) { + cJSON *served_hss_info_list = cJSON_AddObjectToObject(item, "servedHssInfoList"); + if (served_hss_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_hss_info_list]"); goto end; } - cJSON *localMapObject = served_hss_info; - OpenAPI_lnode_t *served_hss_info_node; - if (nrf_info->served_hss_info) { - OpenAPI_list_for_each(nrf_info->served_hss_info, served_hss_info_node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_hss_info_node->data; - cJSON *itemLocal = OpenAPI_hss_info_convertToJSON(localKeyValue->value); + cJSON *localMapObject = served_hss_info_list; + OpenAPI_lnode_t *served_hss_info_list_node; + if (nrf_info->served_hss_info_list) { + OpenAPI_list_for_each(nrf_info->served_hss_info_list, served_hss_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_hss_info_list_node->data; + } + } + } + + if (nrf_info->served_udsf_info) { + cJSON *served_udsf_info = cJSON_AddObjectToObject(item, "servedUdsfInfo"); + if (served_udsf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udsf_info]"); + goto end; + } + cJSON *localMapObject = served_udsf_info; + OpenAPI_lnode_t *served_udsf_info_node; + if (nrf_info->served_udsf_info) { + OpenAPI_list_for_each(nrf_info->served_udsf_info, served_udsf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_udsf_info_node->data; + cJSON *itemLocal = OpenAPI_udsf_info_convertToJSON(localKeyValue->value); if (itemLocal == NULL) { - ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_hss_info]"); + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udsf_info]"); goto end; } - cJSON_AddItemToObject(served_hss_info, localKeyValue->key, itemLocal); + cJSON_AddItemToObject(served_udsf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_udsf_info_list) { + cJSON *served_udsf_info_list = cJSON_AddObjectToObject(item, "servedUdsfInfoList"); + if (served_udsf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udsf_info_list]"); + goto end; + } + cJSON *localMapObject = served_udsf_info_list; + OpenAPI_lnode_t *served_udsf_info_list_node; + if (nrf_info->served_udsf_info_list) { + OpenAPI_list_for_each(nrf_info->served_udsf_info_list, served_udsf_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_udsf_info_list_node->data; + } + } + } + + if (nrf_info->served_scp_info_list) { + cJSON *served_scp_info_list = cJSON_AddObjectToObject(item, "servedScpInfoList"); + if (served_scp_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_scp_info_list]"); + goto end; + } + cJSON *localMapObject = served_scp_info_list; + OpenAPI_lnode_t *served_scp_info_list_node; + if (nrf_info->served_scp_info_list) { + OpenAPI_list_for_each(nrf_info->served_scp_info_list, served_scp_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_scp_info_list_node->data; + cJSON *itemLocal = OpenAPI_scp_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_scp_info_list]"); + goto end; + } + cJSON_AddItemToObject(served_scp_info_list, localKeyValue->key, itemLocal); } } } @@ -528,6 +804,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_udr_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdrInfoList"); + + OpenAPI_list_t *served_udr_info_listList; + if (served_udr_info_list) { + cJSON *served_udr_info_list_local_map; + if (!cJSON_IsObject(served_udr_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udr_info_list]"); + goto end; + } + served_udr_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_udr_info_list_local_map, served_udr_info_list) { + cJSON *localMapObject = served_udr_info_list_local_map; + OpenAPI_list_add(served_udr_info_listList, localMapKeyPair); + } + } + cJSON *served_udm_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdmInfo"); OpenAPI_list_t *served_udm_infoList; @@ -551,6 +844,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_udm_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdmInfoList"); + + OpenAPI_list_t *served_udm_info_listList; + if (served_udm_info_list) { + cJSON *served_udm_info_list_local_map; + if (!cJSON_IsObject(served_udm_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udm_info_list]"); + goto end; + } + served_udm_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_udm_info_list_local_map, served_udm_info_list) { + cJSON *localMapObject = served_udm_info_list_local_map; + OpenAPI_list_add(served_udm_info_listList, localMapKeyPair); + } + } + cJSON *served_ausf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedAusfInfo"); OpenAPI_list_t *served_ausf_infoList; @@ -574,6 +884,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_ausf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedAusfInfoList"); + + OpenAPI_list_t *served_ausf_info_listList; + if (served_ausf_info_list) { + cJSON *served_ausf_info_list_local_map; + if (!cJSON_IsObject(served_ausf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_ausf_info_list]"); + goto end; + } + served_ausf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_ausf_info_list_local_map, served_ausf_info_list) { + cJSON *localMapObject = served_ausf_info_list_local_map; + OpenAPI_list_add(served_ausf_info_listList, localMapKeyPair); + } + } + cJSON *served_amf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedAmfInfo"); OpenAPI_list_t *served_amf_infoList; @@ -597,6 +924,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_amf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedAmfInfoList"); + + OpenAPI_list_t *served_amf_info_listList; + if (served_amf_info_list) { + cJSON *served_amf_info_list_local_map; + if (!cJSON_IsObject(served_amf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_amf_info_list]"); + goto end; + } + served_amf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_amf_info_list_local_map, served_amf_info_list) { + cJSON *localMapObject = served_amf_info_list_local_map; + OpenAPI_list_add(served_amf_info_listList, localMapKeyPair); + } + } + cJSON *served_smf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedSmfInfo"); OpenAPI_list_t *served_smf_infoList; @@ -620,6 +964,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_smf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedSmfInfoList"); + + OpenAPI_list_t *served_smf_info_listList; + if (served_smf_info_list) { + cJSON *served_smf_info_list_local_map; + if (!cJSON_IsObject(served_smf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_smf_info_list]"); + goto end; + } + served_smf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_smf_info_list_local_map, served_smf_info_list) { + cJSON *localMapObject = served_smf_info_list_local_map; + OpenAPI_list_add(served_smf_info_listList, localMapKeyPair); + } + } + cJSON *served_upf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUpfInfo"); OpenAPI_list_t *served_upf_infoList; @@ -643,6 +1004,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_upf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUpfInfoList"); + + OpenAPI_list_t *served_upf_info_listList; + if (served_upf_info_list) { + cJSON *served_upf_info_list_local_map; + if (!cJSON_IsObject(served_upf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_upf_info_list]"); + goto end; + } + served_upf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_upf_info_list_local_map, served_upf_info_list) { + cJSON *localMapObject = served_upf_info_list_local_map; + OpenAPI_list_add(served_upf_info_listList, localMapKeyPair); + } + } + cJSON *served_pcf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedPcfInfo"); OpenAPI_list_t *served_pcf_infoList; @@ -666,6 +1044,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_pcf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedPcfInfoList"); + + OpenAPI_list_t *served_pcf_info_listList; + if (served_pcf_info_list) { + cJSON *served_pcf_info_list_local_map; + if (!cJSON_IsObject(served_pcf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_pcf_info_list]"); + goto end; + } + served_pcf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_pcf_info_list_local_map, served_pcf_info_list) { + cJSON *localMapObject = served_pcf_info_list_local_map; + OpenAPI_list_add(served_pcf_info_listList, localMapKeyPair); + } + } + cJSON *served_bsf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedBsfInfo"); OpenAPI_list_t *served_bsf_infoList; @@ -689,6 +1084,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_bsf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedBsfInfoList"); + + OpenAPI_list_t *served_bsf_info_listList; + if (served_bsf_info_list) { + cJSON *served_bsf_info_list_local_map; + if (!cJSON_IsObject(served_bsf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_bsf_info_list]"); + goto end; + } + served_bsf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_bsf_info_list_local_map, served_bsf_info_list) { + cJSON *localMapObject = served_bsf_info_list_local_map; + OpenAPI_list_add(served_bsf_info_listList, localMapKeyPair); + } + } + cJSON *served_chf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedChfInfo"); OpenAPI_list_t *served_chf_infoList; @@ -712,6 +1124,23 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + cJSON *served_chf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedChfInfoList"); + + OpenAPI_list_t *served_chf_info_listList; + if (served_chf_info_list) { + cJSON *served_chf_info_list_local_map; + if (!cJSON_IsObject(served_chf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_chf_info_list]"); + goto end; + } + served_chf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_chf_info_list_local_map, served_chf_info_list) { + cJSON *localMapObject = served_chf_info_list_local_map; + OpenAPI_list_add(served_chf_info_listList, localMapKeyPair); + } + } + cJSON *served_nef_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedNefInfo"); OpenAPI_list_t *served_nef_infoList; @@ -758,26 +1187,20 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } - cJSON *served_pcscf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedPcscfInfo"); + cJSON *served_pcscf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedPcscfInfoList"); - OpenAPI_list_t *served_pcscf_infoList; - if (served_pcscf_info) { - cJSON *served_pcscf_info_local_map; - if (!cJSON_IsObject(served_pcscf_info)) { - ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_pcscf_info]"); + OpenAPI_list_t *served_pcscf_info_listList; + if (served_pcscf_info_list) { + cJSON *served_pcscf_info_list_local_map; + if (!cJSON_IsObject(served_pcscf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_pcscf_info_list]"); goto end; } - served_pcscf_infoList = OpenAPI_list_create(); + served_pcscf_info_listList = OpenAPI_list_create(); OpenAPI_map_t *localMapKeyPair = NULL; - cJSON_ArrayForEach(served_pcscf_info_local_map, served_pcscf_info) { - cJSON *localMapObject = served_pcscf_info_local_map; - if (!cJSON_IsObject(served_pcscf_info_local_map)) { - ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_pcscf_info]"); - goto end; - } - localMapKeyPair = OpenAPI_map_create( - localMapObject->string, OpenAPI_pcscf_info_parseFromJSON(localMapObject)); - OpenAPI_list_add(served_pcscf_infoList, localMapKeyPair); + cJSON_ArrayForEach(served_pcscf_info_list_local_map, served_pcscf_info_list) { + cJSON *localMapObject = served_pcscf_info_list_local_map; + OpenAPI_list_add(served_pcscf_info_listList, localMapKeyPair); } } @@ -850,46 +1273,115 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } - cJSON *served_hss_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedHssInfo"); + cJSON *served_hss_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedHssInfoList"); - OpenAPI_list_t *served_hss_infoList; - if (served_hss_info) { - cJSON *served_hss_info_local_map; - if (!cJSON_IsObject(served_hss_info)) { - ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_hss_info]"); + OpenAPI_list_t *served_hss_info_listList; + if (served_hss_info_list) { + cJSON *served_hss_info_list_local_map; + if (!cJSON_IsObject(served_hss_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_hss_info_list]"); goto end; } - served_hss_infoList = OpenAPI_list_create(); + served_hss_info_listList = OpenAPI_list_create(); OpenAPI_map_t *localMapKeyPair = NULL; - cJSON_ArrayForEach(served_hss_info_local_map, served_hss_info) { - cJSON *localMapObject = served_hss_info_local_map; - if (!cJSON_IsObject(served_hss_info_local_map)) { - ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_hss_info]"); + cJSON_ArrayForEach(served_hss_info_list_local_map, served_hss_info_list) { + cJSON *localMapObject = served_hss_info_list_local_map; + OpenAPI_list_add(served_hss_info_listList, localMapKeyPair); + } + } + + cJSON *served_udsf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdsfInfo"); + + OpenAPI_list_t *served_udsf_infoList; + if (served_udsf_info) { + cJSON *served_udsf_info_local_map; + if (!cJSON_IsObject(served_udsf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udsf_info]"); + goto end; + } + served_udsf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_udsf_info_local_map, served_udsf_info) { + cJSON *localMapObject = served_udsf_info_local_map; + if (!cJSON_IsObject(served_udsf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udsf_info]"); goto end; } localMapKeyPair = OpenAPI_map_create( - localMapObject->string, OpenAPI_hss_info_parseFromJSON(localMapObject)); - OpenAPI_list_add(served_hss_infoList, localMapKeyPair); + localMapObject->string, OpenAPI_udsf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_udsf_infoList, localMapKeyPair); + } + } + + cJSON *served_udsf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdsfInfoList"); + + OpenAPI_list_t *served_udsf_info_listList; + if (served_udsf_info_list) { + cJSON *served_udsf_info_list_local_map; + if (!cJSON_IsObject(served_udsf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udsf_info_list]"); + goto end; + } + served_udsf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_udsf_info_list_local_map, served_udsf_info_list) { + cJSON *localMapObject = served_udsf_info_list_local_map; + OpenAPI_list_add(served_udsf_info_listList, localMapKeyPair); + } + } + + cJSON *served_scp_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedScpInfoList"); + + OpenAPI_list_t *served_scp_info_listList; + if (served_scp_info_list) { + cJSON *served_scp_info_list_local_map; + if (!cJSON_IsObject(served_scp_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_scp_info_list]"); + goto end; + } + served_scp_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_scp_info_list_local_map, served_scp_info_list) { + cJSON *localMapObject = served_scp_info_list_local_map; + if (!cJSON_IsObject(served_scp_info_list_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_scp_info_list]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_scp_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_scp_info_listList, localMapKeyPair); } } nrf_info_local_var = OpenAPI_nrf_info_create ( served_udr_info ? served_udr_infoList : NULL, + served_udr_info_list ? served_udr_info_listList : NULL, served_udm_info ? served_udm_infoList : NULL, + served_udm_info_list ? served_udm_info_listList : NULL, served_ausf_info ? served_ausf_infoList : NULL, + served_ausf_info_list ? served_ausf_info_listList : NULL, served_amf_info ? served_amf_infoList : NULL, + served_amf_info_list ? served_amf_info_listList : NULL, served_smf_info ? served_smf_infoList : NULL, + served_smf_info_list ? served_smf_info_listList : NULL, served_upf_info ? served_upf_infoList : NULL, + served_upf_info_list ? served_upf_info_listList : NULL, served_pcf_info ? served_pcf_infoList : NULL, + served_pcf_info_list ? served_pcf_info_listList : NULL, served_bsf_info ? served_bsf_infoList : NULL, + served_bsf_info_list ? served_bsf_info_listList : NULL, served_chf_info ? served_chf_infoList : NULL, + served_chf_info_list ? served_chf_info_listList : NULL, served_nef_info ? served_nef_infoList : NULL, served_nwdaf_info ? served_nwdaf_infoList : NULL, - served_pcscf_info ? served_pcscf_infoList : NULL, + served_pcscf_info_list ? served_pcscf_info_listList : NULL, served_gmlc_info ? served_gmlc_infoList : NULL, served_lmf_info ? served_lmf_infoList : NULL, served_nf_info ? served_nf_infoList : NULL, - served_hss_info ? served_hss_infoList : NULL + served_hss_info_list ? served_hss_info_listList : NULL, + served_udsf_info ? served_udsf_infoList : NULL, + served_udsf_info_list ? served_udsf_info_listList : NULL, + served_scp_info_list ? served_scp_info_listList : NULL ); return nrf_info_local_var; diff --git a/lib/sbi/openapi/model/nrf_info.h b/lib/sbi/openapi/model/nrf_info.h index 576332a5c..aa78278d5 100644 --- a/lib/sbi/openapi/model/nrf_info.h +++ b/lib/sbi/openapi/model/nrf_info.h @@ -24,9 +24,11 @@ #include "nwdaf_info.h" #include "pcf_info.h" #include "pcscf_info.h" +#include "scp_info.h" #include "smf_info.h" #include "udm_info.h" #include "udr_info.h" +#include "udsf_info.h" #include "upf_info.h" #ifdef __cplusplus @@ -36,40 +38,64 @@ extern "C" { typedef struct OpenAPI_nrf_info_s OpenAPI_nrf_info_t; typedef struct OpenAPI_nrf_info_s { OpenAPI_list_t* served_udr_info; + OpenAPI_list_t* served_udr_info_list; OpenAPI_list_t* served_udm_info; + OpenAPI_list_t* served_udm_info_list; OpenAPI_list_t* served_ausf_info; + OpenAPI_list_t* served_ausf_info_list; OpenAPI_list_t* served_amf_info; + OpenAPI_list_t* served_amf_info_list; OpenAPI_list_t* served_smf_info; + OpenAPI_list_t* served_smf_info_list; OpenAPI_list_t* served_upf_info; + OpenAPI_list_t* served_upf_info_list; OpenAPI_list_t* served_pcf_info; + OpenAPI_list_t* served_pcf_info_list; OpenAPI_list_t* served_bsf_info; + OpenAPI_list_t* served_bsf_info_list; OpenAPI_list_t* served_chf_info; + OpenAPI_list_t* served_chf_info_list; OpenAPI_list_t* served_nef_info; OpenAPI_list_t* served_nwdaf_info; - OpenAPI_list_t* served_pcscf_info; + OpenAPI_list_t* served_pcscf_info_list; OpenAPI_list_t* served_gmlc_info; OpenAPI_list_t* served_lmf_info; OpenAPI_list_t* served_nf_info; - OpenAPI_list_t* served_hss_info; + OpenAPI_list_t* served_hss_info_list; + OpenAPI_list_t* served_udsf_info; + OpenAPI_list_t* served_udsf_info_list; + OpenAPI_list_t* served_scp_info_list; } OpenAPI_nrf_info_t; OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( OpenAPI_list_t* served_udr_info, + OpenAPI_list_t* served_udr_info_list, OpenAPI_list_t* served_udm_info, + OpenAPI_list_t* served_udm_info_list, OpenAPI_list_t* served_ausf_info, + OpenAPI_list_t* served_ausf_info_list, OpenAPI_list_t* served_amf_info, + OpenAPI_list_t* served_amf_info_list, OpenAPI_list_t* served_smf_info, + OpenAPI_list_t* served_smf_info_list, OpenAPI_list_t* served_upf_info, + OpenAPI_list_t* served_upf_info_list, OpenAPI_list_t* served_pcf_info, + OpenAPI_list_t* served_pcf_info_list, OpenAPI_list_t* served_bsf_info, + OpenAPI_list_t* served_bsf_info_list, OpenAPI_list_t* served_chf_info, + OpenAPI_list_t* served_chf_info_list, OpenAPI_list_t* served_nef_info, OpenAPI_list_t* served_nwdaf_info, - OpenAPI_list_t* served_pcscf_info, + OpenAPI_list_t* served_pcscf_info_list, OpenAPI_list_t* served_gmlc_info, OpenAPI_list_t* served_lmf_info, OpenAPI_list_t* served_nf_info, - OpenAPI_list_t* served_hss_info + OpenAPI_list_t* served_hss_info_list, + OpenAPI_list_t* served_udsf_info, + OpenAPI_list_t* served_udsf_info_list, + OpenAPI_list_t* served_scp_info_list ); void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info); OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON); diff --git a/lib/sbi/openapi/model/nwdaf_cond.c b/lib/sbi/openapi/model/nwdaf_cond.c new file mode 100644 index 000000000..d63f5c796 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_cond.c @@ -0,0 +1,128 @@ + +#include +#include +#include +#include "nwdaf_cond.h" + +OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_create( + OpenAPI_list_t *analytics_ids + ) +{ + OpenAPI_nwdaf_cond_t *nwdaf_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_nwdaf_cond_t)); + if (!nwdaf_cond_local_var) { + return NULL; + } + nwdaf_cond_local_var->analytics_ids = analytics_ids; + + return nwdaf_cond_local_var; +} + +void OpenAPI_nwdaf_cond_free(OpenAPI_nwdaf_cond_t *nwdaf_cond) +{ + if (NULL == nwdaf_cond) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(nwdaf_cond->analytics_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nwdaf_cond->analytics_ids); + ogs_free(nwdaf_cond); +} + +cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond) +{ + cJSON *item = NULL; + + if (nwdaf_cond == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [NwdafCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nwdaf_cond->analytics_ids) { + cJSON *analytics_ids = cJSON_AddArrayToObject(item, "analyticsIds"); + if (analytics_ids == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [analytics_ids]"); + goto end; + } + + OpenAPI_lnode_t *analytics_ids_node; + OpenAPI_list_for_each(nwdaf_cond->analytics_ids, analytics_ids_node) { + if (cJSON_AddStringToObject(analytics_ids, "", (char*)analytics_ids_node->data) == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [analytics_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_parseFromJSON(cJSON *nwdaf_condJSON) +{ + OpenAPI_nwdaf_cond_t *nwdaf_cond_local_var = NULL; + cJSON *analytics_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "analyticsIds"); + + OpenAPI_list_t *analytics_idsList; + if (analytics_ids) { + cJSON *analytics_ids_local; + if (!cJSON_IsArray(analytics_ids)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [analytics_ids]"); + goto end; + } + analytics_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(analytics_ids_local, analytics_ids) { + if (!cJSON_IsString(analytics_ids_local)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [analytics_ids]"); + goto end; + } + OpenAPI_list_add(analytics_idsList, ogs_strdup(analytics_ids_local->valuestring)); + } + } + + nwdaf_cond_local_var = OpenAPI_nwdaf_cond_create ( + analytics_ids ? analytics_idsList : NULL + ); + + return nwdaf_cond_local_var; +end: + return NULL; +} + +OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_copy(OpenAPI_nwdaf_cond_t *dst, OpenAPI_nwdaf_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_cond_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_nwdaf_cond_free(dst); + dst = OpenAPI_nwdaf_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_cond.h b/lib/sbi/openapi/model/nwdaf_cond.h new file mode 100644 index 000000000..108aca6fe --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_cond.h @@ -0,0 +1,38 @@ +/* + * nwdaf_cond.h + * + * Subscription to a set of NF Instances (NWDAFs), identified by Analytics ID(s). + */ + +#ifndef _OpenAPI_nwdaf_cond_H_ +#define _OpenAPI_nwdaf_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_cond_s OpenAPI_nwdaf_cond_t; +typedef struct OpenAPI_nwdaf_cond_s { + OpenAPI_list_t *analytics_ids; +} OpenAPI_nwdaf_cond_t; + +OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_create( + OpenAPI_list_t *analytics_ids + ); +void OpenAPI_nwdaf_cond_free(OpenAPI_nwdaf_cond_t *nwdaf_cond); +OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_parseFromJSON(cJSON *nwdaf_condJSON); +cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond); +OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_copy(OpenAPI_nwdaf_cond_t *dst, OpenAPI_nwdaf_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_cond_H_ */ + diff --git a/lib/sbi/openapi/model/odb_data.c b/lib/sbi/openapi/model/odb_data.c index e15aade8f..a5c098fa1 100644 --- a/lib/sbi/openapi/model/odb_data.c +++ b/lib/sbi/openapi/model/odb_data.c @@ -5,7 +5,7 @@ #include "odb_data.h" OpenAPI_odb_data_t *OpenAPI_odb_data_create( - OpenAPI_roaming_odb_t *roaming_odb + OpenAPI_roaming_odb_e roaming_odb ) { OpenAPI_odb_data_t *odb_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_odb_data_t)); @@ -23,7 +23,6 @@ void OpenAPI_odb_data_free(OpenAPI_odb_data_t *odb_data) return; } OpenAPI_lnode_t *node; - OpenAPI_roaming_odb_free(odb_data->roaming_odb); ogs_free(odb_data); } @@ -38,13 +37,7 @@ cJSON *OpenAPI_odb_data_convertToJSON(OpenAPI_odb_data_t *odb_data) item = cJSON_CreateObject(); if (odb_data->roaming_odb) { - cJSON *roaming_odb_local_JSON = OpenAPI_roaming_odb_convertToJSON(odb_data->roaming_odb); - if (roaming_odb_local_JSON == NULL) { - ogs_error("OpenAPI_odb_data_convertToJSON() failed [roaming_odb]"); - goto end; - } - cJSON_AddItemToObject(item, "roamingOdb", roaming_odb_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "roamingOdb", OpenAPI_roaming_odb_ToString(odb_data->roaming_odb)) == NULL) { ogs_error("OpenAPI_odb_data_convertToJSON() failed [roaming_odb]"); goto end; } @@ -59,13 +52,17 @@ OpenAPI_odb_data_t *OpenAPI_odb_data_parseFromJSON(cJSON *odb_dataJSON) OpenAPI_odb_data_t *odb_data_local_var = NULL; cJSON *roaming_odb = cJSON_GetObjectItemCaseSensitive(odb_dataJSON, "roamingOdb"); - OpenAPI_roaming_odb_t *roaming_odb_local_nonprim = NULL; + OpenAPI_roaming_odb_e roaming_odbVariable; if (roaming_odb) { - roaming_odb_local_nonprim = OpenAPI_roaming_odb_parseFromJSON(roaming_odb); + if (!cJSON_IsString(roaming_odb)) { + ogs_error("OpenAPI_odb_data_parseFromJSON() failed [roaming_odb]"); + goto end; + } + roaming_odbVariable = OpenAPI_roaming_odb_FromString(roaming_odb->valuestring); } odb_data_local_var = OpenAPI_odb_data_create ( - roaming_odb ? roaming_odb_local_nonprim : NULL + roaming_odb ? roaming_odbVariable : 0 ); return odb_data_local_var; diff --git a/lib/sbi/openapi/model/odb_data.h b/lib/sbi/openapi/model/odb_data.h index ef08acfd9..f3fe6e5c2 100644 --- a/lib/sbi/openapi/model/odb_data.h +++ b/lib/sbi/openapi/model/odb_data.h @@ -20,11 +20,11 @@ extern "C" { typedef struct OpenAPI_odb_data_s OpenAPI_odb_data_t; typedef struct OpenAPI_odb_data_s { - struct OpenAPI_roaming_odb_s *roaming_odb; + OpenAPI_roaming_odb_e roaming_odb; } OpenAPI_odb_data_t; OpenAPI_odb_data_t *OpenAPI_odb_data_create( - OpenAPI_roaming_odb_t *roaming_odb + OpenAPI_roaming_odb_e roaming_odb ); void OpenAPI_odb_data_free(OpenAPI_odb_data_t *odb_data); OpenAPI_odb_data_t *OpenAPI_odb_data_parseFromJSON(cJSON *odb_dataJSON); diff --git a/lib/sbi/openapi/model/odb_packet_services.c b/lib/sbi/openapi/model/odb_packet_services.c index dc17a9258..491f09364 100644 --- a/lib/sbi/openapi/model/odb_packet_services.c +++ b/lib/sbi/openapi/model/odb_packet_services.c @@ -4,82 +4,27 @@ #include #include "odb_packet_services.h" -OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_create( - ) +char* OpenAPI_odb_packet_services_ToString(OpenAPI_odb_packet_services_e odb_packet_services) { - OpenAPI_odb_packet_services_t *odb_packet_services_local_var = OpenAPI_malloc(sizeof(OpenAPI_odb_packet_services_t)); - if (!odb_packet_services_local_var) { - return NULL; - } - - return odb_packet_services_local_var; + const char *odb_packet_servicesArray[] = { "NULL", "ALL_PACKET_SERVICES", "ROAMER_ACCESS_HPLMN_AP", "ROAMER_ACCESS_VPLMN_AP" }; + size_t sizeofArray = sizeof(odb_packet_servicesArray) / sizeof(odb_packet_servicesArray[0]); + if (odb_packet_services < sizeofArray) + return (char *)odb_packet_servicesArray[odb_packet_services]; + else + return (char *)"Unknown"; } -void OpenAPI_odb_packet_services_free(OpenAPI_odb_packet_services_t *odb_packet_services) +OpenAPI_odb_packet_services_e OpenAPI_odb_packet_services_FromString(char* odb_packet_services) { - if (NULL == odb_packet_services) { - return; + int stringToReturn = 0; + const char *odb_packet_servicesArray[] = { "NULL", "ALL_PACKET_SERVICES", "ROAMER_ACCESS_HPLMN_AP", "ROAMER_ACCESS_VPLMN_AP" }; + size_t sizeofArray = sizeof(odb_packet_servicesArray) / sizeof(odb_packet_servicesArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(odb_packet_services, odb_packet_servicesArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(odb_packet_services); -} - -cJSON *OpenAPI_odb_packet_services_convertToJSON(OpenAPI_odb_packet_services_t *odb_packet_services) -{ - cJSON *item = NULL; - - if (odb_packet_services == NULL) { - ogs_error("OpenAPI_odb_packet_services_convertToJSON() failed [OdbPacketServices]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_parseFromJSON(cJSON *odb_packet_servicesJSON) -{ - OpenAPI_odb_packet_services_t *odb_packet_services_local_var = NULL; - odb_packet_services_local_var = OpenAPI_odb_packet_services_create ( - ); - - return odb_packet_services_local_var; -end: - return NULL; -} - -OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_copy(OpenAPI_odb_packet_services_t *dst, OpenAPI_odb_packet_services_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_odb_packet_services_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_odb_packet_services_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_odb_packet_services_free(dst); - dst = OpenAPI_odb_packet_services_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/odb_packet_services.h b/lib/sbi/openapi/model/odb_packet_services.h index 12a19e431..b2ef646ef 100644 --- a/lib/sbi/openapi/model/odb_packet_services.h +++ b/lib/sbi/openapi/model/odb_packet_services.h @@ -12,22 +12,16 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "null_value.h" #ifdef __cplusplus extern "C" { #endif -typedef struct OpenAPI_odb_packet_services_s OpenAPI_odb_packet_services_t; -typedef struct OpenAPI_odb_packet_services_s { -} OpenAPI_odb_packet_services_t; +typedef enum { OpenAPI_odb_packet_services_NULL = 0, OpenAPI_odb_packet_services_ALL_PACKET_SERVICES, OpenAPI_odb_packet_services_ROAMER_ACCESS_HPLMN_AP, OpenAPI_odb_packet_services_ROAMER_ACCESS_VPLMN_AP } OpenAPI_odb_packet_services_e; -OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_create( - ); -void OpenAPI_odb_packet_services_free(OpenAPI_odb_packet_services_t *odb_packet_services); -OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_parseFromJSON(cJSON *odb_packet_servicesJSON); -cJSON *OpenAPI_odb_packet_services_convertToJSON(OpenAPI_odb_packet_services_t *odb_packet_services); -OpenAPI_odb_packet_services_t *OpenAPI_odb_packet_services_copy(OpenAPI_odb_packet_services_t *dst, OpenAPI_odb_packet_services_t *src); +char* OpenAPI_odb_packet_services_ToString(OpenAPI_odb_packet_services_e odb_packet_services); + +OpenAPI_odb_packet_services_e OpenAPI_odb_packet_services_FromString(char* odb_packet_services); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/options_response.c b/lib/sbi/openapi/model/options_response.c new file mode 100644 index 000000000..4a625f48a --- /dev/null +++ b/lib/sbi/openapi/model/options_response.c @@ -0,0 +1,105 @@ + +#include +#include +#include +#include "options_response.h" + +OpenAPI_options_response_t *OpenAPI_options_response_create( + char *supported_features + ) +{ + OpenAPI_options_response_t *options_response_local_var = OpenAPI_malloc(sizeof(OpenAPI_options_response_t)); + if (!options_response_local_var) { + return NULL; + } + options_response_local_var->supported_features = supported_features; + + return options_response_local_var; +} + +void OpenAPI_options_response_free(OpenAPI_options_response_t *options_response) +{ + if (NULL == options_response) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(options_response->supported_features); + ogs_free(options_response); +} + +cJSON *OpenAPI_options_response_convertToJSON(OpenAPI_options_response_t *options_response) +{ + cJSON *item = NULL; + + if (options_response == NULL) { + ogs_error("OpenAPI_options_response_convertToJSON() failed [OptionsResponse]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (options_response->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", options_response->supported_features) == NULL) { + ogs_error("OpenAPI_options_response_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_options_response_t *OpenAPI_options_response_parseFromJSON(cJSON *options_responseJSON) +{ + OpenAPI_options_response_t *options_response_local_var = NULL; + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(options_responseJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_options_response_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + options_response_local_var = OpenAPI_options_response_create ( + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return options_response_local_var; +end: + return NULL; +} + +OpenAPI_options_response_t *OpenAPI_options_response_copy(OpenAPI_options_response_t *dst, OpenAPI_options_response_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_options_response_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_options_response_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_options_response_free(dst); + dst = OpenAPI_options_response_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/options_response.h b/lib/sbi/openapi/model/options_response.h new file mode 100644 index 000000000..cc752e375 --- /dev/null +++ b/lib/sbi/openapi/model/options_response.h @@ -0,0 +1,38 @@ +/* + * options_response.h + * + * Communication options of the NRF sent in response payload of OPTIONS method + */ + +#ifndef _OpenAPI_options_response_H_ +#define _OpenAPI_options_response_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_options_response_s OpenAPI_options_response_t; +typedef struct OpenAPI_options_response_s { + char *supported_features; +} OpenAPI_options_response_t; + +OpenAPI_options_response_t *OpenAPI_options_response_create( + char *supported_features + ); +void OpenAPI_options_response_free(OpenAPI_options_response_t *options_response); +OpenAPI_options_response_t *OpenAPI_options_response_parseFromJSON(cJSON *options_responseJSON); +cJSON *OpenAPI_options_response_convertToJSON(OpenAPI_options_response_t *options_response); +OpenAPI_options_response_t *OpenAPI_options_response_copy(OpenAPI_options_response_t *dst, OpenAPI_options_response_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_options_response_H_ */ + diff --git a/lib/sbi/openapi/model/pcscf_info.c b/lib/sbi/openapi/model/pcscf_info.c index ddb571798..f0c3d9715 100644 --- a/lib/sbi/openapi/model/pcscf_info.c +++ b/lib/sbi/openapi/model/pcscf_info.c @@ -6,7 +6,10 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_create( OpenAPI_list_t *access_type, - OpenAPI_list_t *dnn_list + OpenAPI_list_t *dnn_list, + char *gm_fqdn, + OpenAPI_list_t *gm_ipv4_addresses, + OpenAPI_list_t *gm_ipv6_addresses ) { OpenAPI_pcscf_info_t *pcscf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_pcscf_info_t)); @@ -15,6 +18,9 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_create( } pcscf_info_local_var->access_type = access_type; pcscf_info_local_var->dnn_list = dnn_list; + pcscf_info_local_var->gm_fqdn = gm_fqdn; + pcscf_info_local_var->gm_ipv4_addresses = gm_ipv4_addresses; + pcscf_info_local_var->gm_ipv6_addresses = gm_ipv6_addresses; return pcscf_info_local_var; } @@ -30,6 +36,15 @@ void OpenAPI_pcscf_info_free(OpenAPI_pcscf_info_t *pcscf_info) ogs_free(node->data); } OpenAPI_list_free(pcscf_info->dnn_list); + ogs_free(pcscf_info->gm_fqdn); + OpenAPI_list_for_each(pcscf_info->gm_ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcscf_info->gm_ipv4_addresses); + OpenAPI_list_for_each(pcscf_info->gm_ipv6_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcscf_info->gm_ipv6_addresses); ogs_free(pcscf_info); } @@ -74,6 +89,45 @@ cJSON *OpenAPI_pcscf_info_convertToJSON(OpenAPI_pcscf_info_t *pcscf_info) } } + if (pcscf_info->gm_fqdn) { + if (cJSON_AddStringToObject(item, "gmFqdn", pcscf_info->gm_fqdn) == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [gm_fqdn]"); + goto end; + } + } + + if (pcscf_info->gm_ipv4_addresses) { + cJSON *gm_ipv4_addresses = cJSON_AddArrayToObject(item, "gmIpv4Addresses"); + if (gm_ipv4_addresses == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [gm_ipv4_addresses]"); + goto end; + } + + OpenAPI_lnode_t *gm_ipv4_addresses_node; + OpenAPI_list_for_each(pcscf_info->gm_ipv4_addresses, gm_ipv4_addresses_node) { + if (cJSON_AddStringToObject(gm_ipv4_addresses, "", (char*)gm_ipv4_addresses_node->data) == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [gm_ipv4_addresses]"); + goto end; + } + } + } + + if (pcscf_info->gm_ipv6_addresses) { + cJSON *gm_ipv6_addresses = cJSON_AddArrayToObject(item, "gmIpv6Addresses"); + if (gm_ipv6_addresses == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [gm_ipv6_addresses]"); + goto end; + } + + OpenAPI_lnode_t *gm_ipv6_addresses_node; + OpenAPI_list_for_each(pcscf_info->gm_ipv6_addresses, gm_ipv6_addresses_node) { + if (cJSON_AddStringToObject(gm_ipv6_addresses, "", (char*)gm_ipv6_addresses_node->data) == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [gm_ipv6_addresses]"); + goto end; + } + } + } + end: return item; } @@ -123,9 +177,61 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_parseFromJSON(cJSON *pcscf_infoJSON) } } + cJSON *gm_fqdn = cJSON_GetObjectItemCaseSensitive(pcscf_infoJSON, "gmFqdn"); + + if (gm_fqdn) { + if (!cJSON_IsString(gm_fqdn)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [gm_fqdn]"); + goto end; + } + } + + cJSON *gm_ipv4_addresses = cJSON_GetObjectItemCaseSensitive(pcscf_infoJSON, "gmIpv4Addresses"); + + OpenAPI_list_t *gm_ipv4_addressesList; + if (gm_ipv4_addresses) { + cJSON *gm_ipv4_addresses_local; + if (!cJSON_IsArray(gm_ipv4_addresses)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [gm_ipv4_addresses]"); + goto end; + } + gm_ipv4_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gm_ipv4_addresses_local, gm_ipv4_addresses) { + if (!cJSON_IsString(gm_ipv4_addresses_local)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [gm_ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(gm_ipv4_addressesList, ogs_strdup(gm_ipv4_addresses_local->valuestring)); + } + } + + cJSON *gm_ipv6_addresses = cJSON_GetObjectItemCaseSensitive(pcscf_infoJSON, "gmIpv6Addresses"); + + OpenAPI_list_t *gm_ipv6_addressesList; + if (gm_ipv6_addresses) { + cJSON *gm_ipv6_addresses_local; + if (!cJSON_IsArray(gm_ipv6_addresses)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [gm_ipv6_addresses]"); + goto end; + } + gm_ipv6_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gm_ipv6_addresses_local, gm_ipv6_addresses) { + if (!cJSON_IsString(gm_ipv6_addresses_local)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [gm_ipv6_addresses]"); + goto end; + } + OpenAPI_list_add(gm_ipv6_addressesList, ogs_strdup(gm_ipv6_addresses_local->valuestring)); + } + } + pcscf_info_local_var = OpenAPI_pcscf_info_create ( access_type ? access_typeList : NULL, - dnn_list ? dnn_listList : NULL + dnn_list ? dnn_listList : NULL, + gm_fqdn ? ogs_strdup(gm_fqdn->valuestring) : NULL, + gm_ipv4_addresses ? gm_ipv4_addressesList : NULL, + gm_ipv6_addresses ? gm_ipv6_addressesList : NULL ); return pcscf_info_local_var; diff --git a/lib/sbi/openapi/model/pcscf_info.h b/lib/sbi/openapi/model/pcscf_info.h index 309671178..dfd4dcf9f 100644 --- a/lib/sbi/openapi/model/pcscf_info.h +++ b/lib/sbi/openapi/model/pcscf_info.h @@ -22,11 +22,17 @@ typedef struct OpenAPI_pcscf_info_s OpenAPI_pcscf_info_t; typedef struct OpenAPI_pcscf_info_s { OpenAPI_list_t *access_type; OpenAPI_list_t *dnn_list; + char *gm_fqdn; + OpenAPI_list_t *gm_ipv4_addresses; + OpenAPI_list_t *gm_ipv6_addresses; } OpenAPI_pcscf_info_t; OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_create( OpenAPI_list_t *access_type, - OpenAPI_list_t *dnn_list + OpenAPI_list_t *dnn_list, + char *gm_fqdn, + OpenAPI_list_t *gm_ipv4_addresses, + OpenAPI_list_t *gm_ipv6_addresses ); void OpenAPI_pcscf_info_free(OpenAPI_pcscf_info_t *pcscf_info); OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_parseFromJSON(cJSON *pcscf_infoJSON); diff --git a/lib/sbi/openapi/model/pdu_session.c b/lib/sbi/openapi/model/pdu_session.c index 24d0eddd5..0dd300802 100644 --- a/lib/sbi/openapi/model/pdu_session.c +++ b/lib/sbi/openapi/model/pdu_session.c @@ -7,7 +7,8 @@ OpenAPI_pdu_session_t *OpenAPI_pdu_session_create( char *dnn, char *smf_instance_id, - OpenAPI_plmn_id_t *plmn_id + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_snssai_t *single_nssai ) { OpenAPI_pdu_session_t *pdu_session_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_t)); @@ -17,6 +18,7 @@ OpenAPI_pdu_session_t *OpenAPI_pdu_session_create( pdu_session_local_var->dnn = dnn; pdu_session_local_var->smf_instance_id = smf_instance_id; pdu_session_local_var->plmn_id = plmn_id; + pdu_session_local_var->single_nssai = single_nssai; return pdu_session_local_var; } @@ -30,6 +32,7 @@ void OpenAPI_pdu_session_free(OpenAPI_pdu_session_t *pdu_session) ogs_free(pdu_session->dnn); ogs_free(pdu_session->smf_instance_id); OpenAPI_plmn_id_free(pdu_session->plmn_id); + OpenAPI_snssai_free(pdu_session->single_nssai); ogs_free(pdu_session); } @@ -76,6 +79,19 @@ cJSON *OpenAPI_pdu_session_convertToJSON(OpenAPI_pdu_session_t *pdu_session) goto end; } + if (pdu_session->single_nssai) { + cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session->single_nssai); + if (single_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_convertToJSON() failed [single_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "singleNssai", single_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_convertToJSON() failed [single_nssai]"); + goto end; + } + } + end: return item; } @@ -117,10 +133,18 @@ OpenAPI_pdu_session_t *OpenAPI_pdu_session_parseFromJSON(cJSON *pdu_sessionJSON) plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + cJSON *single_nssai = cJSON_GetObjectItemCaseSensitive(pdu_sessionJSON, "singleNssai"); + + OpenAPI_snssai_t *single_nssai_local_nonprim = NULL; + if (single_nssai) { + single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai); + } + pdu_session_local_var = OpenAPI_pdu_session_create ( ogs_strdup(dnn->valuestring), ogs_strdup(smf_instance_id->valuestring), - plmn_id_local_nonprim + plmn_id_local_nonprim, + single_nssai ? single_nssai_local_nonprim : NULL ); return pdu_session_local_var; diff --git a/lib/sbi/openapi/model/pdu_session.h b/lib/sbi/openapi/model/pdu_session.h index f9e7b13b0..742fe1555 100644 --- a/lib/sbi/openapi/model/pdu_session.h +++ b/lib/sbi/openapi/model/pdu_session.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "plmn_id.h" +#include "snssai.h" #ifdef __cplusplus extern "C" { @@ -23,12 +24,14 @@ typedef struct OpenAPI_pdu_session_s { char *dnn; char *smf_instance_id; struct OpenAPI_plmn_id_s *plmn_id; + struct OpenAPI_snssai_s *single_nssai; } OpenAPI_pdu_session_t; OpenAPI_pdu_session_t *OpenAPI_pdu_session_create( char *dnn, char *smf_instance_id, - OpenAPI_plmn_id_t *plmn_id + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_snssai_t *single_nssai ); void OpenAPI_pdu_session_free(OpenAPI_pdu_session_t *pdu_session); OpenAPI_pdu_session_t *OpenAPI_pdu_session_parseFromJSON(cJSON *pdu_sessionJSON); diff --git a/lib/sbi/openapi/model/pdu_session_create_data.c b/lib/sbi/openapi/model/pdu_session_create_data.c index 17bc96a60..e161dd512 100644 --- a/lib/sbi/openapi/model/pdu_session_create_data.c +++ b/lib/sbi/openapi/model/pdu_session_create_data.c @@ -10,6 +10,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( char *pei, int pdu_session_id, char *dnn, + char *selected_dnn, OpenAPI_snssai_t *s_nssai, char *vsmf_id, char *ismf_id, @@ -52,6 +53,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( char *eps_bearer_ctx_status, char *amf_nf_id, OpenAPI_guami_t *guami, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, int cp_ciot_enabled, int cp_only_ind, int invoke_nef, @@ -62,7 +65,9 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( OpenAPI_list_t *secondary_rat_usage_info, OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, - int dl_serving_plmn_rate_ctl + int dl_serving_plmn_rate_ctl, + OpenAPI_up_security_info_t *up_security_info, + OpenAPI_vplmn_qos_t *vplmn_qos ) { OpenAPI_pdu_session_create_data_t *pdu_session_create_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_create_data_t)); @@ -74,6 +79,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( pdu_session_create_data_local_var->pei = pei; pdu_session_create_data_local_var->pdu_session_id = pdu_session_id; pdu_session_create_data_local_var->dnn = dnn; + pdu_session_create_data_local_var->selected_dnn = selected_dnn; pdu_session_create_data_local_var->s_nssai = s_nssai; pdu_session_create_data_local_var->vsmf_id = vsmf_id; pdu_session_create_data_local_var->ismf_id = ismf_id; @@ -116,6 +122,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( pdu_session_create_data_local_var->eps_bearer_ctx_status = eps_bearer_ctx_status; pdu_session_create_data_local_var->amf_nf_id = amf_nf_id; pdu_session_create_data_local_var->guami = guami; + pdu_session_create_data_local_var->max_integrity_protected_data_rate_ul = max_integrity_protected_data_rate_ul; + pdu_session_create_data_local_var->max_integrity_protected_data_rate_dl = max_integrity_protected_data_rate_dl; pdu_session_create_data_local_var->cp_ciot_enabled = cp_ciot_enabled; pdu_session_create_data_local_var->cp_only_ind = cp_only_ind; pdu_session_create_data_local_var->invoke_nef = invoke_nef; @@ -127,6 +135,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( pdu_session_create_data_local_var->small_data_rate_status = small_data_rate_status; pdu_session_create_data_local_var->apn_rate_status = apn_rate_status; pdu_session_create_data_local_var->dl_serving_plmn_rate_ctl = dl_serving_plmn_rate_ctl; + pdu_session_create_data_local_var->up_security_info = up_security_info; + pdu_session_create_data_local_var->vplmn_qos = vplmn_qos; return pdu_session_create_data_local_var; } @@ -140,6 +150,7 @@ void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu ogs_free(pdu_session_create_data->supi); ogs_free(pdu_session_create_data->pei); ogs_free(pdu_session_create_data->dnn); + ogs_free(pdu_session_create_data->selected_dnn); OpenAPI_snssai_free(pdu_session_create_data->s_nssai); ogs_free(pdu_session_create_data->vsmf_id); ogs_free(pdu_session_create_data->ismf_id); @@ -185,6 +196,8 @@ void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu OpenAPI_list_free(pdu_session_create_data->secondary_rat_usage_info); OpenAPI_small_data_rate_status_free(pdu_session_create_data->small_data_rate_status); OpenAPI_apn_rate_status_free(pdu_session_create_data->apn_rate_status); + OpenAPI_up_security_info_free(pdu_session_create_data->up_security_info); + OpenAPI_vplmn_qos_free(pdu_session_create_data->vplmn_qos); ogs_free(pdu_session_create_data); } @@ -235,6 +248,13 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_ goto end; } + if (pdu_session_create_data->selected_dnn) { + if (cJSON_AddStringToObject(item, "selectedDnn", pdu_session_create_data->selected_dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [selected_dnn]"); + goto end; + } + } + if (pdu_session_create_data->s_nssai) { cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_create_data->s_nssai); if (s_nssai_local_JSON == NULL) { @@ -614,6 +634,20 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_ } } + if (pdu_session_create_data->max_integrity_protected_data_rate_ul) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateUl", OpenAPI_max_integrity_protected_data_rate_ToString(pdu_session_create_data->max_integrity_protected_data_rate_ul)) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + } + + if (pdu_session_create_data->max_integrity_protected_data_rate_dl) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateDl", OpenAPI_max_integrity_protected_data_rate_ToString(pdu_session_create_data->max_integrity_protected_data_rate_dl)) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + } + if (pdu_session_create_data->cp_ciot_enabled) { if (cJSON_AddBoolToObject(item, "cpCiotEnabled", pdu_session_create_data->cp_ciot_enabled) == NULL) { ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [cp_ciot_enabled]"); @@ -725,6 +759,32 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_ } } + if (pdu_session_create_data->up_security_info) { + cJSON *up_security_info_local_JSON = OpenAPI_up_security_info_convertToJSON(pdu_session_create_data->up_security_info); + if (up_security_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [up_security_info]"); + goto end; + } + cJSON_AddItemToObject(item, "upSecurityInfo", up_security_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [up_security_info]"); + goto end; + } + } + + if (pdu_session_create_data->vplmn_qos) { + cJSON *vplmn_qos_local_JSON = OpenAPI_vplmn_qos_convertToJSON(pdu_session_create_data->vplmn_qos); + if (vplmn_qos_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [vplmn_qos]"); + goto end; + } + cJSON_AddItemToObject(item, "vplmnQos", vplmn_qos_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [vplmn_qos]"); + goto end; + } + } + end: return item; } @@ -780,6 +840,15 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON goto end; } + cJSON *selected_dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "selectedDnn"); + + if (selected_dnn) { + if (!cJSON_IsString(selected_dnn)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [selected_dnn]"); + goto end; + } + } + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "sNssai"); OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; @@ -1163,6 +1232,28 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); } + cJSON *max_integrity_protected_data_rate_ul = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "maxIntegrityProtectedDataRateUl"); + + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ulVariable; + if (max_integrity_protected_data_rate_ul) { + if (!cJSON_IsString(max_integrity_protected_data_rate_ul)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + max_integrity_protected_data_rate_ulVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_ul->valuestring); + } + + cJSON *max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "maxIntegrityProtectedDataRateDl"); + + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable; + if (max_integrity_protected_data_rate_dl) { + if (!cJSON_IsString(max_integrity_protected_data_rate_dl)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + max_integrity_protected_data_rate_dlVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_dl->valuestring); + } + cJSON *cp_ciot_enabled = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "cpCiotEnabled"); if (cp_ciot_enabled) { @@ -1285,12 +1376,27 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON } } + cJSON *up_security_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "upSecurityInfo"); + + OpenAPI_up_security_info_t *up_security_info_local_nonprim = NULL; + if (up_security_info) { + up_security_info_local_nonprim = OpenAPI_up_security_info_parseFromJSON(up_security_info); + } + + cJSON *vplmn_qos = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "vplmnQos"); + + OpenAPI_vplmn_qos_t *vplmn_qos_local_nonprim = NULL; + if (vplmn_qos) { + vplmn_qos_local_nonprim = OpenAPI_vplmn_qos_parseFromJSON(vplmn_qos); + } + pdu_session_create_data_local_var = OpenAPI_pdu_session_create_data_create ( supi ? ogs_strdup(supi->valuestring) : NULL, unauthenticated_supi ? unauthenticated_supi->valueint : 0, pei ? ogs_strdup(pei->valuestring) : NULL, pdu_session_id ? pdu_session_id->valuedouble : 0, ogs_strdup(dnn->valuestring), + selected_dnn ? ogs_strdup(selected_dnn->valuestring) : NULL, s_nssai ? s_nssai_local_nonprim : NULL, vsmf_id ? ogs_strdup(vsmf_id->valuestring) : NULL, ismf_id ? ogs_strdup(ismf_id->valuestring) : NULL, @@ -1333,6 +1439,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON eps_bearer_ctx_status ? ogs_strdup(eps_bearer_ctx_status->valuestring) : NULL, amf_nf_id ? ogs_strdup(amf_nf_id->valuestring) : NULL, guami ? guami_local_nonprim : NULL, + max_integrity_protected_data_rate_ul ? max_integrity_protected_data_rate_ulVariable : 0, + max_integrity_protected_data_rate_dl ? max_integrity_protected_data_rate_dlVariable : 0, cp_ciot_enabled ? cp_ciot_enabled->valueint : 0, cp_only_ind ? cp_only_ind->valueint : 0, invoke_nef ? invoke_nef->valueint : 0, @@ -1343,7 +1451,9 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL, small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, apn_rate_status ? apn_rate_status_local_nonprim : NULL, - dl_serving_plmn_rate_ctl ? dl_serving_plmn_rate_ctl->valuedouble : 0 + dl_serving_plmn_rate_ctl ? dl_serving_plmn_rate_ctl->valuedouble : 0, + up_security_info ? up_security_info_local_nonprim : NULL, + vplmn_qos ? vplmn_qos_local_nonprim : NULL ); return pdu_session_create_data_local_var; diff --git a/lib/sbi/openapi/model/pdu_session_create_data.h b/lib/sbi/openapi/model/pdu_session_create_data.h index 0130a2f6e..a88058127 100644 --- a/lib/sbi/openapi/model/pdu_session_create_data.h +++ b/lib/sbi/openapi/model/pdu_session_create_data.h @@ -17,6 +17,7 @@ #include "dnn_selection_mode.h" #include "eps_interworking_indication.h" #include "guami.h" +#include "max_integrity_protected_data_rate.h" #include "plmn_id_nid.h" #include "presence_state.h" #include "rat_type.h" @@ -27,7 +28,9 @@ #include "small_data_rate_status.h" #include "snssai.h" #include "tunnel_info.h" +#include "up_security_info.h" #include "user_location.h" +#include "vplmn_qos.h" #ifdef __cplusplus extern "C" { @@ -40,6 +43,7 @@ typedef struct OpenAPI_pdu_session_create_data_s { char *pei; int pdu_session_id; char *dnn; + char *selected_dnn; struct OpenAPI_snssai_s *s_nssai; char *vsmf_id; char *ismf_id; @@ -82,6 +86,8 @@ typedef struct OpenAPI_pdu_session_create_data_s { char *eps_bearer_ctx_status; char *amf_nf_id; struct OpenAPI_guami_s *guami; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl; int cp_ciot_enabled; int cp_only_ind; int invoke_nef; @@ -93,6 +99,8 @@ typedef struct OpenAPI_pdu_session_create_data_s { struct OpenAPI_small_data_rate_status_s *small_data_rate_status; struct OpenAPI_apn_rate_status_s *apn_rate_status; int dl_serving_plmn_rate_ctl; + struct OpenAPI_up_security_info_s *up_security_info; + struct OpenAPI_vplmn_qos_s *vplmn_qos; } OpenAPI_pdu_session_create_data_t; OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( @@ -101,6 +109,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( char *pei, int pdu_session_id, char *dnn, + char *selected_dnn, OpenAPI_snssai_t *s_nssai, char *vsmf_id, char *ismf_id, @@ -143,6 +152,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( char *eps_bearer_ctx_status, char *amf_nf_id, OpenAPI_guami_t *guami, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, int cp_ciot_enabled, int cp_only_ind, int invoke_nef, @@ -153,7 +164,9 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( OpenAPI_list_t *secondary_rat_usage_info, OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, - int dl_serving_plmn_rate_ctl + int dl_serving_plmn_rate_ctl, + OpenAPI_up_security_info_t *up_security_info, + OpenAPI_vplmn_qos_t *vplmn_qos ); void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu_session_create_data); OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON(cJSON *pdu_session_create_dataJSON); diff --git a/lib/sbi/openapi/model/pdu_session_created_data.c b/lib/sbi/openapi/model/pdu_session_created_data.c index 44f3cba49..eb7d89045 100644 --- a/lib/sbi/openapi/model/pdu_session_created_data.c +++ b/lib/sbi/openapi/model/pdu_session_created_data.c @@ -24,6 +24,7 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( OpenAPI_list_t *eps_bearer_info, char *supported_features, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, int always_on_granted, char *gpsi, OpenAPI_up_security_t *up_security, @@ -35,7 +36,11 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( int ipv6_multi_homing_ind, int ma_accepted_ind, char *home_provided_charging_id, - int nef_ext_buf_support_ind + int nef_ext_buf_support_ind, + int small_data_rate_control_enabled, + char *ue_ipv6_interface_id, + int ipv6_index, + OpenAPI_ip_address_t *dn_aaa_address ) { OpenAPI_pdu_session_created_data_t *pdu_session_created_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_created_data_t)); @@ -61,6 +66,7 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( pdu_session_created_data_local_var->eps_bearer_info = eps_bearer_info; pdu_session_created_data_local_var->supported_features = supported_features; pdu_session_created_data_local_var->max_integrity_protected_data_rate = max_integrity_protected_data_rate; + pdu_session_created_data_local_var->max_integrity_protected_data_rate_dl = max_integrity_protected_data_rate_dl; pdu_session_created_data_local_var->always_on_granted = always_on_granted; pdu_session_created_data_local_var->gpsi = gpsi; pdu_session_created_data_local_var->up_security = up_security; @@ -73,6 +79,10 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( pdu_session_created_data_local_var->ma_accepted_ind = ma_accepted_ind; pdu_session_created_data_local_var->home_provided_charging_id = home_provided_charging_id; pdu_session_created_data_local_var->nef_ext_buf_support_ind = nef_ext_buf_support_ind; + pdu_session_created_data_local_var->small_data_rate_control_enabled = small_data_rate_control_enabled; + pdu_session_created_data_local_var->ue_ipv6_interface_id = ue_ipv6_interface_id; + pdu_session_created_data_local_var->ipv6_index = ipv6_index; + pdu_session_created_data_local_var->dn_aaa_address = dn_aaa_address; return pdu_session_created_data_local_var; } @@ -115,6 +125,8 @@ void OpenAPI_pdu_session_created_data_free(OpenAPI_pdu_session_created_data_t *p } OpenAPI_list_free(pdu_session_created_data->dnai_list); ogs_free(pdu_session_created_data->home_provided_charging_id); + ogs_free(pdu_session_created_data->ue_ipv6_interface_id); + OpenAPI_ip_address_free(pdu_session_created_data->dn_aaa_address); ogs_free(pdu_session_created_data); } @@ -333,6 +345,13 @@ cJSON *OpenAPI_pdu_session_created_data_convertToJSON(OpenAPI_pdu_session_create } } + if (pdu_session_created_data->max_integrity_protected_data_rate_dl) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateDl", OpenAPI_max_integrity_protected_data_rate_ToString(pdu_session_created_data->max_integrity_protected_data_rate_dl)) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + } + if (pdu_session_created_data->always_on_granted) { if (cJSON_AddBoolToObject(item, "alwaysOnGranted", pdu_session_created_data->always_on_granted) == NULL) { ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [always_on_granted]"); @@ -438,6 +457,40 @@ cJSON *OpenAPI_pdu_session_created_data_convertToJSON(OpenAPI_pdu_session_create } } + if (pdu_session_created_data->small_data_rate_control_enabled) { + if (cJSON_AddBoolToObject(item, "smallDataRateControlEnabled", pdu_session_created_data->small_data_rate_control_enabled) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [small_data_rate_control_enabled]"); + goto end; + } + } + + if (pdu_session_created_data->ue_ipv6_interface_id) { + if (cJSON_AddStringToObject(item, "ueIpv6InterfaceId", pdu_session_created_data->ue_ipv6_interface_id) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ue_ipv6_interface_id]"); + goto end; + } + } + + if (pdu_session_created_data->ipv6_index) { + if (cJSON_AddNumberToObject(item, "ipv6Index", pdu_session_created_data->ipv6_index) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [ipv6_index]"); + goto end; + } + } + + if (pdu_session_created_data->dn_aaa_address) { + cJSON *dn_aaa_address_local_JSON = OpenAPI_ip_address_convertToJSON(pdu_session_created_data->dn_aaa_address); + if (dn_aaa_address_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + cJSON_AddItemToObject(item, "dnAaaAddress", dn_aaa_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + } + end: return item; } @@ -640,6 +693,17 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJS max_integrity_protected_data_rateVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate->valuestring); } + cJSON *max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "maxIntegrityProtectedDataRateDl"); + + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable; + if (max_integrity_protected_data_rate_dl) { + if (!cJSON_IsString(max_integrity_protected_data_rate_dl)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + max_integrity_protected_data_rate_dlVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_dl->valuestring); + } + cJSON *always_on_granted = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "alwaysOnGranted"); if (always_on_granted) { @@ -755,6 +819,40 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJS } } + cJSON *small_data_rate_control_enabled = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "smallDataRateControlEnabled"); + + if (small_data_rate_control_enabled) { + if (!cJSON_IsBool(small_data_rate_control_enabled)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [small_data_rate_control_enabled]"); + goto end; + } + } + + cJSON *ue_ipv6_interface_id = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "ueIpv6InterfaceId"); + + if (ue_ipv6_interface_id) { + if (!cJSON_IsString(ue_ipv6_interface_id)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ue_ipv6_interface_id]"); + goto end; + } + } + + cJSON *ipv6_index = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "ipv6Index"); + + if (ipv6_index) { + if (!cJSON_IsNumber(ipv6_index)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [ipv6_index]"); + goto end; + } + } + + cJSON *dn_aaa_address = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "dnAaaAddress"); + + OpenAPI_ip_address_t *dn_aaa_address_local_nonprim = NULL; + if (dn_aaa_address) { + dn_aaa_address_local_nonprim = OpenAPI_ip_address_parseFromJSON(dn_aaa_address); + } + pdu_session_created_data_local_var = OpenAPI_pdu_session_created_data_create ( pdu_session_typeVariable, ogs_strdup(ssc_mode->valuestring), @@ -775,6 +873,7 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJS eps_bearer_info ? eps_bearer_infoList : NULL, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, max_integrity_protected_data_rate ? max_integrity_protected_data_rateVariable : 0, + max_integrity_protected_data_rate_dl ? max_integrity_protected_data_rate_dlVariable : 0, always_on_granted ? always_on_granted->valueint : 0, gpsi ? ogs_strdup(gpsi->valuestring) : NULL, up_security ? up_security_local_nonprim : NULL, @@ -786,7 +885,11 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJS ipv6_multi_homing_ind ? ipv6_multi_homing_ind->valueint : 0, ma_accepted_ind ? ma_accepted_ind->valueint : 0, home_provided_charging_id ? ogs_strdup(home_provided_charging_id->valuestring) : NULL, - nef_ext_buf_support_ind ? nef_ext_buf_support_ind->valueint : 0 + nef_ext_buf_support_ind ? nef_ext_buf_support_ind->valueint : 0, + small_data_rate_control_enabled ? small_data_rate_control_enabled->valueint : 0, + ue_ipv6_interface_id ? ogs_strdup(ue_ipv6_interface_id->valuestring) : NULL, + ipv6_index ? ipv6_index->valuedouble : 0, + dn_aaa_address ? dn_aaa_address_local_nonprim : NULL ); return pdu_session_created_data_local_var; diff --git a/lib/sbi/openapi/model/pdu_session_created_data.h b/lib/sbi/openapi/model/pdu_session_created_data.h index 9dd557a25..8dd02fcac 100644 --- a/lib/sbi/openapi/model/pdu_session_created_data.h +++ b/lib/sbi/openapi/model/pdu_session_created_data.h @@ -15,6 +15,7 @@ #include "ambr.h" #include "eps_bearer_info.h" #include "eps_pdn_cnx_info.h" +#include "ip_address.h" #include "max_integrity_protected_data_rate.h" #include "pdu_session_type.h" #include "qos_flow_setup_item.h" @@ -49,6 +50,7 @@ typedef struct OpenAPI_pdu_session_created_data_s { OpenAPI_list_t *eps_bearer_info; char *supported_features; OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl; int always_on_granted; char *gpsi; struct OpenAPI_up_security_s *up_security; @@ -61,6 +63,10 @@ typedef struct OpenAPI_pdu_session_created_data_s { int ma_accepted_ind; char *home_provided_charging_id; int nef_ext_buf_support_ind; + int small_data_rate_control_enabled; + char *ue_ipv6_interface_id; + int ipv6_index; + struct OpenAPI_ip_address_s *dn_aaa_address; } OpenAPI_pdu_session_created_data_t; OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( @@ -83,6 +89,7 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( OpenAPI_list_t *eps_bearer_info, char *supported_features, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, int always_on_granted, char *gpsi, OpenAPI_up_security_t *up_security, @@ -94,7 +101,11 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( int ipv6_multi_homing_ind, int ma_accepted_ind, char *home_provided_charging_id, - int nef_ext_buf_support_ind + int nef_ext_buf_support_ind, + int small_data_rate_control_enabled, + char *ue_ipv6_interface_id, + int ipv6_index, + OpenAPI_ip_address_t *dn_aaa_address ); void OpenAPI_pdu_session_created_data_free(OpenAPI_pdu_session_created_data_t *pdu_session_created_data); OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJSON(cJSON *pdu_session_created_dataJSON); diff --git a/lib/sbi/openapi/model/pdu_session_status_cfg.c b/lib/sbi/openapi/model/pdu_session_status_cfg.c new file mode 100644 index 000000000..9d17f92de --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_status_cfg.c @@ -0,0 +1,105 @@ + +#include +#include +#include +#include "pdu_session_status_cfg.h" + +OpenAPI_pdu_session_status_cfg_t *OpenAPI_pdu_session_status_cfg_create( + char *dnn + ) +{ + OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_status_cfg_t)); + if (!pdu_session_status_cfg_local_var) { + return NULL; + } + pdu_session_status_cfg_local_var->dnn = dnn; + + return pdu_session_status_cfg_local_var; +} + +void OpenAPI_pdu_session_status_cfg_free(OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg) +{ + if (NULL == pdu_session_status_cfg) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(pdu_session_status_cfg->dnn); + ogs_free(pdu_session_status_cfg); +} + +cJSON *OpenAPI_pdu_session_status_cfg_convertToJSON(OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg) +{ + cJSON *item = NULL; + + if (pdu_session_status_cfg == NULL) { + ogs_error("OpenAPI_pdu_session_status_cfg_convertToJSON() failed [PduSessionStatusCfg]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pdu_session_status_cfg->dnn) { + if (cJSON_AddStringToObject(item, "dnn", pdu_session_status_cfg->dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_status_cfg_convertToJSON() failed [dnn]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pdu_session_status_cfg_t *OpenAPI_pdu_session_status_cfg_parseFromJSON(cJSON *pdu_session_status_cfgJSON) +{ + OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg_local_var = NULL; + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_status_cfgJSON, "dnn"); + + if (dnn) { + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_pdu_session_status_cfg_parseFromJSON() failed [dnn]"); + goto end; + } + } + + pdu_session_status_cfg_local_var = OpenAPI_pdu_session_status_cfg_create ( + dnn ? ogs_strdup(dnn->valuestring) : NULL + ); + + return pdu_session_status_cfg_local_var; +end: + return NULL; +} + +OpenAPI_pdu_session_status_cfg_t *OpenAPI_pdu_session_status_cfg_copy(OpenAPI_pdu_session_status_cfg_t *dst, OpenAPI_pdu_session_status_cfg_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_status_cfg_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_status_cfg_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_pdu_session_status_cfg_free(dst); + dst = OpenAPI_pdu_session_status_cfg_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_status_cfg.h b/lib/sbi/openapi/model/pdu_session_status_cfg.h new file mode 100644 index 000000000..3eb0ef8a7 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_status_cfg.h @@ -0,0 +1,38 @@ +/* + * pdu_session_status_cfg.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_status_cfg_H_ +#define _OpenAPI_pdu_session_status_cfg_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_status_cfg_s OpenAPI_pdu_session_status_cfg_t; +typedef struct OpenAPI_pdu_session_status_cfg_s { + char *dnn; +} OpenAPI_pdu_session_status_cfg_t; + +OpenAPI_pdu_session_status_cfg_t *OpenAPI_pdu_session_status_cfg_create( + char *dnn + ); +void OpenAPI_pdu_session_status_cfg_free(OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg); +OpenAPI_pdu_session_status_cfg_t *OpenAPI_pdu_session_status_cfg_parseFromJSON(cJSON *pdu_session_status_cfgJSON); +cJSON *OpenAPI_pdu_session_status_cfg_convertToJSON(OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg); +OpenAPI_pdu_session_status_cfg_t *OpenAPI_pdu_session_status_cfg_copy(OpenAPI_pdu_session_status_cfg_t *dst, OpenAPI_pdu_session_status_cfg_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_status_cfg_H_ */ + diff --git a/lib/sbi/openapi/model/pgw_info.c b/lib/sbi/openapi/model/pgw_info.c index 57e7533cd..3b72419ab 100644 --- a/lib/sbi/openapi/model/pgw_info.c +++ b/lib/sbi/openapi/model/pgw_info.c @@ -7,7 +7,8 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_create( char *dnn, char *pgw_fqdn, - OpenAPI_plmn_id_t *plmn_id + OpenAPI_plmn_id_t *plmn_id, + int epdg_ind ) { OpenAPI_pgw_info_t *pgw_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_pgw_info_t)); @@ -17,6 +18,7 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_create( pgw_info_local_var->dnn = dnn; pgw_info_local_var->pgw_fqdn = pgw_fqdn; pgw_info_local_var->plmn_id = plmn_id; + pgw_info_local_var->epdg_ind = epdg_ind; return pgw_info_local_var; } @@ -74,6 +76,13 @@ cJSON *OpenAPI_pgw_info_convertToJSON(OpenAPI_pgw_info_t *pgw_info) } } + if (pgw_info->epdg_ind) { + if (cJSON_AddBoolToObject(item, "epdgInd", pgw_info->epdg_ind) == NULL) { + ogs_error("OpenAPI_pgw_info_convertToJSON() failed [epdg_ind]"); + goto end; + } + } + end: return item; } @@ -112,10 +121,20 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_parseFromJSON(cJSON *pgw_infoJSON) plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); } + cJSON *epdg_ind = cJSON_GetObjectItemCaseSensitive(pgw_infoJSON, "epdgInd"); + + if (epdg_ind) { + if (!cJSON_IsBool(epdg_ind)) { + ogs_error("OpenAPI_pgw_info_parseFromJSON() failed [epdg_ind]"); + goto end; + } + } + pgw_info_local_var = OpenAPI_pgw_info_create ( ogs_strdup(dnn->valuestring), ogs_strdup(pgw_fqdn->valuestring), - plmn_id ? plmn_id_local_nonprim : NULL + plmn_id ? plmn_id_local_nonprim : NULL, + epdg_ind ? epdg_ind->valueint : 0 ); return pgw_info_local_var; diff --git a/lib/sbi/openapi/model/pgw_info.h b/lib/sbi/openapi/model/pgw_info.h index dbac4abba..446d127f1 100644 --- a/lib/sbi/openapi/model/pgw_info.h +++ b/lib/sbi/openapi/model/pgw_info.h @@ -23,12 +23,14 @@ typedef struct OpenAPI_pgw_info_s { char *dnn; char *pgw_fqdn; struct OpenAPI_plmn_id_s *plmn_id; + int epdg_ind; } OpenAPI_pgw_info_t; OpenAPI_pgw_info_t *OpenAPI_pgw_info_create( char *dnn, char *pgw_fqdn, - OpenAPI_plmn_id_t *plmn_id + OpenAPI_plmn_id_t *plmn_id, + int epdg_ind ); void OpenAPI_pgw_info_free(OpenAPI_pgw_info_t *pgw_info); OpenAPI_pgw_info_t *OpenAPI_pgw_info_parseFromJSON(cJSON *pgw_infoJSON); diff --git a/lib/sbi/openapi/model/plmn_ec_info.c b/lib/sbi/openapi/model/plmn_ec_info.c index 0d0b96629..a865e5a83 100644 --- a/lib/sbi/openapi/model/plmn_ec_info.c +++ b/lib/sbi/openapi/model/plmn_ec_info.c @@ -6,8 +6,8 @@ OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_create( OpenAPI_plmn_id_t *plmn_id, - int ec_mode_a_restricted, - int ec_mode_b_restricted + OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb, + int ec_restriction_data_nb ) { OpenAPI_plmn_ec_info_t *plmn_ec_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_plmn_ec_info_t)); @@ -15,8 +15,8 @@ OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_create( return NULL; } plmn_ec_info_local_var->plmn_id = plmn_id; - plmn_ec_info_local_var->ec_mode_a_restricted = ec_mode_a_restricted; - plmn_ec_info_local_var->ec_mode_b_restricted = ec_mode_b_restricted; + plmn_ec_info_local_var->ec_restriction_data_wb = ec_restriction_data_wb; + plmn_ec_info_local_var->ec_restriction_data_nb = ec_restriction_data_nb; return plmn_ec_info_local_var; } @@ -28,6 +28,7 @@ void OpenAPI_plmn_ec_info_free(OpenAPI_plmn_ec_info_t *plmn_ec_info) } OpenAPI_lnode_t *node; OpenAPI_plmn_id_free(plmn_ec_info->plmn_id); + OpenAPI_ec_restriction_data_wb_free(plmn_ec_info->ec_restriction_data_wb); ogs_free(plmn_ec_info); } @@ -56,16 +57,22 @@ cJSON *OpenAPI_plmn_ec_info_convertToJSON(OpenAPI_plmn_ec_info_t *plmn_ec_info) goto end; } - if (plmn_ec_info->ec_mode_a_restricted) { - if (cJSON_AddBoolToObject(item, "ecModeARestricted", plmn_ec_info->ec_mode_a_restricted) == NULL) { - ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [ec_mode_a_restricted]"); + if (plmn_ec_info->ec_restriction_data_wb) { + cJSON *ec_restriction_data_wb_local_JSON = OpenAPI_ec_restriction_data_wb_convertToJSON(plmn_ec_info->ec_restriction_data_wb); + if (ec_restriction_data_wb_local_JSON == NULL) { + ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [ec_restriction_data_wb]"); + goto end; + } + cJSON_AddItemToObject(item, "ecRestrictionDataWb", ec_restriction_data_wb_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [ec_restriction_data_wb]"); goto end; } } - if (plmn_ec_info->ec_mode_b_restricted) { - if (cJSON_AddBoolToObject(item, "ecModeBRestricted", plmn_ec_info->ec_mode_b_restricted) == NULL) { - ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [ec_mode_b_restricted]"); + if (plmn_ec_info->ec_restriction_data_nb) { + if (cJSON_AddBoolToObject(item, "ecRestrictionDataNb", plmn_ec_info->ec_restriction_data_nb) == NULL) { + ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [ec_restriction_data_nb]"); goto end; } } @@ -87,28 +94,26 @@ OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_parseFromJSON(cJSON *plmn_ec_infoJS plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); - cJSON *ec_mode_a_restricted = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecModeARestricted"); + cJSON *ec_restriction_data_wb = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecRestrictionDataWb"); - if (ec_mode_a_restricted) { - if (!cJSON_IsBool(ec_mode_a_restricted)) { - ogs_error("OpenAPI_plmn_ec_info_parseFromJSON() failed [ec_mode_a_restricted]"); - goto end; - } + 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_mode_b_restricted = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecModeBRestricted"); + cJSON *ec_restriction_data_nb = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecRestrictionDataNb"); - if (ec_mode_b_restricted) { - if (!cJSON_IsBool(ec_mode_b_restricted)) { - ogs_error("OpenAPI_plmn_ec_info_parseFromJSON() failed [ec_mode_b_restricted]"); + if (ec_restriction_data_nb) { + if (!cJSON_IsBool(ec_restriction_data_nb)) { + ogs_error("OpenAPI_plmn_ec_info_parseFromJSON() failed [ec_restriction_data_nb]"); goto end; } } plmn_ec_info_local_var = OpenAPI_plmn_ec_info_create ( plmn_id_local_nonprim, - ec_mode_a_restricted ? ec_mode_a_restricted->valueint : 0, - ec_mode_b_restricted ? ec_mode_b_restricted->valueint : 0 + ec_restriction_data_wb ? ec_restriction_data_wb_local_nonprim : NULL, + ec_restriction_data_nb ? ec_restriction_data_nb->valueint : 0 ); return plmn_ec_info_local_var; diff --git a/lib/sbi/openapi/model/plmn_ec_info.h b/lib/sbi/openapi/model/plmn_ec_info.h index 633fe82bd..38424dcb5 100644 --- a/lib/sbi/openapi/model/plmn_ec_info.h +++ b/lib/sbi/openapi/model/plmn_ec_info.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ec_restriction_data_wb.h" #include "plmn_id.h" #ifdef __cplusplus @@ -21,14 +22,14 @@ extern "C" { typedef struct OpenAPI_plmn_ec_info_s OpenAPI_plmn_ec_info_t; typedef struct OpenAPI_plmn_ec_info_s { struct OpenAPI_plmn_id_s *plmn_id; - int ec_mode_a_restricted; - int ec_mode_b_restricted; + struct OpenAPI_ec_restriction_data_wb_s *ec_restriction_data_wb; + int ec_restriction_data_nb; } OpenAPI_plmn_ec_info_t; OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_create( OpenAPI_plmn_id_t *plmn_id, - int ec_mode_a_restricted, - int ec_mode_b_restricted + OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb, + int ec_restriction_data_nb ); void OpenAPI_plmn_ec_info_free(OpenAPI_plmn_ec_info_t *plmn_ec_info); OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_parseFromJSON(cJSON *plmn_ec_infoJSON); diff --git a/lib/sbi/openapi/model/plmn_snssai.c b/lib/sbi/openapi/model/plmn_snssai.c index ece47e9fd..0ad8f353b 100644 --- a/lib/sbi/openapi/model/plmn_snssai.c +++ b/lib/sbi/openapi/model/plmn_snssai.c @@ -29,7 +29,7 @@ void OpenAPI_plmn_snssai_free(OpenAPI_plmn_snssai_t *plmn_snssai) OpenAPI_lnode_t *node; OpenAPI_plmn_id_free(plmn_snssai->plmn_id); OpenAPI_list_for_each(plmn_snssai->s_nssai_list, node) { - OpenAPI_snssai_free(node->data); + OpenAPI_ext_snssai_free(node->data); } OpenAPI_list_free(plmn_snssai->s_nssai_list); ogs_free(plmn_snssai->nid); @@ -74,7 +74,7 @@ cJSON *OpenAPI_plmn_snssai_convertToJSON(OpenAPI_plmn_snssai_t *plmn_snssai) OpenAPI_lnode_t *s_nssai_list_node; if (plmn_snssai->s_nssai_list) { OpenAPI_list_for_each(plmn_snssai->s_nssai_list, s_nssai_list_node) { - cJSON *itemLocal = OpenAPI_snssai_convertToJSON(s_nssai_list_node->data); + cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(s_nssai_list_node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [s_nssai_list]"); goto end; @@ -128,7 +128,7 @@ OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_parseFromJSON(cJSON *plmn_snssaiJSON) ogs_error("OpenAPI_plmn_snssai_parseFromJSON() failed [s_nssai_list]"); goto end; } - OpenAPI_snssai_t *s_nssai_listItem = OpenAPI_snssai_parseFromJSON(s_nssai_list_local_nonprimitive); + OpenAPI_ext_snssai_t *s_nssai_listItem = OpenAPI_ext_snssai_parseFromJSON(s_nssai_list_local_nonprimitive); OpenAPI_list_add(s_nssai_listList, s_nssai_listItem); } diff --git a/lib/sbi/openapi/model/plmn_snssai.h b/lib/sbi/openapi/model/plmn_snssai.h index 398753053..803f52b54 100644 --- a/lib/sbi/openapi/model/plmn_snssai.h +++ b/lib/sbi/openapi/model/plmn_snssai.h @@ -12,8 +12,8 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ext_snssai.h" #include "plmn_id.h" -#include "snssai.h" #ifdef __cplusplus extern "C" { diff --git a/lib/sbi/openapi/model/positioning_method_mdt.c b/lib/sbi/openapi/model/positioning_method_mdt.c new file mode 100644 index 000000000..27851e3ff --- /dev/null +++ b/lib/sbi/openapi/model/positioning_method_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "positioning_method_mdt.h" + +char* OpenAPI_positioning_method_mdt_ToString(OpenAPI_positioning_method_mdt_e positioning_method_mdt) +{ + const char *positioning_method_mdtArray[] = { "NULL", "GNSS", "E_CELL_ID" }; + size_t sizeofArray = sizeof(positioning_method_mdtArray) / sizeof(positioning_method_mdtArray[0]); + if (positioning_method_mdt < sizeofArray) + return (char *)positioning_method_mdtArray[positioning_method_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_positioning_method_mdt_e OpenAPI_positioning_method_mdt_FromString(char* positioning_method_mdt) +{ + int stringToReturn = 0; + const char *positioning_method_mdtArray[] = { "NULL", "GNSS", "E_CELL_ID" }; + size_t sizeofArray = sizeof(positioning_method_mdtArray) / sizeof(positioning_method_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(positioning_method_mdt, positioning_method_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/positioning_method_mdt.h b/lib/sbi/openapi/model/positioning_method_mdt.h new file mode 100644 index 000000000..228a67ca6 --- /dev/null +++ b/lib/sbi/openapi/model/positioning_method_mdt.h @@ -0,0 +1,31 @@ +/* + * positioning_method_mdt.h + * + * + */ + +#ifndef _OpenAPI_positioning_method_mdt_H_ +#define _OpenAPI_positioning_method_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_positioning_method_mdt_NULL = 0, OpenAPI_positioning_method_mdt_GNSS, OpenAPI_positioning_method_mdt_E_CELL_ID } OpenAPI_positioning_method_mdt_e; + +char* OpenAPI_positioning_method_mdt_ToString(OpenAPI_positioning_method_mdt_e positioning_method_mdt); + +OpenAPI_positioning_method_mdt_e OpenAPI_positioning_method_mdt_FromString(char* positioning_method_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_positioning_method_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/pp_active_time.c b/lib/sbi/openapi/model/pp_active_time.c index c2f4199e8..822838c4c 100644 --- a/lib/sbi/openapi/model/pp_active_time.c +++ b/lib/sbi/openapi/model/pp_active_time.c @@ -8,7 +8,8 @@ OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_create( int active_time, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ) { OpenAPI_pp_active_time_t *pp_active_time_local_var = OpenAPI_malloc(sizeof(OpenAPI_pp_active_time_t)); @@ -19,6 +20,7 @@ OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_create( pp_active_time_local_var->af_instance_id = af_instance_id; pp_active_time_local_var->reference_id = reference_id; pp_active_time_local_var->validity_time = validity_time; + pp_active_time_local_var->mtc_provider_information = mtc_provider_information; return pp_active_time_local_var; } @@ -31,6 +33,7 @@ void OpenAPI_pp_active_time_free(OpenAPI_pp_active_time_t *pp_active_time) OpenAPI_lnode_t *node; ogs_free(pp_active_time->af_instance_id); ogs_free(pp_active_time->validity_time); + ogs_free(pp_active_time->mtc_provider_information); ogs_free(pp_active_time); } @@ -78,6 +81,13 @@ cJSON *OpenAPI_pp_active_time_convertToJSON(OpenAPI_pp_active_time_t *pp_active_ } } + if (pp_active_time->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", pp_active_time->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_pp_active_time_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -130,11 +140,21 @@ OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_parseFromJSON(cJSON *pp_active_ } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(pp_active_timeJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_pp_active_time_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + pp_active_time_local_var = OpenAPI_pp_active_time_create ( active_time->valuedouble, ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return pp_active_time_local_var; diff --git a/lib/sbi/openapi/model/pp_active_time.h b/lib/sbi/openapi/model/pp_active_time.h index 6204ecaf4..3a1bb862d 100644 --- a/lib/sbi/openapi/model/pp_active_time.h +++ b/lib/sbi/openapi/model/pp_active_time.h @@ -23,13 +23,15 @@ typedef struct OpenAPI_pp_active_time_s { char *af_instance_id; int reference_id; char *validity_time; + char *mtc_provider_information; } OpenAPI_pp_active_time_t; OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_create( int active_time, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ); void OpenAPI_pp_active_time_free(OpenAPI_pp_active_time_t *pp_active_time); OpenAPI_pp_active_time_t *OpenAPI_pp_active_time_parseFromJSON(cJSON *pp_active_timeJSON); diff --git a/lib/sbi/openapi/model/pp_data.c b/lib/sbi/openapi/model/pp_data.c index 5b5d55dd2..eeef06c43 100644 --- a/lib/sbi/openapi/model/pp_data.c +++ b/lib/sbi/openapi/model/pp_data.c @@ -11,7 +11,8 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_create( OpenAPI_ec_restriction_t *ec_restriction, OpenAPI_acs_info_rm_t *acs_info, char *stn_sr, - OpenAPI_lcs_privacy_t *lcs_privacy + OpenAPI_lcs_privacy_t *lcs_privacy, + OpenAPI_sor_info_t *sor_info ) { OpenAPI_pp_data_t *pp_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_pp_data_t)); @@ -25,6 +26,7 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_create( pp_data_local_var->acs_info = acs_info; pp_data_local_var->stn_sr = stn_sr; pp_data_local_var->lcs_privacy = lcs_privacy; + pp_data_local_var->sor_info = sor_info; return pp_data_local_var; } @@ -42,6 +44,7 @@ void OpenAPI_pp_data_free(OpenAPI_pp_data_t *pp_data) OpenAPI_acs_info_rm_free(pp_data->acs_info); ogs_free(pp_data->stn_sr); OpenAPI_lcs_privacy_free(pp_data->lcs_privacy); + OpenAPI_sor_info_free(pp_data->sor_info); ogs_free(pp_data); } @@ -134,6 +137,19 @@ cJSON *OpenAPI_pp_data_convertToJSON(OpenAPI_pp_data_t *pp_data) } } + if (pp_data->sor_info) { + cJSON *sor_info_local_JSON = OpenAPI_sor_info_convertToJSON(pp_data->sor_info); + if (sor_info_local_JSON == NULL) { + ogs_error("OpenAPI_pp_data_convertToJSON() failed [sor_info]"); + goto end; + } + cJSON_AddItemToObject(item, "sorInfo", sor_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pp_data_convertToJSON() failed [sor_info]"); + goto end; + } + } + end: return item; } @@ -194,6 +210,13 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON) lcs_privacy_local_nonprim = OpenAPI_lcs_privacy_parseFromJSON(lcs_privacy); } + cJSON *sor_info = cJSON_GetObjectItemCaseSensitive(pp_dataJSON, "sorInfo"); + + OpenAPI_sor_info_t *sor_info_local_nonprim = NULL; + if (sor_info) { + sor_info_local_nonprim = OpenAPI_sor_info_parseFromJSON(sor_info); + } + pp_data_local_var = OpenAPI_pp_data_create ( communication_characteristics ? communication_characteristics_local_nonprim : NULL, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, @@ -201,7 +224,8 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON) ec_restriction ? ec_restriction_local_nonprim : NULL, acs_info ? acs_info_local_nonprim : NULL, stn_sr ? ogs_strdup(stn_sr->valuestring) : NULL, - lcs_privacy ? lcs_privacy_local_nonprim : NULL + lcs_privacy ? lcs_privacy_local_nonprim : NULL, + sor_info ? sor_info_local_nonprim : NULL ); return pp_data_local_var; diff --git a/lib/sbi/openapi/model/pp_data.h b/lib/sbi/openapi/model/pp_data.h index a90d74860..31ba4f0ad 100644 --- a/lib/sbi/openapi/model/pp_data.h +++ b/lib/sbi/openapi/model/pp_data.h @@ -17,6 +17,7 @@ #include "ec_restriction.h" #include "expected_ue_behaviour.h" #include "lcs_privacy.h" +#include "sor_info.h" #ifdef __cplusplus extern "C" { @@ -31,6 +32,7 @@ typedef struct OpenAPI_pp_data_s { struct OpenAPI_acs_info_rm_s *acs_info; char *stn_sr; struct OpenAPI_lcs_privacy_s *lcs_privacy; + struct OpenAPI_sor_info_s *sor_info; } OpenAPI_pp_data_t; OpenAPI_pp_data_t *OpenAPI_pp_data_create( @@ -40,7 +42,8 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_create( OpenAPI_ec_restriction_t *ec_restriction, OpenAPI_acs_info_rm_t *acs_info, char *stn_sr, - OpenAPI_lcs_privacy_t *lcs_privacy + OpenAPI_lcs_privacy_t *lcs_privacy, + OpenAPI_sor_info_t *sor_info ); void OpenAPI_pp_data_free(OpenAPI_pp_data_t *pp_data); OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON); diff --git a/lib/sbi/openapi/model/pp_dl_packet_count_ext.c b/lib/sbi/openapi/model/pp_dl_packet_count_ext.c index a43624c81..97b28e209 100644 --- a/lib/sbi/openapi/model/pp_dl_packet_count_ext.c +++ b/lib/sbi/openapi/model/pp_dl_packet_count_ext.c @@ -7,7 +7,8 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_create( char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ) { OpenAPI_pp_dl_packet_count_ext_t *pp_dl_packet_count_ext_local_var = OpenAPI_malloc(sizeof(OpenAPI_pp_dl_packet_count_ext_t)); @@ -17,6 +18,7 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_create( pp_dl_packet_count_ext_local_var->af_instance_id = af_instance_id; pp_dl_packet_count_ext_local_var->reference_id = reference_id; pp_dl_packet_count_ext_local_var->validity_time = validity_time; + pp_dl_packet_count_ext_local_var->mtc_provider_information = mtc_provider_information; return pp_dl_packet_count_ext_local_var; } @@ -29,6 +31,7 @@ void OpenAPI_pp_dl_packet_count_ext_free(OpenAPI_pp_dl_packet_count_ext_t *pp_dl OpenAPI_lnode_t *node; ogs_free(pp_dl_packet_count_ext->af_instance_id); ogs_free(pp_dl_packet_count_ext->validity_time); + ogs_free(pp_dl_packet_count_ext->mtc_provider_information); ogs_free(pp_dl_packet_count_ext); } @@ -67,6 +70,13 @@ cJSON *OpenAPI_pp_dl_packet_count_ext_convertToJSON(OpenAPI_pp_dl_packet_count_e } } + if (pp_dl_packet_count_ext->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", pp_dl_packet_count_ext->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_pp_dl_packet_count_ext_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -107,10 +117,20 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_parseFromJSON(c } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(pp_dl_packet_count_extJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_pp_dl_packet_count_ext_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + pp_dl_packet_count_ext_local_var = OpenAPI_pp_dl_packet_count_ext_create ( ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return pp_dl_packet_count_ext_local_var; diff --git a/lib/sbi/openapi/model/pp_dl_packet_count_ext.h b/lib/sbi/openapi/model/pp_dl_packet_count_ext.h index 9cd69ef22..e594dbd2c 100644 --- a/lib/sbi/openapi/model/pp_dl_packet_count_ext.h +++ b/lib/sbi/openapi/model/pp_dl_packet_count_ext.h @@ -22,12 +22,14 @@ typedef struct OpenAPI_pp_dl_packet_count_ext_s { char *af_instance_id; int reference_id; char *validity_time; + char *mtc_provider_information; } OpenAPI_pp_dl_packet_count_ext_t; OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_create( char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ); void OpenAPI_pp_dl_packet_count_ext_free(OpenAPI_pp_dl_packet_count_ext_t *pp_dl_packet_count_ext); OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_parseFromJSON(cJSON *pp_dl_packet_count_extJSON); diff --git a/lib/sbi/openapi/model/pp_maximum_latency.c b/lib/sbi/openapi/model/pp_maximum_latency.c index aae449cf0..b99a68a0b 100644 --- a/lib/sbi/openapi/model/pp_maximum_latency.c +++ b/lib/sbi/openapi/model/pp_maximum_latency.c @@ -8,7 +8,8 @@ OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_create( int maximum_latency, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ) { OpenAPI_pp_maximum_latency_t *pp_maximum_latency_local_var = OpenAPI_malloc(sizeof(OpenAPI_pp_maximum_latency_t)); @@ -19,6 +20,7 @@ OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_create( pp_maximum_latency_local_var->af_instance_id = af_instance_id; pp_maximum_latency_local_var->reference_id = reference_id; pp_maximum_latency_local_var->validity_time = validity_time; + pp_maximum_latency_local_var->mtc_provider_information = mtc_provider_information; return pp_maximum_latency_local_var; } @@ -31,6 +33,7 @@ void OpenAPI_pp_maximum_latency_free(OpenAPI_pp_maximum_latency_t *pp_maximum_la OpenAPI_lnode_t *node; ogs_free(pp_maximum_latency->af_instance_id); ogs_free(pp_maximum_latency->validity_time); + ogs_free(pp_maximum_latency->mtc_provider_information); ogs_free(pp_maximum_latency); } @@ -78,6 +81,13 @@ cJSON *OpenAPI_pp_maximum_latency_convertToJSON(OpenAPI_pp_maximum_latency_t *pp } } + if (pp_maximum_latency->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", pp_maximum_latency->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_pp_maximum_latency_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -130,11 +140,21 @@ OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_parseFromJSON(cJSON *pp } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(pp_maximum_latencyJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_pp_maximum_latency_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + pp_maximum_latency_local_var = OpenAPI_pp_maximum_latency_create ( maximum_latency->valuedouble, ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return pp_maximum_latency_local_var; diff --git a/lib/sbi/openapi/model/pp_maximum_latency.h b/lib/sbi/openapi/model/pp_maximum_latency.h index 4f77c9493..e36adcc49 100644 --- a/lib/sbi/openapi/model/pp_maximum_latency.h +++ b/lib/sbi/openapi/model/pp_maximum_latency.h @@ -23,13 +23,15 @@ typedef struct OpenAPI_pp_maximum_latency_s { char *af_instance_id; int reference_id; char *validity_time; + char *mtc_provider_information; } OpenAPI_pp_maximum_latency_t; OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_create( int maximum_latency, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ); void OpenAPI_pp_maximum_latency_free(OpenAPI_pp_maximum_latency_t *pp_maximum_latency); OpenAPI_pp_maximum_latency_t *OpenAPI_pp_maximum_latency_parseFromJSON(cJSON *pp_maximum_latencyJSON); diff --git a/lib/sbi/openapi/model/pp_maximum_response_time.c b/lib/sbi/openapi/model/pp_maximum_response_time.c index ea235f963..1039c0c84 100644 --- a/lib/sbi/openapi/model/pp_maximum_response_time.c +++ b/lib/sbi/openapi/model/pp_maximum_response_time.c @@ -8,7 +8,8 @@ OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_create( int maximum_response_time, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ) { OpenAPI_pp_maximum_response_time_t *pp_maximum_response_time_local_var = OpenAPI_malloc(sizeof(OpenAPI_pp_maximum_response_time_t)); @@ -19,6 +20,7 @@ OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_create( pp_maximum_response_time_local_var->af_instance_id = af_instance_id; pp_maximum_response_time_local_var->reference_id = reference_id; pp_maximum_response_time_local_var->validity_time = validity_time; + pp_maximum_response_time_local_var->mtc_provider_information = mtc_provider_information; return pp_maximum_response_time_local_var; } @@ -31,6 +33,7 @@ void OpenAPI_pp_maximum_response_time_free(OpenAPI_pp_maximum_response_time_t *p OpenAPI_lnode_t *node; ogs_free(pp_maximum_response_time->af_instance_id); ogs_free(pp_maximum_response_time->validity_time); + ogs_free(pp_maximum_response_time->mtc_provider_information); ogs_free(pp_maximum_response_time); } @@ -78,6 +81,13 @@ cJSON *OpenAPI_pp_maximum_response_time_convertToJSON(OpenAPI_pp_maximum_respons } } + if (pp_maximum_response_time->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", pp_maximum_response_time->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_pp_maximum_response_time_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -130,11 +140,21 @@ OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_parseFromJS } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(pp_maximum_response_timeJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_pp_maximum_response_time_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + pp_maximum_response_time_local_var = OpenAPI_pp_maximum_response_time_create ( maximum_response_time->valuedouble, ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return pp_maximum_response_time_local_var; diff --git a/lib/sbi/openapi/model/pp_maximum_response_time.h b/lib/sbi/openapi/model/pp_maximum_response_time.h index 411c199f0..52f2cfd5e 100644 --- a/lib/sbi/openapi/model/pp_maximum_response_time.h +++ b/lib/sbi/openapi/model/pp_maximum_response_time.h @@ -23,13 +23,15 @@ typedef struct OpenAPI_pp_maximum_response_time_s { char *af_instance_id; int reference_id; char *validity_time; + char *mtc_provider_information; } OpenAPI_pp_maximum_response_time_t; OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_create( int maximum_response_time, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ); void OpenAPI_pp_maximum_response_time_free(OpenAPI_pp_maximum_response_time_t *pp_maximum_response_time); OpenAPI_pp_maximum_response_time_t *OpenAPI_pp_maximum_response_time_parseFromJSON(cJSON *pp_maximum_response_timeJSON); diff --git a/lib/sbi/openapi/model/pp_subs_reg_timer.c b/lib/sbi/openapi/model/pp_subs_reg_timer.c index f868e832a..b04c544b7 100644 --- a/lib/sbi/openapi/model/pp_subs_reg_timer.c +++ b/lib/sbi/openapi/model/pp_subs_reg_timer.c @@ -8,7 +8,8 @@ OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_create( int subs_reg_timer, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ) { OpenAPI_pp_subs_reg_timer_t *pp_subs_reg_timer_local_var = OpenAPI_malloc(sizeof(OpenAPI_pp_subs_reg_timer_t)); @@ -19,6 +20,7 @@ OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_create( pp_subs_reg_timer_local_var->af_instance_id = af_instance_id; pp_subs_reg_timer_local_var->reference_id = reference_id; pp_subs_reg_timer_local_var->validity_time = validity_time; + pp_subs_reg_timer_local_var->mtc_provider_information = mtc_provider_information; return pp_subs_reg_timer_local_var; } @@ -31,6 +33,7 @@ void OpenAPI_pp_subs_reg_timer_free(OpenAPI_pp_subs_reg_timer_t *pp_subs_reg_tim OpenAPI_lnode_t *node; ogs_free(pp_subs_reg_timer->af_instance_id); ogs_free(pp_subs_reg_timer->validity_time); + ogs_free(pp_subs_reg_timer->mtc_provider_information); ogs_free(pp_subs_reg_timer); } @@ -78,6 +81,13 @@ cJSON *OpenAPI_pp_subs_reg_timer_convertToJSON(OpenAPI_pp_subs_reg_timer_t *pp_s } } + if (pp_subs_reg_timer->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", pp_subs_reg_timer->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_pp_subs_reg_timer_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + end: return item; } @@ -130,11 +140,21 @@ OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_parseFromJSON(cJSON *pp_s } } + cJSON *mtc_provider_information = cJSON_GetObjectItemCaseSensitive(pp_subs_reg_timerJSON, "mtcProviderInformation"); + + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_pp_subs_reg_timer_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + pp_subs_reg_timer_local_var = OpenAPI_pp_subs_reg_timer_create ( subs_reg_timer->valuedouble, ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, - validity_time ? ogs_strdup(validity_time->valuestring) : NULL + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + mtc_provider_information ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return pp_subs_reg_timer_local_var; diff --git a/lib/sbi/openapi/model/pp_subs_reg_timer.h b/lib/sbi/openapi/model/pp_subs_reg_timer.h index 41bb9b2c6..37ef73afe 100644 --- a/lib/sbi/openapi/model/pp_subs_reg_timer.h +++ b/lib/sbi/openapi/model/pp_subs_reg_timer.h @@ -23,13 +23,15 @@ typedef struct OpenAPI_pp_subs_reg_timer_s { char *af_instance_id; int reference_id; char *validity_time; + char *mtc_provider_information; } OpenAPI_pp_subs_reg_timer_t; OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_create( int subs_reg_timer, char *af_instance_id, int reference_id, - char *validity_time + char *validity_time, + char *mtc_provider_information ); void OpenAPI_pp_subs_reg_timer_free(OpenAPI_pp_subs_reg_timer_t *pp_subs_reg_timer); OpenAPI_pp_subs_reg_timer_t *OpenAPI_pp_subs_reg_timer_parseFromJSON(cJSON *pp_subs_reg_timerJSON); diff --git a/lib/sbi/openapi/model/preferred_search.c b/lib/sbi/openapi/model/preferred_search.c index f27d3c7e0..6e7be47b0 100644 --- a/lib/sbi/openapi/model/preferred_search.c +++ b/lib/sbi/openapi/model/preferred_search.c @@ -5,7 +5,12 @@ #include "preferred_search.h" OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( - int preferred_tai_match_ind + int preferred_tai_match_ind, + int preferred_full_plmn_match_ind, + int preferred_api_versions_match_ind, + int other_api_versions_ind, + int preferred_locality_match_ind, + int other_locality_ind ) { OpenAPI_preferred_search_t *preferred_search_local_var = OpenAPI_malloc(sizeof(OpenAPI_preferred_search_t)); @@ -13,6 +18,11 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( return NULL; } preferred_search_local_var->preferred_tai_match_ind = preferred_tai_match_ind; + preferred_search_local_var->preferred_full_plmn_match_ind = preferred_full_plmn_match_ind; + preferred_search_local_var->preferred_api_versions_match_ind = preferred_api_versions_match_ind; + preferred_search_local_var->other_api_versions_ind = other_api_versions_ind; + preferred_search_local_var->preferred_locality_match_ind = preferred_locality_match_ind; + preferred_search_local_var->other_locality_ind = other_locality_ind; return preferred_search_local_var; } @@ -43,6 +53,41 @@ cJSON *OpenAPI_preferred_search_convertToJSON(OpenAPI_preferred_search_t *prefer } } + if (preferred_search->preferred_full_plmn_match_ind) { + if (cJSON_AddBoolToObject(item, "preferredFullPlmnMatchInd", preferred_search->preferred_full_plmn_match_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_full_plmn_match_ind]"); + goto end; + } + } + + if (preferred_search->preferred_api_versions_match_ind) { + if (cJSON_AddBoolToObject(item, "preferredApiVersionsMatchInd", preferred_search->preferred_api_versions_match_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_api_versions_match_ind]"); + goto end; + } + } + + if (preferred_search->other_api_versions_ind) { + if (cJSON_AddBoolToObject(item, "otherApiVersionsInd", preferred_search->other_api_versions_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [other_api_versions_ind]"); + goto end; + } + } + + if (preferred_search->preferred_locality_match_ind) { + if (cJSON_AddBoolToObject(item, "preferredLocalityMatchInd", preferred_search->preferred_locality_match_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_locality_match_ind]"); + goto end; + } + } + + if (preferred_search->other_locality_ind) { + if (cJSON_AddBoolToObject(item, "otherLocalityInd", preferred_search->other_locality_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [other_locality_ind]"); + goto end; + } + } + end: return item; } @@ -59,8 +104,58 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *prefer } } + cJSON *preferred_full_plmn_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredFullPlmnMatchInd"); + + if (preferred_full_plmn_match_ind) { + if (!cJSON_IsBool(preferred_full_plmn_match_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_full_plmn_match_ind]"); + goto end; + } + } + + cJSON *preferred_api_versions_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredApiVersionsMatchInd"); + + if (preferred_api_versions_match_ind) { + if (!cJSON_IsBool(preferred_api_versions_match_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_api_versions_match_ind]"); + goto end; + } + } + + cJSON *other_api_versions_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "otherApiVersionsInd"); + + if (other_api_versions_ind) { + if (!cJSON_IsBool(other_api_versions_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [other_api_versions_ind]"); + goto end; + } + } + + cJSON *preferred_locality_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredLocalityMatchInd"); + + if (preferred_locality_match_ind) { + if (!cJSON_IsBool(preferred_locality_match_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_locality_match_ind]"); + goto end; + } + } + + cJSON *other_locality_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "otherLocalityInd"); + + if (other_locality_ind) { + if (!cJSON_IsBool(other_locality_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [other_locality_ind]"); + goto end; + } + } + preferred_search_local_var = OpenAPI_preferred_search_create ( - preferred_tai_match_ind ? preferred_tai_match_ind->valueint : 0 + preferred_tai_match_ind ? preferred_tai_match_ind->valueint : 0, + preferred_full_plmn_match_ind ? preferred_full_plmn_match_ind->valueint : 0, + preferred_api_versions_match_ind ? preferred_api_versions_match_ind->valueint : 0, + other_api_versions_ind ? other_api_versions_ind->valueint : 0, + preferred_locality_match_ind ? preferred_locality_match_ind->valueint : 0, + other_locality_ind ? other_locality_ind->valueint : 0 ); return preferred_search_local_var; diff --git a/lib/sbi/openapi/model/preferred_search.h b/lib/sbi/openapi/model/preferred_search.h index 85bb083c2..1659a16e2 100644 --- a/lib/sbi/openapi/model/preferred_search.h +++ b/lib/sbi/openapi/model/preferred_search.h @@ -20,10 +20,20 @@ extern "C" { typedef struct OpenAPI_preferred_search_s OpenAPI_preferred_search_t; typedef struct OpenAPI_preferred_search_s { int preferred_tai_match_ind; + int preferred_full_plmn_match_ind; + int preferred_api_versions_match_ind; + int other_api_versions_ind; + int preferred_locality_match_ind; + int other_locality_ind; } OpenAPI_preferred_search_t; OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( - int preferred_tai_match_ind + int preferred_tai_match_ind, + int preferred_full_plmn_match_ind, + int preferred_api_versions_match_ind, + int other_api_versions_ind, + int preferred_locality_match_ind, + int other_locality_ind ); void OpenAPI_preferred_search_free(OpenAPI_preferred_search_t *preferred_search); OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *preferred_searchJSON); diff --git a/lib/sbi/openapi/model/presence_info.c b/lib/sbi/openapi/model/presence_info.c index af22c17b9..0c30fe57f 100644 --- a/lib/sbi/openapi/model/presence_info.c +++ b/lib/sbi/openapi/model/presence_info.c @@ -6,6 +6,7 @@ OpenAPI_presence_info_t *OpenAPI_presence_info_create( char *pra_id, + char *additional_pra_id, OpenAPI_presence_state_e presence_state, OpenAPI_list_t *tracking_area_list, OpenAPI_list_t *ecgi_list, @@ -19,6 +20,7 @@ OpenAPI_presence_info_t *OpenAPI_presence_info_create( return NULL; } presence_info_local_var->pra_id = pra_id; + presence_info_local_var->additional_pra_id = additional_pra_id; presence_info_local_var->presence_state = presence_state; presence_info_local_var->tracking_area_list = tracking_area_list; presence_info_local_var->ecgi_list = ecgi_list; @@ -36,6 +38,7 @@ void OpenAPI_presence_info_free(OpenAPI_presence_info_t *presence_info) } OpenAPI_lnode_t *node; ogs_free(presence_info->pra_id); + ogs_free(presence_info->additional_pra_id); OpenAPI_list_for_each(presence_info->tracking_area_list, node) { OpenAPI_tai_free(node->data); } @@ -76,6 +79,13 @@ cJSON *OpenAPI_presence_info_convertToJSON(OpenAPI_presence_info_t *presence_inf } } + if (presence_info->additional_pra_id) { + if (cJSON_AddStringToObject(item, "additionalPraId", presence_info->additional_pra_id) == NULL) { + ogs_error("OpenAPI_presence_info_convertToJSON() failed [additional_pra_id]"); + goto end; + } + } + if (presence_info->presence_state) { if (cJSON_AddStringToObject(item, "presenceState", OpenAPI_presence_state_ToString(presence_info->presence_state)) == NULL) { ogs_error("OpenAPI_presence_info_convertToJSON() failed [presence_state]"); @@ -199,6 +209,15 @@ OpenAPI_presence_info_t *OpenAPI_presence_info_parseFromJSON(cJSON *presence_inf } } + cJSON *additional_pra_id = cJSON_GetObjectItemCaseSensitive(presence_infoJSON, "additionalPraId"); + + if (additional_pra_id) { + if (!cJSON_IsString(additional_pra_id)) { + ogs_error("OpenAPI_presence_info_parseFromJSON() failed [additional_pra_id]"); + goto end; + } + } + cJSON *presence_state = cJSON_GetObjectItemCaseSensitive(presence_infoJSON, "presenceState"); OpenAPI_presence_state_e presence_stateVariable; @@ -327,6 +346,7 @@ OpenAPI_presence_info_t *OpenAPI_presence_info_parseFromJSON(cJSON *presence_inf presence_info_local_var = OpenAPI_presence_info_create ( pra_id ? ogs_strdup(pra_id->valuestring) : NULL, + additional_pra_id ? ogs_strdup(additional_pra_id->valuestring) : NULL, presence_state ? presence_stateVariable : 0, tracking_area_list ? tracking_area_listList : NULL, ecgi_list ? ecgi_listList : NULL, diff --git a/lib/sbi/openapi/model/presence_info.h b/lib/sbi/openapi/model/presence_info.h index f820e86b9..f82a62c68 100644 --- a/lib/sbi/openapi/model/presence_info.h +++ b/lib/sbi/openapi/model/presence_info.h @@ -25,6 +25,7 @@ extern "C" { typedef struct OpenAPI_presence_info_s OpenAPI_presence_info_t; typedef struct OpenAPI_presence_info_s { char *pra_id; + char *additional_pra_id; OpenAPI_presence_state_e presence_state; OpenAPI_list_t *tracking_area_list; OpenAPI_list_t *ecgi_list; @@ -35,6 +36,7 @@ typedef struct OpenAPI_presence_info_s { OpenAPI_presence_info_t *OpenAPI_presence_info_create( char *pra_id, + char *additional_pra_id, OpenAPI_presence_state_e presence_state, OpenAPI_list_t *tracking_area_list, OpenAPI_list_t *ecgi_list, diff --git a/lib/sbi/openapi/model/presence_info_rm.c b/lib/sbi/openapi/model/presence_info_rm.c index 76808e541..e49f8ee3d 100644 --- a/lib/sbi/openapi/model/presence_info_rm.c +++ b/lib/sbi/openapi/model/presence_info_rm.c @@ -6,6 +6,7 @@ OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_create( char *pra_id, + char *additional_pra_id, OpenAPI_presence_state_e presence_state, OpenAPI_list_t *tracking_area_list, OpenAPI_list_t *ecgi_list, @@ -19,6 +20,7 @@ OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_create( return NULL; } presence_info_rm_local_var->pra_id = pra_id; + presence_info_rm_local_var->additional_pra_id = additional_pra_id; presence_info_rm_local_var->presence_state = presence_state; presence_info_rm_local_var->tracking_area_list = tracking_area_list; presence_info_rm_local_var->ecgi_list = ecgi_list; @@ -36,6 +38,7 @@ void OpenAPI_presence_info_rm_free(OpenAPI_presence_info_rm_t *presence_info_rm) } OpenAPI_lnode_t *node; ogs_free(presence_info_rm->pra_id); + ogs_free(presence_info_rm->additional_pra_id); OpenAPI_list_for_each(presence_info_rm->tracking_area_list, node) { OpenAPI_tai_free(node->data); } @@ -76,6 +79,13 @@ cJSON *OpenAPI_presence_info_rm_convertToJSON(OpenAPI_presence_info_rm_t *presen } } + if (presence_info_rm->additional_pra_id) { + if (cJSON_AddStringToObject(item, "additionalPraId", presence_info_rm->additional_pra_id) == NULL) { + ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [additional_pra_id]"); + goto end; + } + } + if (presence_info_rm->presence_state) { if (cJSON_AddStringToObject(item, "presenceState", OpenAPI_presence_state_ToString(presence_info_rm->presence_state)) == NULL) { ogs_error("OpenAPI_presence_info_rm_convertToJSON() failed [presence_state]"); @@ -199,6 +209,15 @@ OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_parseFromJSON(cJSON *presen } } + cJSON *additional_pra_id = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "additionalPraId"); + + if (additional_pra_id) { + if (!cJSON_IsString(additional_pra_id)) { + ogs_error("OpenAPI_presence_info_rm_parseFromJSON() failed [additional_pra_id]"); + goto end; + } + } + cJSON *presence_state = cJSON_GetObjectItemCaseSensitive(presence_info_rmJSON, "presenceState"); OpenAPI_presence_state_e presence_stateVariable; @@ -327,6 +346,7 @@ OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_parseFromJSON(cJSON *presen presence_info_rm_local_var = OpenAPI_presence_info_rm_create ( pra_id ? ogs_strdup(pra_id->valuestring) : NULL, + additional_pra_id ? ogs_strdup(additional_pra_id->valuestring) : NULL, presence_state ? presence_stateVariable : 0, tracking_area_list ? tracking_area_listList : NULL, ecgi_list ? ecgi_listList : NULL, diff --git a/lib/sbi/openapi/model/presence_info_rm.h b/lib/sbi/openapi/model/presence_info_rm.h index 4ec124413..1500405e4 100644 --- a/lib/sbi/openapi/model/presence_info_rm.h +++ b/lib/sbi/openapi/model/presence_info_rm.h @@ -25,6 +25,7 @@ extern "C" { typedef struct OpenAPI_presence_info_rm_s OpenAPI_presence_info_rm_t; typedef struct OpenAPI_presence_info_rm_s { char *pra_id; + char *additional_pra_id; OpenAPI_presence_state_e presence_state; OpenAPI_list_t *tracking_area_list; OpenAPI_list_t *ecgi_list; @@ -35,6 +36,7 @@ typedef struct OpenAPI_presence_info_rm_s { OpenAPI_presence_info_rm_t *OpenAPI_presence_info_rm_create( char *pra_id, + char *additional_pra_id, OpenAPI_presence_state_e presence_state, OpenAPI_list_t *tracking_area_list, OpenAPI_list_t *ecgi_list, diff --git a/lib/sbi/openapi/model/problem_details.c b/lib/sbi/openapi/model/problem_details.c index 80a1df843..5f7d74360 100644 --- a/lib/sbi/openapi/model/problem_details.c +++ b/lib/sbi/openapi/model/problem_details.c @@ -12,7 +12,8 @@ OpenAPI_problem_details_t *OpenAPI_problem_details_create( char *instance, char *cause, OpenAPI_list_t *invalid_params, - char *supported_features + char *supported_features, + char *target_scp ) { OpenAPI_problem_details_t *problem_details_local_var = OpenAPI_malloc(sizeof(OpenAPI_problem_details_t)); @@ -27,6 +28,7 @@ OpenAPI_problem_details_t *OpenAPI_problem_details_create( problem_details_local_var->cause = cause; problem_details_local_var->invalid_params = invalid_params; problem_details_local_var->supported_features = supported_features; + problem_details_local_var->target_scp = target_scp; return problem_details_local_var; } @@ -47,6 +49,7 @@ void OpenAPI_problem_details_free(OpenAPI_problem_details_t *problem_details) } OpenAPI_list_free(problem_details->invalid_params); ogs_free(problem_details->supported_features); + ogs_free(problem_details->target_scp); ogs_free(problem_details); } @@ -129,6 +132,13 @@ cJSON *OpenAPI_problem_details_convertToJSON(OpenAPI_problem_details_t *problem_ } } + if (problem_details->target_scp) { + if (cJSON_AddStringToObject(item, "targetScp", problem_details->target_scp) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [target_scp]"); + goto end; + } + } + end: return item; } @@ -222,6 +232,15 @@ OpenAPI_problem_details_t *OpenAPI_problem_details_parseFromJSON(cJSON *problem_ } } + cJSON *target_scp = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "targetScp"); + + if (target_scp) { + if (!cJSON_IsString(target_scp)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [target_scp]"); + goto end; + } + } + problem_details_local_var = OpenAPI_problem_details_create ( type ? ogs_strdup(type->valuestring) : NULL, title ? ogs_strdup(title->valuestring) : NULL, @@ -230,7 +249,8 @@ OpenAPI_problem_details_t *OpenAPI_problem_details_parseFromJSON(cJSON *problem_ instance ? ogs_strdup(instance->valuestring) : NULL, cause ? ogs_strdup(cause->valuestring) : NULL, invalid_params ? invalid_paramsList : NULL, - supported_features ? ogs_strdup(supported_features->valuestring) : NULL + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + target_scp ? ogs_strdup(target_scp->valuestring) : NULL ); return problem_details_local_var; diff --git a/lib/sbi/openapi/model/problem_details.h b/lib/sbi/openapi/model/problem_details.h index 82a5f1a05..03ba9f569 100644 --- a/lib/sbi/openapi/model/problem_details.h +++ b/lib/sbi/openapi/model/problem_details.h @@ -28,6 +28,7 @@ typedef struct OpenAPI_problem_details_s { char *cause; OpenAPI_list_t *invalid_params; char *supported_features; + char *target_scp; } OpenAPI_problem_details_t; OpenAPI_problem_details_t *OpenAPI_problem_details_create( @@ -38,7 +39,8 @@ OpenAPI_problem_details_t *OpenAPI_problem_details_create( char *instance, char *cause, OpenAPI_list_t *invalid_params, - char *supported_features + char *supported_features, + char *target_scp ); void OpenAPI_problem_details_free(OpenAPI_problem_details_t *problem_details); OpenAPI_problem_details_t *OpenAPI_problem_details_parseFromJSON(cJSON *problem_detailsJSON); diff --git a/lib/sbi/openapi/model/problem_details_2.c b/lib/sbi/openapi/model/problem_details_2.c index b6266cc9f..11bb53dbb 100644 --- a/lib/sbi/openapi/model/problem_details_2.c +++ b/lib/sbi/openapi/model/problem_details_2.c @@ -12,7 +12,8 @@ OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_create( char *instance, char *cause, OpenAPI_list_t *invalid_params, - char *supported_features + char *supported_features, + char *target_scp ) { OpenAPI_problem_details_2_t *problem_details_2_local_var = OpenAPI_malloc(sizeof(OpenAPI_problem_details_2_t)); @@ -27,6 +28,7 @@ OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_create( problem_details_2_local_var->cause = cause; problem_details_2_local_var->invalid_params = invalid_params; problem_details_2_local_var->supported_features = supported_features; + problem_details_2_local_var->target_scp = target_scp; return problem_details_2_local_var; } @@ -47,6 +49,7 @@ void OpenAPI_problem_details_2_free(OpenAPI_problem_details_2_t *problem_details } OpenAPI_list_free(problem_details_2->invalid_params); ogs_free(problem_details_2->supported_features); + ogs_free(problem_details_2->target_scp); ogs_free(problem_details_2); } @@ -129,6 +132,13 @@ cJSON *OpenAPI_problem_details_2_convertToJSON(OpenAPI_problem_details_2_t *prob } } + if (problem_details_2->target_scp) { + if (cJSON_AddStringToObject(item, "targetScp", problem_details_2->target_scp) == NULL) { + ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [target_scp]"); + goto end; + } + } + end: return item; } @@ -222,6 +232,15 @@ OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_parseFromJSON(cJSON *prob } } + cJSON *target_scp = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "targetScp"); + + if (target_scp) { + if (!cJSON_IsString(target_scp)) { + ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [target_scp]"); + goto end; + } + } + problem_details_2_local_var = OpenAPI_problem_details_2_create ( type ? ogs_strdup(type->valuestring) : NULL, title ? ogs_strdup(title->valuestring) : NULL, @@ -230,7 +249,8 @@ OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_parseFromJSON(cJSON *prob instance ? ogs_strdup(instance->valuestring) : NULL, cause ? ogs_strdup(cause->valuestring) : NULL, invalid_params ? invalid_paramsList : NULL, - supported_features ? ogs_strdup(supported_features->valuestring) : NULL + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + target_scp ? ogs_strdup(target_scp->valuestring) : NULL ); return problem_details_2_local_var; diff --git a/lib/sbi/openapi/model/problem_details_2.h b/lib/sbi/openapi/model/problem_details_2.h index 0585776f2..a1a56520e 100644 --- a/lib/sbi/openapi/model/problem_details_2.h +++ b/lib/sbi/openapi/model/problem_details_2.h @@ -28,6 +28,7 @@ typedef struct OpenAPI_problem_details_2_s { char *cause; OpenAPI_list_t *invalid_params; char *supported_features; + char *target_scp; } OpenAPI_problem_details_2_t; OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_create( @@ -38,7 +39,8 @@ OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_create( char *instance, char *cause, OpenAPI_list_t *invalid_params, - char *supported_features + char *supported_features, + char *target_scp ); void OpenAPI_problem_details_2_free(OpenAPI_problem_details_2_t *problem_details_2); OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_parseFromJSON(cJSON *problem_details_2JSON); diff --git a/lib/sbi/openapi/model/problem_details_add_info.c b/lib/sbi/openapi/model/problem_details_add_info.c new file mode 100644 index 000000000..749104528 --- /dev/null +++ b/lib/sbi/openapi/model/problem_details_add_info.c @@ -0,0 +1,104 @@ + +#include +#include +#include +#include "problem_details_add_info.h" + +OpenAPI_problem_details_add_info_t *OpenAPI_problem_details_add_info_create( + int remote_error + ) +{ + OpenAPI_problem_details_add_info_t *problem_details_add_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_problem_details_add_info_t)); + if (!problem_details_add_info_local_var) { + return NULL; + } + problem_details_add_info_local_var->remote_error = remote_error; + + return problem_details_add_info_local_var; +} + +void OpenAPI_problem_details_add_info_free(OpenAPI_problem_details_add_info_t *problem_details_add_info) +{ + if (NULL == problem_details_add_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(problem_details_add_info); +} + +cJSON *OpenAPI_problem_details_add_info_convertToJSON(OpenAPI_problem_details_add_info_t *problem_details_add_info) +{ + cJSON *item = NULL; + + if (problem_details_add_info == NULL) { + ogs_error("OpenAPI_problem_details_add_info_convertToJSON() failed [ProblemDetailsAddInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (problem_details_add_info->remote_error) { + if (cJSON_AddBoolToObject(item, "remoteError", problem_details_add_info->remote_error) == NULL) { + ogs_error("OpenAPI_problem_details_add_info_convertToJSON() failed [remote_error]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_problem_details_add_info_t *OpenAPI_problem_details_add_info_parseFromJSON(cJSON *problem_details_add_infoJSON) +{ + OpenAPI_problem_details_add_info_t *problem_details_add_info_local_var = NULL; + cJSON *remote_error = cJSON_GetObjectItemCaseSensitive(problem_details_add_infoJSON, "remoteError"); + + if (remote_error) { + if (!cJSON_IsBool(remote_error)) { + ogs_error("OpenAPI_problem_details_add_info_parseFromJSON() failed [remote_error]"); + goto end; + } + } + + problem_details_add_info_local_var = OpenAPI_problem_details_add_info_create ( + remote_error ? remote_error->valueint : 0 + ); + + return problem_details_add_info_local_var; +end: + return NULL; +} + +OpenAPI_problem_details_add_info_t *OpenAPI_problem_details_add_info_copy(OpenAPI_problem_details_add_info_t *dst, OpenAPI_problem_details_add_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_problem_details_add_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_problem_details_add_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_problem_details_add_info_free(dst); + dst = OpenAPI_problem_details_add_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/problem_details_add_info.h b/lib/sbi/openapi/model/problem_details_add_info.h new file mode 100644 index 000000000..93e9157e0 --- /dev/null +++ b/lib/sbi/openapi/model/problem_details_add_info.h @@ -0,0 +1,38 @@ +/* + * problem_details_add_info.h + * + * + */ + +#ifndef _OpenAPI_problem_details_add_info_H_ +#define _OpenAPI_problem_details_add_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_problem_details_add_info_s OpenAPI_problem_details_add_info_t; +typedef struct OpenAPI_problem_details_add_info_s { + int remote_error; +} OpenAPI_problem_details_add_info_t; + +OpenAPI_problem_details_add_info_t *OpenAPI_problem_details_add_info_create( + int remote_error + ); +void OpenAPI_problem_details_add_info_free(OpenAPI_problem_details_add_info_t *problem_details_add_info); +OpenAPI_problem_details_add_info_t *OpenAPI_problem_details_add_info_parseFromJSON(cJSON *problem_details_add_infoJSON); +cJSON *OpenAPI_problem_details_add_info_convertToJSON(OpenAPI_problem_details_add_info_t *problem_details_add_info); +OpenAPI_problem_details_add_info_t *OpenAPI_problem_details_add_info_copy(OpenAPI_problem_details_add_info_t *dst, OpenAPI_problem_details_add_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_problem_details_add_info_H_ */ + diff --git a/lib/sbi/openapi/model/protection_result.c b/lib/sbi/openapi/model/protection_result.c new file mode 100644 index 000000000..fa7d7a032 --- /dev/null +++ b/lib/sbi/openapi/model/protection_result.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "protection_result.h" + +char* OpenAPI_protection_result_ToString(OpenAPI_protection_result_e protection_result) +{ + const char *protection_resultArray[] = { "NULL", "PERFORMED", "NOT_PERFORMED" }; + size_t sizeofArray = sizeof(protection_resultArray) / sizeof(protection_resultArray[0]); + if (protection_result < sizeofArray) + return (char *)protection_resultArray[protection_result]; + else + return (char *)"Unknown"; +} + +OpenAPI_protection_result_e OpenAPI_protection_result_FromString(char* protection_result) +{ + int stringToReturn = 0; + const char *protection_resultArray[] = { "NULL", "PERFORMED", "NOT_PERFORMED" }; + size_t sizeofArray = sizeof(protection_resultArray) / sizeof(protection_resultArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(protection_result, protection_resultArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/protection_result.h b/lib/sbi/openapi/model/protection_result.h new file mode 100644 index 000000000..fd344eb1a --- /dev/null +++ b/lib/sbi/openapi/model/protection_result.h @@ -0,0 +1,31 @@ +/* + * protection_result.h + * + * + */ + +#ifndef _OpenAPI_protection_result_H_ +#define _OpenAPI_protection_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_protection_result_NULL = 0, OpenAPI_protection_result_PERFORMED, OpenAPI_protection_result_NOT_PERFORMED } OpenAPI_protection_result_e; + +char* OpenAPI_protection_result_ToString(OpenAPI_protection_result_e protection_result); + +OpenAPI_protection_result_e OpenAPI_protection_result_FromString(char* protection_result); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_protection_result_H_ */ + diff --git a/lib/sbi/openapi/model/provisioned_data_sets.c b/lib/sbi/openapi/model/provisioned_data_sets.c index 955761296..a24952a7b 100644 --- a/lib/sbi/openapi/model/provisioned_data_sets.c +++ b/lib/sbi/openapi/model/provisioned_data_sets.c @@ -12,7 +12,9 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, - OpenAPI_lcs_mo_data_t *lcs_mo_data + OpenAPI_lcs_mo_data_t *lcs_mo_data, + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_bca_data, + OpenAPI_v2x_subscription_data_t *v2x_data ) { OpenAPI_provisioned_data_sets_t *provisioned_data_sets_local_var = OpenAPI_malloc(sizeof(OpenAPI_provisioned_data_sets_t)); @@ -27,6 +29,8 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( provisioned_data_sets_local_var->sms_mng_data = sms_mng_data; provisioned_data_sets_local_var->lcs_privacy_data = lcs_privacy_data; provisioned_data_sets_local_var->lcs_mo_data = lcs_mo_data; + provisioned_data_sets_local_var->lcs_bca_data = lcs_bca_data; + provisioned_data_sets_local_var->v2x_data = v2x_data; return provisioned_data_sets_local_var; } @@ -48,6 +52,8 @@ void OpenAPI_provisioned_data_sets_free(OpenAPI_provisioned_data_sets_t *provisi OpenAPI_sms_management_subscription_data_free(provisioned_data_sets->sms_mng_data); OpenAPI_lcs_privacy_data_free(provisioned_data_sets->lcs_privacy_data); OpenAPI_lcs_mo_data_free(provisioned_data_sets->lcs_mo_data); + OpenAPI_lcs_broadcast_assistance_types_data_free(provisioned_data_sets->lcs_bca_data); + OpenAPI_v2x_subscription_data_free(provisioned_data_sets->v2x_data); ogs_free(provisioned_data_sets); } @@ -172,6 +178,32 @@ cJSON *OpenAPI_provisioned_data_sets_convertToJSON(OpenAPI_provisioned_data_sets } } + if (provisioned_data_sets->lcs_bca_data) { + cJSON *lcs_bca_data_local_JSON = OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(provisioned_data_sets->lcs_bca_data); + if (lcs_bca_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [lcs_bca_data]"); + goto end; + } + cJSON_AddItemToObject(item, "lcsBcaData", lcs_bca_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [lcs_bca_data]"); + goto end; + } + } + + if (provisioned_data_sets->v2x_data) { + cJSON *v2x_data_local_JSON = OpenAPI_v2x_subscription_data_convertToJSON(provisioned_data_sets->v2x_data); + if (v2x_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [v2x_data]"); + goto end; + } + cJSON_AddItemToObject(item, "v2xData", v2x_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [v2x_data]"); + goto end; + } + } + end: return item; } @@ -251,6 +283,20 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJS lcs_mo_data_local_nonprim = OpenAPI_lcs_mo_data_parseFromJSON(lcs_mo_data); } + cJSON *lcs_bca_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "lcsBcaData"); + + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_bca_data_local_nonprim = NULL; + if (lcs_bca_data) { + lcs_bca_data_local_nonprim = OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(lcs_bca_data); + } + + cJSON *v2x_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "v2xData"); + + OpenAPI_v2x_subscription_data_t *v2x_data_local_nonprim = NULL; + if (v2x_data) { + v2x_data_local_nonprim = OpenAPI_v2x_subscription_data_parseFromJSON(v2x_data); + } + provisioned_data_sets_local_var = OpenAPI_provisioned_data_sets_create ( am_data ? am_data_local_nonprim : NULL, smf_sel_data ? smf_sel_data_local_nonprim : NULL, @@ -259,7 +305,9 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJS trace_data ? trace_data_local_nonprim : NULL, sms_mng_data ? sms_mng_data_local_nonprim : NULL, lcs_privacy_data ? lcs_privacy_data_local_nonprim : NULL, - lcs_mo_data ? lcs_mo_data_local_nonprim : NULL + lcs_mo_data ? lcs_mo_data_local_nonprim : NULL, + lcs_bca_data ? lcs_bca_data_local_nonprim : NULL, + v2x_data ? v2x_data_local_nonprim : NULL ); return provisioned_data_sets_local_var; diff --git a/lib/sbi/openapi/model/provisioned_data_sets.h b/lib/sbi/openapi/model/provisioned_data_sets.h index af779edf5..4f7df75f5 100644 --- a/lib/sbi/openapi/model/provisioned_data_sets.h +++ b/lib/sbi/openapi/model/provisioned_data_sets.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "access_and_mobility_subscription_data.h" +#include "lcs_broadcast_assistance_types_data.h" #include "lcs_mo_data.h" #include "lcs_privacy_data.h" #include "session_management_subscription_data.h" @@ -20,6 +21,7 @@ #include "sms_management_subscription_data.h" #include "sms_subscription_data.h" #include "trace_data.h" +#include "v2x_subscription_data.h" #ifdef __cplusplus extern "C" { @@ -35,6 +37,8 @@ typedef struct OpenAPI_provisioned_data_sets_s { struct OpenAPI_sms_management_subscription_data_s *sms_mng_data; struct OpenAPI_lcs_privacy_data_s *lcs_privacy_data; struct OpenAPI_lcs_mo_data_s *lcs_mo_data; + struct OpenAPI_lcs_broadcast_assistance_types_data_s *lcs_bca_data; + struct OpenAPI_v2x_subscription_data_s *v2x_data; } OpenAPI_provisioned_data_sets_t; OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( @@ -45,7 +49,9 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, - OpenAPI_lcs_mo_data_t *lcs_mo_data + OpenAPI_lcs_mo_data_t *lcs_mo_data, + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_bca_data, + OpenAPI_v2x_subscription_data_t *v2x_data ); void OpenAPI_provisioned_data_sets_free(OpenAPI_provisioned_data_sets_t *provisioned_data_sets); OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJSON *provisioned_data_setsJSON); diff --git a/lib/sbi/openapi/model/qos_flow_item.c b/lib/sbi/openapi/model/qos_flow_item.c index 3ed66eff1..71472d294 100644 --- a/lib/sbi/openapi/model/qos_flow_item.c +++ b/lib/sbi/openapi/model/qos_flow_item.c @@ -6,7 +6,9 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( int qfi, - OpenAPI_cause_e cause + OpenAPI_cause_e cause, + int current_qos_profile_index, + int null_qo_s_profile_index ) { OpenAPI_qos_flow_item_t *qos_flow_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_item_t)); @@ -15,6 +17,8 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( } qos_flow_item_local_var->qfi = qfi; qos_flow_item_local_var->cause = cause; + qos_flow_item_local_var->current_qos_profile_index = current_qos_profile_index; + qos_flow_item_local_var->null_qo_s_profile_index = null_qo_s_profile_index; return qos_flow_item_local_var; } @@ -54,6 +58,20 @@ cJSON *OpenAPI_qos_flow_item_convertToJSON(OpenAPI_qos_flow_item_t *qos_flow_ite } } + if (qos_flow_item->current_qos_profile_index) { + if (cJSON_AddNumberToObject(item, "currentQosProfileIndex", qos_flow_item->current_qos_profile_index) == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [current_qos_profile_index]"); + goto end; + } + } + + if (qos_flow_item->null_qo_s_profile_index) { + if (cJSON_AddBoolToObject(item, "nullQoSProfileIndex", qos_flow_item->null_qo_s_profile_index) == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [null_qo_s_profile_index]"); + goto end; + } + } + end: return item; } @@ -84,9 +102,29 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_ite causeVariable = OpenAPI_cause_FromString(cause->valuestring); } + cJSON *current_qos_profile_index = cJSON_GetObjectItemCaseSensitive(qos_flow_itemJSON, "currentQosProfileIndex"); + + if (current_qos_profile_index) { + if (!cJSON_IsNumber(current_qos_profile_index)) { + ogs_error("OpenAPI_qos_flow_item_parseFromJSON() failed [current_qos_profile_index]"); + goto end; + } + } + + cJSON *null_qo_s_profile_index = cJSON_GetObjectItemCaseSensitive(qos_flow_itemJSON, "nullQoSProfileIndex"); + + if (null_qo_s_profile_index) { + if (!cJSON_IsBool(null_qo_s_profile_index)) { + ogs_error("OpenAPI_qos_flow_item_parseFromJSON() failed [null_qo_s_profile_index]"); + goto end; + } + } + qos_flow_item_local_var = OpenAPI_qos_flow_item_create ( qfi->valuedouble, - cause ? causeVariable : 0 + cause ? causeVariable : 0, + current_qos_profile_index ? current_qos_profile_index->valuedouble : 0, + null_qo_s_profile_index ? null_qo_s_profile_index->valueint : 0 ); return qos_flow_item_local_var; diff --git a/lib/sbi/openapi/model/qos_flow_item.h b/lib/sbi/openapi/model/qos_flow_item.h index f07427ac7..6d5eb3b0f 100644 --- a/lib/sbi/openapi/model/qos_flow_item.h +++ b/lib/sbi/openapi/model/qos_flow_item.h @@ -22,11 +22,15 @@ typedef struct OpenAPI_qos_flow_item_s OpenAPI_qos_flow_item_t; typedef struct OpenAPI_qos_flow_item_s { int qfi; OpenAPI_cause_e cause; + int current_qos_profile_index; + int null_qo_s_profile_index; } OpenAPI_qos_flow_item_t; OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( int qfi, - OpenAPI_cause_e cause + OpenAPI_cause_e cause, + int current_qos_profile_index, + int null_qo_s_profile_index ); void OpenAPI_qos_flow_item_free(OpenAPI_qos_flow_item_t *qos_flow_item); OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_itemJSON); diff --git a/lib/sbi/openapi/model/qos_flow_notify_item.c b/lib/sbi/openapi/model/qos_flow_notify_item.c index c64f13e03..aa8e5b0e3 100644 --- a/lib/sbi/openapi/model/qos_flow_notify_item.c +++ b/lib/sbi/openapi/model/qos_flow_notify_item.c @@ -6,7 +6,9 @@ OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_create( int qfi, - OpenAPI_notification_cause_e notification_cause + OpenAPI_notification_cause_e notification_cause, + int current_qos_profile_index, + int null_qo_s_profile_index ) { OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_notify_item_t)); @@ -15,6 +17,8 @@ OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_create( } qos_flow_notify_item_local_var->qfi = qfi; qos_flow_notify_item_local_var->notification_cause = notification_cause; + qos_flow_notify_item_local_var->current_qos_profile_index = current_qos_profile_index; + qos_flow_notify_item_local_var->null_qo_s_profile_index = null_qo_s_profile_index; return qos_flow_notify_item_local_var; } @@ -56,6 +60,20 @@ cJSON *OpenAPI_qos_flow_notify_item_convertToJSON(OpenAPI_qos_flow_notify_item_t goto end; } + if (qos_flow_notify_item->current_qos_profile_index) { + if (cJSON_AddNumberToObject(item, "currentQosProfileIndex", qos_flow_notify_item->current_qos_profile_index) == NULL) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [current_qos_profile_index]"); + goto end; + } + } + + if (qos_flow_notify_item->null_qo_s_profile_index) { + if (cJSON_AddBoolToObject(item, "nullQoSProfileIndex", qos_flow_notify_item->null_qo_s_profile_index) == NULL) { + ogs_error("OpenAPI_qos_flow_notify_item_convertToJSON() failed [null_qo_s_profile_index]"); + goto end; + } + } + end: return item; } @@ -89,9 +107,29 @@ OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_parseFromJSON(cJSON } notification_causeVariable = OpenAPI_notification_cause_FromString(notification_cause->valuestring); + cJSON *current_qos_profile_index = cJSON_GetObjectItemCaseSensitive(qos_flow_notify_itemJSON, "currentQosProfileIndex"); + + if (current_qos_profile_index) { + if (!cJSON_IsNumber(current_qos_profile_index)) { + ogs_error("OpenAPI_qos_flow_notify_item_parseFromJSON() failed [current_qos_profile_index]"); + goto end; + } + } + + cJSON *null_qo_s_profile_index = cJSON_GetObjectItemCaseSensitive(qos_flow_notify_itemJSON, "nullQoSProfileIndex"); + + if (null_qo_s_profile_index) { + if (!cJSON_IsBool(null_qo_s_profile_index)) { + ogs_error("OpenAPI_qos_flow_notify_item_parseFromJSON() failed [null_qo_s_profile_index]"); + goto end; + } + } + qos_flow_notify_item_local_var = OpenAPI_qos_flow_notify_item_create ( qfi->valuedouble, - notification_causeVariable + notification_causeVariable, + current_qos_profile_index ? current_qos_profile_index->valuedouble : 0, + null_qo_s_profile_index ? null_qo_s_profile_index->valueint : 0 ); return qos_flow_notify_item_local_var; diff --git a/lib/sbi/openapi/model/qos_flow_notify_item.h b/lib/sbi/openapi/model/qos_flow_notify_item.h index c08871560..8e1e26b6f 100644 --- a/lib/sbi/openapi/model/qos_flow_notify_item.h +++ b/lib/sbi/openapi/model/qos_flow_notify_item.h @@ -22,11 +22,15 @@ typedef struct OpenAPI_qos_flow_notify_item_s OpenAPI_qos_flow_notify_item_t; typedef struct OpenAPI_qos_flow_notify_item_s { int qfi; OpenAPI_notification_cause_e notification_cause; + int current_qos_profile_index; + int null_qo_s_profile_index; } OpenAPI_qos_flow_notify_item_t; OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_create( int qfi, - OpenAPI_notification_cause_e notification_cause + OpenAPI_notification_cause_e notification_cause, + int current_qos_profile_index, + int null_qo_s_profile_index ); void OpenAPI_qos_flow_notify_item_free(OpenAPI_qos_flow_notify_item_t *qos_flow_notify_item); OpenAPI_qos_flow_notify_item_t *OpenAPI_qos_flow_notify_item_parseFromJSON(cJSON *qos_flow_notify_itemJSON); diff --git a/lib/sbi/openapi/model/qos_flow_profile.c b/lib/sbi/openapi/model/qos_flow_profile.c index c2cc250bd..b4443c955 100644 --- a/lib/sbi/openapi/model/qos_flow_profile.c +++ b/lib/sbi/openapi/model/qos_flow_profile.c @@ -10,8 +10,10 @@ OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_create( OpenAPI_dynamic5_qi_t *dynamic5_qi, OpenAPI_arp_t *arp, OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_info, - OpenAPI_reflective_qo_s_attribute_t *rqa, - OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info + OpenAPI_reflective_qo_s_attribute_e rqa, + OpenAPI_additional_qos_flow_info_e additional_qos_flow_info, + OpenAPI_qos_monitoring_req_e qos_monitoring_req, + int qos_rep_period ) { OpenAPI_qos_flow_profile_t *qos_flow_profile_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_profile_t)); @@ -25,6 +27,8 @@ OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_create( qos_flow_profile_local_var->gbr_qos_flow_info = gbr_qos_flow_info; qos_flow_profile_local_var->rqa = rqa; qos_flow_profile_local_var->additional_qos_flow_info = additional_qos_flow_info; + qos_flow_profile_local_var->qos_monitoring_req = qos_monitoring_req; + qos_flow_profile_local_var->qos_rep_period = qos_rep_period; return qos_flow_profile_local_var; } @@ -39,8 +43,6 @@ void OpenAPI_qos_flow_profile_free(OpenAPI_qos_flow_profile_t *qos_flow_profile) OpenAPI_dynamic5_qi_free(qos_flow_profile->dynamic5_qi); OpenAPI_arp_free(qos_flow_profile->arp); OpenAPI_gbr_qos_flow_information_free(qos_flow_profile->gbr_qos_flow_info); - OpenAPI_reflective_qo_s_attribute_free(qos_flow_profile->rqa); - OpenAPI_additional_qos_flow_info_free(qos_flow_profile->additional_qos_flow_info); ogs_free(qos_flow_profile); } @@ -116,27 +118,29 @@ cJSON *OpenAPI_qos_flow_profile_convertToJSON(OpenAPI_qos_flow_profile_t *qos_fl } if (qos_flow_profile->rqa) { - cJSON *rqa_local_JSON = OpenAPI_reflective_qo_s_attribute_convertToJSON(qos_flow_profile->rqa); - if (rqa_local_JSON == NULL) { - ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [rqa]"); - goto end; - } - cJSON_AddItemToObject(item, "rqa", rqa_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "rqa", OpenAPI_reflective_qo_s_attribute_ToString(qos_flow_profile->rqa)) == NULL) { ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [rqa]"); goto end; } } if (qos_flow_profile->additional_qos_flow_info) { - cJSON *additional_qos_flow_info_local_JSON = OpenAPI_additional_qos_flow_info_convertToJSON(qos_flow_profile->additional_qos_flow_info); - if (additional_qos_flow_info_local_JSON == NULL) { + if (cJSON_AddStringToObject(item, "additionalQosFlowInfo", OpenAPI_additional_qos_flow_info_ToString(qos_flow_profile->additional_qos_flow_info)) == NULL) { ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [additional_qos_flow_info]"); goto end; } - cJSON_AddItemToObject(item, "additionalQosFlowInfo", additional_qos_flow_info_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [additional_qos_flow_info]"); + } + + if (qos_flow_profile->qos_monitoring_req) { + if (cJSON_AddStringToObject(item, "qosMonitoringReq", OpenAPI_qos_monitoring_req_ToString(qos_flow_profile->qos_monitoring_req)) == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [qos_monitoring_req]"); + goto end; + } + } + + if (qos_flow_profile->qos_rep_period) { + if (cJSON_AddNumberToObject(item, "qosRepPeriod", qos_flow_profile->qos_rep_period) == NULL) { + ogs_error("OpenAPI_qos_flow_profile_convertToJSON() failed [qos_rep_period]"); goto end; } } @@ -190,16 +194,44 @@ OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_parseFromJSON(cJSON *qos_fl cJSON *rqa = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "rqa"); - OpenAPI_reflective_qo_s_attribute_t *rqa_local_nonprim = NULL; + OpenAPI_reflective_qo_s_attribute_e rqaVariable; if (rqa) { - rqa_local_nonprim = OpenAPI_reflective_qo_s_attribute_parseFromJSON(rqa); + if (!cJSON_IsString(rqa)) { + ogs_error("OpenAPI_qos_flow_profile_parseFromJSON() failed [rqa]"); + goto end; + } + rqaVariable = OpenAPI_reflective_qo_s_attribute_FromString(rqa->valuestring); } cJSON *additional_qos_flow_info = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "additionalQosFlowInfo"); - OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_nonprim = NULL; + OpenAPI_additional_qos_flow_info_e additional_qos_flow_infoVariable; if (additional_qos_flow_info) { - additional_qos_flow_info_local_nonprim = OpenAPI_additional_qos_flow_info_parseFromJSON(additional_qos_flow_info); + if (!cJSON_IsString(additional_qos_flow_info)) { + ogs_error("OpenAPI_qos_flow_profile_parseFromJSON() failed [additional_qos_flow_info]"); + goto end; + } + additional_qos_flow_infoVariable = OpenAPI_additional_qos_flow_info_FromString(additional_qos_flow_info->valuestring); + } + + cJSON *qos_monitoring_req = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "qosMonitoringReq"); + + OpenAPI_qos_monitoring_req_e qos_monitoring_reqVariable; + if (qos_monitoring_req) { + if (!cJSON_IsString(qos_monitoring_req)) { + ogs_error("OpenAPI_qos_flow_profile_parseFromJSON() failed [qos_monitoring_req]"); + goto end; + } + qos_monitoring_reqVariable = OpenAPI_qos_monitoring_req_FromString(qos_monitoring_req->valuestring); + } + + cJSON *qos_rep_period = cJSON_GetObjectItemCaseSensitive(qos_flow_profileJSON, "qosRepPeriod"); + + if (qos_rep_period) { + if (!cJSON_IsNumber(qos_rep_period)) { + ogs_error("OpenAPI_qos_flow_profile_parseFromJSON() failed [qos_rep_period]"); + goto end; + } } qos_flow_profile_local_var = OpenAPI_qos_flow_profile_create ( @@ -208,8 +240,10 @@ OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_parseFromJSON(cJSON *qos_fl dynamic5_qi ? dynamic5_qi_local_nonprim : NULL, arp ? arp_local_nonprim : NULL, gbr_qos_flow_info ? gbr_qos_flow_info_local_nonprim : NULL, - rqa ? rqa_local_nonprim : NULL, - additional_qos_flow_info ? additional_qos_flow_info_local_nonprim : NULL + rqa ? rqaVariable : 0, + additional_qos_flow_info ? additional_qos_flow_infoVariable : 0, + qos_monitoring_req ? qos_monitoring_reqVariable : 0, + qos_rep_period ? qos_rep_period->valuedouble : 0 ); return qos_flow_profile_local_var; diff --git a/lib/sbi/openapi/model/qos_flow_profile.h b/lib/sbi/openapi/model/qos_flow_profile.h index 53c9e1be7..649e8845a 100644 --- a/lib/sbi/openapi/model/qos_flow_profile.h +++ b/lib/sbi/openapi/model/qos_flow_profile.h @@ -17,6 +17,7 @@ #include "dynamic5_qi.h" #include "gbr_qos_flow_information.h" #include "non_dynamic5_qi.h" +#include "qos_monitoring_req.h" #include "reflective_qo_s_attribute.h" #ifdef __cplusplus @@ -30,8 +31,10 @@ typedef struct OpenAPI_qos_flow_profile_s { struct OpenAPI_dynamic5_qi_s *dynamic5_qi; struct OpenAPI_arp_s *arp; struct OpenAPI_gbr_qos_flow_information_s *gbr_qos_flow_info; - struct OpenAPI_reflective_qo_s_attribute_s *rqa; - struct OpenAPI_additional_qos_flow_info_s *additional_qos_flow_info; + OpenAPI_reflective_qo_s_attribute_e rqa; + OpenAPI_additional_qos_flow_info_e additional_qos_flow_info; + OpenAPI_qos_monitoring_req_e qos_monitoring_req; + int qos_rep_period; } OpenAPI_qos_flow_profile_t; OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_create( @@ -40,8 +43,10 @@ OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_create( OpenAPI_dynamic5_qi_t *dynamic5_qi, OpenAPI_arp_t *arp, OpenAPI_gbr_qos_flow_information_t *gbr_qos_flow_info, - OpenAPI_reflective_qo_s_attribute_t *rqa, - OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info + OpenAPI_reflective_qo_s_attribute_e rqa, + OpenAPI_additional_qos_flow_info_e additional_qos_flow_info, + OpenAPI_qos_monitoring_req_e qos_monitoring_req, + int qos_rep_period ); void OpenAPI_qos_flow_profile_free(OpenAPI_qos_flow_profile_t *qos_flow_profile); OpenAPI_qos_flow_profile_t *OpenAPI_qos_flow_profile_parseFromJSON(cJSON *qos_flow_profileJSON); diff --git a/lib/sbi/openapi/model/qos_monitoring_info.c b/lib/sbi/openapi/model/qos_monitoring_info.c new file mode 100644 index 000000000..53423fcd4 --- /dev/null +++ b/lib/sbi/openapi/model/qos_monitoring_info.c @@ -0,0 +1,104 @@ + +#include +#include +#include +#include "qos_monitoring_info.h" + +OpenAPI_qos_monitoring_info_t *OpenAPI_qos_monitoring_info_create( + int qos_monitoring_ind + ) +{ + OpenAPI_qos_monitoring_info_t *qos_monitoring_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_monitoring_info_t)); + if (!qos_monitoring_info_local_var) { + return NULL; + } + qos_monitoring_info_local_var->qos_monitoring_ind = qos_monitoring_ind; + + return qos_monitoring_info_local_var; +} + +void OpenAPI_qos_monitoring_info_free(OpenAPI_qos_monitoring_info_t *qos_monitoring_info) +{ + if (NULL == qos_monitoring_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(qos_monitoring_info); +} + +cJSON *OpenAPI_qos_monitoring_info_convertToJSON(OpenAPI_qos_monitoring_info_t *qos_monitoring_info) +{ + cJSON *item = NULL; + + if (qos_monitoring_info == NULL) { + ogs_error("OpenAPI_qos_monitoring_info_convertToJSON() failed [QosMonitoringInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (qos_monitoring_info->qos_monitoring_ind) { + if (cJSON_AddBoolToObject(item, "qosMonitoringInd", qos_monitoring_info->qos_monitoring_ind) == NULL) { + ogs_error("OpenAPI_qos_monitoring_info_convertToJSON() failed [qos_monitoring_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_monitoring_info_t *OpenAPI_qos_monitoring_info_parseFromJSON(cJSON *qos_monitoring_infoJSON) +{ + OpenAPI_qos_monitoring_info_t *qos_monitoring_info_local_var = NULL; + cJSON *qos_monitoring_ind = cJSON_GetObjectItemCaseSensitive(qos_monitoring_infoJSON, "qosMonitoringInd"); + + if (qos_monitoring_ind) { + if (!cJSON_IsBool(qos_monitoring_ind)) { + ogs_error("OpenAPI_qos_monitoring_info_parseFromJSON() failed [qos_monitoring_ind]"); + goto end; + } + } + + qos_monitoring_info_local_var = OpenAPI_qos_monitoring_info_create ( + qos_monitoring_ind ? qos_monitoring_ind->valueint : 0 + ); + + return qos_monitoring_info_local_var; +end: + return NULL; +} + +OpenAPI_qos_monitoring_info_t *OpenAPI_qos_monitoring_info_copy(OpenAPI_qos_monitoring_info_t *dst, OpenAPI_qos_monitoring_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_monitoring_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_monitoring_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_qos_monitoring_info_free(dst); + dst = OpenAPI_qos_monitoring_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_monitoring_info.h b/lib/sbi/openapi/model/qos_monitoring_info.h new file mode 100644 index 000000000..d81fbf707 --- /dev/null +++ b/lib/sbi/openapi/model/qos_monitoring_info.h @@ -0,0 +1,38 @@ +/* + * qos_monitoring_info.h + * + * + */ + +#ifndef _OpenAPI_qos_monitoring_info_H_ +#define _OpenAPI_qos_monitoring_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_monitoring_info_s OpenAPI_qos_monitoring_info_t; +typedef struct OpenAPI_qos_monitoring_info_s { + int qos_monitoring_ind; +} OpenAPI_qos_monitoring_info_t; + +OpenAPI_qos_monitoring_info_t *OpenAPI_qos_monitoring_info_create( + int qos_monitoring_ind + ); +void OpenAPI_qos_monitoring_info_free(OpenAPI_qos_monitoring_info_t *qos_monitoring_info); +OpenAPI_qos_monitoring_info_t *OpenAPI_qos_monitoring_info_parseFromJSON(cJSON *qos_monitoring_infoJSON); +cJSON *OpenAPI_qos_monitoring_info_convertToJSON(OpenAPI_qos_monitoring_info_t *qos_monitoring_info); +OpenAPI_qos_monitoring_info_t *OpenAPI_qos_monitoring_info_copy(OpenAPI_qos_monitoring_info_t *dst, OpenAPI_qos_monitoring_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_monitoring_info_H_ */ + diff --git a/lib/sbi/openapi/model/qos_monitoring_req.c b/lib/sbi/openapi/model/qos_monitoring_req.c new file mode 100644 index 000000000..536c8dac4 --- /dev/null +++ b/lib/sbi/openapi/model/qos_monitoring_req.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "qos_monitoring_req.h" + +char* OpenAPI_qos_monitoring_req_ToString(OpenAPI_qos_monitoring_req_e qos_monitoring_req) +{ + const char *qos_monitoring_reqArray[] = { "NULL", "UL", "DL", "BOTH", "NONE" }; + size_t sizeofArray = sizeof(qos_monitoring_reqArray) / sizeof(qos_monitoring_reqArray[0]); + if (qos_monitoring_req < sizeofArray) + return (char *)qos_monitoring_reqArray[qos_monitoring_req]; + else + return (char *)"Unknown"; +} + +OpenAPI_qos_monitoring_req_e OpenAPI_qos_monitoring_req_FromString(char* qos_monitoring_req) +{ + int stringToReturn = 0; + const char *qos_monitoring_reqArray[] = { "NULL", "UL", "DL", "BOTH", "NONE" }; + size_t sizeofArray = sizeof(qos_monitoring_reqArray) / sizeof(qos_monitoring_reqArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(qos_monitoring_req, qos_monitoring_reqArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/qos_monitoring_req.h b/lib/sbi/openapi/model/qos_monitoring_req.h new file mode 100644 index 000000000..3e0554978 --- /dev/null +++ b/lib/sbi/openapi/model/qos_monitoring_req.h @@ -0,0 +1,31 @@ +/* + * qos_monitoring_req.h + * + * + */ + +#ifndef _OpenAPI_qos_monitoring_req_H_ +#define _OpenAPI_qos_monitoring_req_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_qos_monitoring_req_NULL = 0, OpenAPI_qos_monitoring_req_UL, OpenAPI_qos_monitoring_req_DL, OpenAPI_qos_monitoring_req_BOTH, OpenAPI_qos_monitoring_req_NONE } OpenAPI_qos_monitoring_req_e; + +char* OpenAPI_qos_monitoring_req_ToString(OpenAPI_qos_monitoring_req_e qos_monitoring_req); + +OpenAPI_qos_monitoring_req_e OpenAPI_qos_monitoring_req_FromString(char* qos_monitoring_req); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_monitoring_req_H_ */ + diff --git a/lib/sbi/openapi/model/rat_type.c b/lib/sbi/openapi/model/rat_type.c index a10172622..11421a670 100644 --- a/lib/sbi/openapi/model/rat_type.c +++ b/lib/sbi/openapi/model/rat_type.c @@ -6,7 +6,7 @@ char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type) { - const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_DSL", "WIRELINE_PON", "LTE_M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; + const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_BBF", "LTE_M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; size_t sizeofArray = sizeof(rat_typeArray) / sizeof(rat_typeArray[0]); if (rat_type < sizeofArray) return (char *)rat_typeArray[rat_type]; @@ -17,7 +17,7 @@ char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type) OpenAPI_rat_type_e OpenAPI_rat_type_FromString(char* rat_type) { int stringToReturn = 0; - const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_DSL", "WIRELINE_PON", "LTE_M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; + const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_BBF", "LTE_M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; size_t sizeofArray = sizeof(rat_typeArray) / sizeof(rat_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(rat_type, rat_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/rat_type.h b/lib/sbi/openapi/model/rat_type.h index 18d8cc6f9..ace126b9a 100644 --- a/lib/sbi/openapi/model/rat_type.h +++ b/lib/sbi/openapi/model/rat_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_rat_type_NULL = 0, OpenAPI_rat_type_NR, OpenAPI_rat_type_EUTRA, OpenAPI_rat_type_WLAN, OpenAPI_rat_type_VIRTUAL, OpenAPI_rat_type_NBIOT, OpenAPI_rat_type_WIRELINE, OpenAPI_rat_type_WIRELINE_CABLE, OpenAPI_rat_type_WIRELINE_DSL, OpenAPI_rat_type_WIRELINE_PON, OpenAPI_rat_type_LTE_M, OpenAPI_rat_type_NR_U, OpenAPI_rat_type_EUTRA_U, OpenAPI_rat_type_TRUSTED_N3GA, OpenAPI_rat_type_TRUSTED_WLAN, OpenAPI_rat_type_UTRA, OpenAPI_rat_type_GERA } OpenAPI_rat_type_e; +typedef enum { OpenAPI_rat_type_NULL = 0, OpenAPI_rat_type_NR, OpenAPI_rat_type_EUTRA, OpenAPI_rat_type_WLAN, OpenAPI_rat_type_VIRTUAL, OpenAPI_rat_type_NBIOT, OpenAPI_rat_type_WIRELINE, OpenAPI_rat_type_WIRELINE_CABLE, OpenAPI_rat_type_WIRELINE_BBF, OpenAPI_rat_type_LTE_M, OpenAPI_rat_type_NR_U, OpenAPI_rat_type_EUTRA_U, OpenAPI_rat_type_TRUSTED_N3GA, OpenAPI_rat_type_TRUSTED_WLAN, OpenAPI_rat_type_UTRA, OpenAPI_rat_type_GERA } OpenAPI_rat_type_e; char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type); diff --git a/lib/sbi/openapi/model/reachability_for_sms_configuration.c b/lib/sbi/openapi/model/reachability_for_sms_configuration.c new file mode 100644 index 000000000..8e1de9935 --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_sms_configuration.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "reachability_for_sms_configuration.h" + +OpenAPI_reachability_for_sms_configuration_t *OpenAPI_reachability_for_sms_configuration_create( + ) +{ + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_configuration_local_var = OpenAPI_malloc(sizeof(OpenAPI_reachability_for_sms_configuration_t)); + if (!reachability_for_sms_configuration_local_var) { + return NULL; + } + + return reachability_for_sms_configuration_local_var; +} + +void OpenAPI_reachability_for_sms_configuration_free(OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_configuration) +{ + if (NULL == reachability_for_sms_configuration) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(reachability_for_sms_configuration); +} + +cJSON *OpenAPI_reachability_for_sms_configuration_convertToJSON(OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_configuration) +{ + cJSON *item = NULL; + + if (reachability_for_sms_configuration == NULL) { + ogs_error("OpenAPI_reachability_for_sms_configuration_convertToJSON() failed [ReachabilityForSmsConfiguration]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_reachability_for_sms_configuration_t *OpenAPI_reachability_for_sms_configuration_parseFromJSON(cJSON *reachability_for_sms_configurationJSON) +{ + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_configuration_local_var = NULL; + reachability_for_sms_configuration_local_var = OpenAPI_reachability_for_sms_configuration_create ( + ); + + return reachability_for_sms_configuration_local_var; +end: + return NULL; +} + +OpenAPI_reachability_for_sms_configuration_t *OpenAPI_reachability_for_sms_configuration_copy(OpenAPI_reachability_for_sms_configuration_t *dst, OpenAPI_reachability_for_sms_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reachability_for_sms_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reachability_for_sms_configuration_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_reachability_for_sms_configuration_free(dst); + dst = OpenAPI_reachability_for_sms_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reachability_for_sms_configuration.h b/lib/sbi/openapi/model/reachability_for_sms_configuration.h new file mode 100644 index 000000000..4ab9a4d52 --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_sms_configuration.h @@ -0,0 +1,36 @@ +/* + * reachability_for_sms_configuration.h + * + * + */ + +#ifndef _OpenAPI_reachability_for_sms_configuration_H_ +#define _OpenAPI_reachability_for_sms_configuration_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_reachability_for_sms_configuration_s OpenAPI_reachability_for_sms_configuration_t; +typedef struct OpenAPI_reachability_for_sms_configuration_s { +} OpenAPI_reachability_for_sms_configuration_t; + +OpenAPI_reachability_for_sms_configuration_t *OpenAPI_reachability_for_sms_configuration_create( + ); +void OpenAPI_reachability_for_sms_configuration_free(OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_configuration); +OpenAPI_reachability_for_sms_configuration_t *OpenAPI_reachability_for_sms_configuration_parseFromJSON(cJSON *reachability_for_sms_configurationJSON); +cJSON *OpenAPI_reachability_for_sms_configuration_convertToJSON(OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_configuration); +OpenAPI_reachability_for_sms_configuration_t *OpenAPI_reachability_for_sms_configuration_copy(OpenAPI_reachability_for_sms_configuration_t *dst, OpenAPI_reachability_for_sms_configuration_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reachability_for_sms_configuration_H_ */ + diff --git a/lib/sbi/openapi/model/reflective_qo_s_attribute.c b/lib/sbi/openapi/model/reflective_qo_s_attribute.c index 1834461a2..5e0376cf9 100644 --- a/lib/sbi/openapi/model/reflective_qo_s_attribute.c +++ b/lib/sbi/openapi/model/reflective_qo_s_attribute.c @@ -4,82 +4,27 @@ #include #include "reflective_qo_s_attribute.h" -OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_create( - ) +char* OpenAPI_reflective_qo_s_attribute_ToString(OpenAPI_reflective_qo_s_attribute_e reflective_qo_s_attribute) { - OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute_local_var = OpenAPI_malloc(sizeof(OpenAPI_reflective_qo_s_attribute_t)); - if (!reflective_qo_s_attribute_local_var) { - return NULL; - } - - return reflective_qo_s_attribute_local_var; + const char *reflective_qo_s_attributeArray[] = { "NULL", "RQOS", "NO_RQOS" }; + size_t sizeofArray = sizeof(reflective_qo_s_attributeArray) / sizeof(reflective_qo_s_attributeArray[0]); + if (reflective_qo_s_attribute < sizeofArray) + return (char *)reflective_qo_s_attributeArray[reflective_qo_s_attribute]; + else + return (char *)"Unknown"; } -void OpenAPI_reflective_qo_s_attribute_free(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute) +OpenAPI_reflective_qo_s_attribute_e OpenAPI_reflective_qo_s_attribute_FromString(char* reflective_qo_s_attribute) { - if (NULL == reflective_qo_s_attribute) { - return; + int stringToReturn = 0; + const char *reflective_qo_s_attributeArray[] = { "NULL", "RQOS", "NO_RQOS" }; + size_t sizeofArray = sizeof(reflective_qo_s_attributeArray) / sizeof(reflective_qo_s_attributeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(reflective_qo_s_attribute, reflective_qo_s_attributeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(reflective_qo_s_attribute); -} - -cJSON *OpenAPI_reflective_qo_s_attribute_convertToJSON(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute) -{ - cJSON *item = NULL; - - if (reflective_qo_s_attribute == NULL) { - ogs_error("OpenAPI_reflective_qo_s_attribute_convertToJSON() failed [ReflectiveQoSAttribute]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_parseFromJSON(cJSON *reflective_qo_s_attributeJSON) -{ - OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute_local_var = NULL; - reflective_qo_s_attribute_local_var = OpenAPI_reflective_qo_s_attribute_create ( - ); - - return reflective_qo_s_attribute_local_var; -end: - return NULL; -} - -OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_copy(OpenAPI_reflective_qo_s_attribute_t *dst, OpenAPI_reflective_qo_s_attribute_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_reflective_qo_s_attribute_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_reflective_qo_s_attribute_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_reflective_qo_s_attribute_free(dst); - dst = OpenAPI_reflective_qo_s_attribute_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/reflective_qo_s_attribute.h b/lib/sbi/openapi/model/reflective_qo_s_attribute.h index 970fffdd5..c2b74a7e9 100644 --- a/lib/sbi/openapi/model/reflective_qo_s_attribute.h +++ b/lib/sbi/openapi/model/reflective_qo_s_attribute.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_reflective_qo_s_attribute_s OpenAPI_reflective_qo_s_attribute_t; -typedef struct OpenAPI_reflective_qo_s_attribute_s { -} OpenAPI_reflective_qo_s_attribute_t; +typedef enum { OpenAPI_reflective_qo_s_attribute_NULL = 0, OpenAPI_reflective_qo_s_attribute_RQOS, OpenAPI_reflective_qo_s_attribute_NO_RQOS } OpenAPI_reflective_qo_s_attribute_e; -OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_create( - ); -void OpenAPI_reflective_qo_s_attribute_free(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute); -OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_parseFromJSON(cJSON *reflective_qo_s_attributeJSON); -cJSON *OpenAPI_reflective_qo_s_attribute_convertToJSON(OpenAPI_reflective_qo_s_attribute_t *reflective_qo_s_attribute); -OpenAPI_reflective_qo_s_attribute_t *OpenAPI_reflective_qo_s_attribute_copy(OpenAPI_reflective_qo_s_attribute_t *dst, OpenAPI_reflective_qo_s_attribute_t *src); +char* OpenAPI_reflective_qo_s_attribute_ToString(OpenAPI_reflective_qo_s_attribute_e reflective_qo_s_attribute); + +OpenAPI_reflective_qo_s_attribute_e OpenAPI_reflective_qo_s_attribute_FromString(char* reflective_qo_s_attribute); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/registration_data_set_name.c b/lib/sbi/openapi/model/registration_data_set_name.c new file mode 100644 index 000000000..4f6a4e2ae --- /dev/null +++ b/lib/sbi/openapi/model/registration_data_set_name.c @@ -0,0 +1,85 @@ + +#include +#include +#include +#include "registration_data_set_name.h" + +OpenAPI_registration_data_set_name_t *OpenAPI_registration_data_set_name_create( + ) +{ + OpenAPI_registration_data_set_name_t *registration_data_set_name_local_var = OpenAPI_malloc(sizeof(OpenAPI_registration_data_set_name_t)); + if (!registration_data_set_name_local_var) { + return NULL; + } + + return registration_data_set_name_local_var; +} + +void OpenAPI_registration_data_set_name_free(OpenAPI_registration_data_set_name_t *registration_data_set_name) +{ + if (NULL == registration_data_set_name) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(registration_data_set_name); +} + +cJSON *OpenAPI_registration_data_set_name_convertToJSON(OpenAPI_registration_data_set_name_t *registration_data_set_name) +{ + cJSON *item = NULL; + + if (registration_data_set_name == NULL) { + ogs_error("OpenAPI_registration_data_set_name_convertToJSON() failed [RegistrationDataSetName]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_registration_data_set_name_t *OpenAPI_registration_data_set_name_parseFromJSON(cJSON *registration_data_set_nameJSON) +{ + OpenAPI_registration_data_set_name_t *registration_data_set_name_local_var = NULL; + registration_data_set_name_local_var = OpenAPI_registration_data_set_name_create ( + ); + + return registration_data_set_name_local_var; +end: + return NULL; +} + +OpenAPI_registration_data_set_name_t *OpenAPI_registration_data_set_name_copy(OpenAPI_registration_data_set_name_t *dst, OpenAPI_registration_data_set_name_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_registration_data_set_name_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_registration_data_set_name_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_registration_data_set_name_free(dst); + dst = OpenAPI_registration_data_set_name_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/registration_data_set_name.h b/lib/sbi/openapi/model/registration_data_set_name.h new file mode 100644 index 000000000..31bd04b5a --- /dev/null +++ b/lib/sbi/openapi/model/registration_data_set_name.h @@ -0,0 +1,36 @@ +/* + * registration_data_set_name.h + * + * + */ + +#ifndef _OpenAPI_registration_data_set_name_H_ +#define _OpenAPI_registration_data_set_name_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_registration_data_set_name_s OpenAPI_registration_data_set_name_t; +typedef struct OpenAPI_registration_data_set_name_s { +} OpenAPI_registration_data_set_name_t; + +OpenAPI_registration_data_set_name_t *OpenAPI_registration_data_set_name_create( + ); +void OpenAPI_registration_data_set_name_free(OpenAPI_registration_data_set_name_t *registration_data_set_name); +OpenAPI_registration_data_set_name_t *OpenAPI_registration_data_set_name_parseFromJSON(cJSON *registration_data_set_nameJSON); +cJSON *OpenAPI_registration_data_set_name_convertToJSON(OpenAPI_registration_data_set_name_t *registration_data_set_name); +OpenAPI_registration_data_set_name_t *OpenAPI_registration_data_set_name_copy(OpenAPI_registration_data_set_name_t *dst, OpenAPI_registration_data_set_name_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_registration_data_set_name_H_ */ + diff --git a/lib/sbi/openapi/model/registration_data_sets.c b/lib/sbi/openapi/model/registration_data_sets.c new file mode 100644 index 000000000..3937246d5 --- /dev/null +++ b/lib/sbi/openapi/model/registration_data_sets.c @@ -0,0 +1,205 @@ + +#include +#include +#include +#include "registration_data_sets.h" + +OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_create( + OpenAPI_amf3_gpp_access_registration_t *amf3_gpp, + OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp, + OpenAPI_smf_registration_info_t *smf_registration, + OpenAPI_smsf_registration_t *smsf3_gpp, + OpenAPI_smsf_registration_t *smsf_non3_gpp + ) +{ + OpenAPI_registration_data_sets_t *registration_data_sets_local_var = OpenAPI_malloc(sizeof(OpenAPI_registration_data_sets_t)); + if (!registration_data_sets_local_var) { + return NULL; + } + registration_data_sets_local_var->amf3_gpp = amf3_gpp; + registration_data_sets_local_var->amf_non3_gpp = amf_non3_gpp; + registration_data_sets_local_var->smf_registration = smf_registration; + registration_data_sets_local_var->smsf3_gpp = smsf3_gpp; + registration_data_sets_local_var->smsf_non3_gpp = smsf_non3_gpp; + + return registration_data_sets_local_var; +} + +void OpenAPI_registration_data_sets_free(OpenAPI_registration_data_sets_t *registration_data_sets) +{ + if (NULL == registration_data_sets) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_amf3_gpp_access_registration_free(registration_data_sets->amf3_gpp); + OpenAPI_amf_non3_gpp_access_registration_free(registration_data_sets->amf_non3_gpp); + OpenAPI_smf_registration_info_free(registration_data_sets->smf_registration); + OpenAPI_smsf_registration_free(registration_data_sets->smsf3_gpp); + OpenAPI_smsf_registration_free(registration_data_sets->smsf_non3_gpp); + ogs_free(registration_data_sets); +} + +cJSON *OpenAPI_registration_data_sets_convertToJSON(OpenAPI_registration_data_sets_t *registration_data_sets) +{ + cJSON *item = NULL; + + if (registration_data_sets == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [RegistrationDataSets]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (registration_data_sets->amf3_gpp) { + cJSON *amf3_gpp_local_JSON = OpenAPI_amf3_gpp_access_registration_convertToJSON(registration_data_sets->amf3_gpp); + if (amf3_gpp_local_JSON == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [amf3_gpp]"); + goto end; + } + cJSON_AddItemToObject(item, "amf3Gpp", amf3_gpp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [amf3_gpp]"); + goto end; + } + } + + if (registration_data_sets->amf_non3_gpp) { + cJSON *amf_non3_gpp_local_JSON = OpenAPI_amf_non3_gpp_access_registration_convertToJSON(registration_data_sets->amf_non3_gpp); + if (amf_non3_gpp_local_JSON == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [amf_non3_gpp]"); + goto end; + } + cJSON_AddItemToObject(item, "amfNon3Gpp", amf_non3_gpp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [amf_non3_gpp]"); + goto end; + } + } + + if (registration_data_sets->smf_registration) { + cJSON *smf_registration_local_JSON = OpenAPI_smf_registration_info_convertToJSON(registration_data_sets->smf_registration); + if (smf_registration_local_JSON == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [smf_registration]"); + goto end; + } + cJSON_AddItemToObject(item, "smfRegistration", smf_registration_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [smf_registration]"); + goto end; + } + } + + if (registration_data_sets->smsf3_gpp) { + cJSON *smsf3_gpp_local_JSON = OpenAPI_smsf_registration_convertToJSON(registration_data_sets->smsf3_gpp); + if (smsf3_gpp_local_JSON == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [smsf3_gpp]"); + goto end; + } + cJSON_AddItemToObject(item, "smsf3Gpp", smsf3_gpp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [smsf3_gpp]"); + goto end; + } + } + + if (registration_data_sets->smsf_non3_gpp) { + cJSON *smsf_non3_gpp_local_JSON = OpenAPI_smsf_registration_convertToJSON(registration_data_sets->smsf_non3_gpp); + if (smsf_non3_gpp_local_JSON == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [smsf_non3_gpp]"); + goto end; + } + cJSON_AddItemToObject(item, "smsfNon3Gpp", smsf_non3_gpp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [smsf_non3_gpp]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_parseFromJSON(cJSON *registration_data_setsJSON) +{ + OpenAPI_registration_data_sets_t *registration_data_sets_local_var = NULL; + cJSON *amf3_gpp = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "amf3Gpp"); + + OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_local_nonprim = NULL; + if (amf3_gpp) { + amf3_gpp_local_nonprim = OpenAPI_amf3_gpp_access_registration_parseFromJSON(amf3_gpp); + } + + cJSON *amf_non3_gpp = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "amfNon3Gpp"); + + OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_local_nonprim = NULL; + if (amf_non3_gpp) { + amf_non3_gpp_local_nonprim = OpenAPI_amf_non3_gpp_access_registration_parseFromJSON(amf_non3_gpp); + } + + cJSON *smf_registration = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "smfRegistration"); + + OpenAPI_smf_registration_info_t *smf_registration_local_nonprim = NULL; + if (smf_registration) { + smf_registration_local_nonprim = OpenAPI_smf_registration_info_parseFromJSON(smf_registration); + } + + cJSON *smsf3_gpp = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "smsf3Gpp"); + + OpenAPI_smsf_registration_t *smsf3_gpp_local_nonprim = NULL; + if (smsf3_gpp) { + smsf3_gpp_local_nonprim = OpenAPI_smsf_registration_parseFromJSON(smsf3_gpp); + } + + cJSON *smsf_non3_gpp = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "smsfNon3Gpp"); + + OpenAPI_smsf_registration_t *smsf_non3_gpp_local_nonprim = NULL; + if (smsf_non3_gpp) { + smsf_non3_gpp_local_nonprim = OpenAPI_smsf_registration_parseFromJSON(smsf_non3_gpp); + } + + registration_data_sets_local_var = OpenAPI_registration_data_sets_create ( + amf3_gpp ? amf3_gpp_local_nonprim : NULL, + amf_non3_gpp ? amf_non3_gpp_local_nonprim : NULL, + smf_registration ? smf_registration_local_nonprim : NULL, + smsf3_gpp ? smsf3_gpp_local_nonprim : NULL, + smsf_non3_gpp ? smsf_non3_gpp_local_nonprim : NULL + ); + + return registration_data_sets_local_var; +end: + return NULL; +} + +OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_copy(OpenAPI_registration_data_sets_t *dst, OpenAPI_registration_data_sets_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_registration_data_sets_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_registration_data_sets_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_registration_data_sets_free(dst); + dst = OpenAPI_registration_data_sets_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/registration_data_sets.h b/lib/sbi/openapi/model/registration_data_sets.h new file mode 100644 index 000000000..4039a4328 --- /dev/null +++ b/lib/sbi/openapi/model/registration_data_sets.h @@ -0,0 +1,50 @@ +/* + * registration_data_sets.h + * + * + */ + +#ifndef _OpenAPI_registration_data_sets_H_ +#define _OpenAPI_registration_data_sets_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf3_gpp_access_registration.h" +#include "amf_non3_gpp_access_registration.h" +#include "smf_registration_info.h" +#include "smsf_registration.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_registration_data_sets_s OpenAPI_registration_data_sets_t; +typedef struct OpenAPI_registration_data_sets_s { + struct OpenAPI_amf3_gpp_access_registration_s *amf3_gpp; + struct OpenAPI_amf_non3_gpp_access_registration_s *amf_non3_gpp; + struct OpenAPI_smf_registration_info_s *smf_registration; + struct OpenAPI_smsf_registration_s *smsf3_gpp; + struct OpenAPI_smsf_registration_s *smsf_non3_gpp; +} OpenAPI_registration_data_sets_t; + +OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_create( + OpenAPI_amf3_gpp_access_registration_t *amf3_gpp, + OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp, + OpenAPI_smf_registration_info_t *smf_registration, + OpenAPI_smsf_registration_t *smsf3_gpp, + OpenAPI_smsf_registration_t *smsf_non3_gpp + ); +void OpenAPI_registration_data_sets_free(OpenAPI_registration_data_sets_t *registration_data_sets); +OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_parseFromJSON(cJSON *registration_data_setsJSON); +cJSON *OpenAPI_registration_data_sets_convertToJSON(OpenAPI_registration_data_sets_t *registration_data_sets); +OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_copy(OpenAPI_registration_data_sets_t *dst, OpenAPI_registration_data_sets_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_registration_data_sets_H_ */ + diff --git a/lib/sbi/openapi/model/registration_location_info.c b/lib/sbi/openapi/model/registration_location_info.c new file mode 100644 index 000000000..cbb66fd82 --- /dev/null +++ b/lib/sbi/openapi/model/registration_location_info.c @@ -0,0 +1,204 @@ + +#include +#include +#include +#include "registration_location_info.h" + +OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_create( + char *amf_instance_id, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_vgmlc_address_t *vgmlc_address, + OpenAPI_list_t *access_type_list + ) +{ + OpenAPI_registration_location_info_t *registration_location_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_registration_location_info_t)); + if (!registration_location_info_local_var) { + return NULL; + } + registration_location_info_local_var->amf_instance_id = amf_instance_id; + registration_location_info_local_var->plmn_id = plmn_id; + registration_location_info_local_var->vgmlc_address = vgmlc_address; + registration_location_info_local_var->access_type_list = access_type_list; + + return registration_location_info_local_var; +} + +void OpenAPI_registration_location_info_free(OpenAPI_registration_location_info_t *registration_location_info) +{ + if (NULL == registration_location_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(registration_location_info->amf_instance_id); + OpenAPI_plmn_id_free(registration_location_info->plmn_id); + OpenAPI_vgmlc_address_free(registration_location_info->vgmlc_address); + OpenAPI_list_free(registration_location_info->access_type_list); + ogs_free(registration_location_info); +} + +cJSON *OpenAPI_registration_location_info_convertToJSON(OpenAPI_registration_location_info_t *registration_location_info) +{ + cJSON *item = NULL; + + if (registration_location_info == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [RegistrationLocationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!registration_location_info->amf_instance_id) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [amf_instance_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "amfInstanceId", registration_location_info->amf_instance_id) == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [amf_instance_id]"); + goto end; + } + + if (registration_location_info->plmn_id) { + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(registration_location_info->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [plmn_id]"); + goto end; + } + } + + if (registration_location_info->vgmlc_address) { + cJSON *vgmlc_address_local_JSON = OpenAPI_vgmlc_address_convertToJSON(registration_location_info->vgmlc_address); + if (vgmlc_address_local_JSON == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [vgmlc_address]"); + goto end; + } + cJSON_AddItemToObject(item, "vgmlcAddress", vgmlc_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [vgmlc_address]"); + goto end; + } + } + + if (!registration_location_info->access_type_list) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [access_type_list]"); + goto end; + } + cJSON *access_type_list = cJSON_AddArrayToObject(item, "accessTypeList"); + if (access_type_list == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [access_type_list]"); + goto end; + } + OpenAPI_lnode_t *access_type_list_node; + OpenAPI_list_for_each(registration_location_info->access_type_list, access_type_list_node) { + if (cJSON_AddStringToObject(access_type_list, "", OpenAPI_access_type_ToString((OpenAPI_access_type_e)access_type_list_node->data)) == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [access_type_list]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_parseFromJSON(cJSON *registration_location_infoJSON) +{ + OpenAPI_registration_location_info_t *registration_location_info_local_var = NULL; + cJSON *amf_instance_id = cJSON_GetObjectItemCaseSensitive(registration_location_infoJSON, "amfInstanceId"); + if (!amf_instance_id) { + ogs_error("OpenAPI_registration_location_info_parseFromJSON() failed [amf_instance_id]"); + goto end; + } + + + if (!cJSON_IsString(amf_instance_id)) { + ogs_error("OpenAPI_registration_location_info_parseFromJSON() failed [amf_instance_id]"); + goto end; + } + + cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(registration_location_infoJSON, "plmnId"); + + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + if (plmn_id) { + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + } + + cJSON *vgmlc_address = cJSON_GetObjectItemCaseSensitive(registration_location_infoJSON, "vgmlcAddress"); + + OpenAPI_vgmlc_address_t *vgmlc_address_local_nonprim = NULL; + if (vgmlc_address) { + vgmlc_address_local_nonprim = OpenAPI_vgmlc_address_parseFromJSON(vgmlc_address); + } + + cJSON *access_type_list = cJSON_GetObjectItemCaseSensitive(registration_location_infoJSON, "accessTypeList"); + if (!access_type_list) { + ogs_error("OpenAPI_registration_location_info_parseFromJSON() failed [access_type_list]"); + goto end; + } + + OpenAPI_list_t *access_type_listList; + + cJSON *access_type_list_local_nonprimitive; + if (!cJSON_IsArray(access_type_list)) { + ogs_error("OpenAPI_registration_location_info_parseFromJSON() failed [access_type_list]"); + goto end; + } + + access_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(access_type_list_local_nonprimitive, access_type_list ) { + if (!cJSON_IsString(access_type_list_local_nonprimitive)) { + ogs_error("OpenAPI_registration_location_info_parseFromJSON() failed [access_type_list]"); + goto end; + } + + OpenAPI_list_add(access_type_listList, (void *)OpenAPI_access_type_FromString(access_type_list_local_nonprimitive->valuestring)); + } + + registration_location_info_local_var = OpenAPI_registration_location_info_create ( + ogs_strdup(amf_instance_id->valuestring), + plmn_id ? plmn_id_local_nonprim : NULL, + vgmlc_address ? vgmlc_address_local_nonprim : NULL, + access_type_listList + ); + + return registration_location_info_local_var; +end: + return NULL; +} + +OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_copy(OpenAPI_registration_location_info_t *dst, OpenAPI_registration_location_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_registration_location_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_registration_location_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_registration_location_info_free(dst); + dst = OpenAPI_registration_location_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/registration_location_info.h b/lib/sbi/openapi/model/registration_location_info.h new file mode 100644 index 000000000..7f200cdf8 --- /dev/null +++ b/lib/sbi/openapi/model/registration_location_info.h @@ -0,0 +1,47 @@ +/* + * registration_location_info.h + * + * + */ + +#ifndef _OpenAPI_registration_location_info_H_ +#define _OpenAPI_registration_location_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "plmn_id.h" +#include "vgmlc_address.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_registration_location_info_s OpenAPI_registration_location_info_t; +typedef struct OpenAPI_registration_location_info_s { + char *amf_instance_id; + struct OpenAPI_plmn_id_s *plmn_id; + struct OpenAPI_vgmlc_address_s *vgmlc_address; + OpenAPI_list_t *access_type_list; +} OpenAPI_registration_location_info_t; + +OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_create( + char *amf_instance_id, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_vgmlc_address_t *vgmlc_address, + OpenAPI_list_t *access_type_list + ); +void OpenAPI_registration_location_info_free(OpenAPI_registration_location_info_t *registration_location_info); +OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_parseFromJSON(cJSON *registration_location_infoJSON); +cJSON *OpenAPI_registration_location_info_convertToJSON(OpenAPI_registration_location_info_t *registration_location_info); +OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_copy(OpenAPI_registration_location_info_t *dst, OpenAPI_registration_location_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_registration_location_info_H_ */ + diff --git a/lib/sbi/openapi/model/release_data.c b/lib/sbi/openapi/model/release_data.c index caad5ef8d..f2792d37b 100644 --- a/lib/sbi/openapi/model/release_data.c +++ b/lib/sbi/openapi/model/release_data.c @@ -12,7 +12,10 @@ OpenAPI_release_data_t *OpenAPI_release_data_create( char *ue_time_zone, OpenAPI_user_location_t *add_ue_location, OpenAPI_list_t *secondary_rat_usage_report, - OpenAPI_list_t *secondary_rat_usage_info + OpenAPI_list_t *secondary_rat_usage_info, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 ) { OpenAPI_release_data_t *release_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_release_data_t)); @@ -27,6 +30,9 @@ OpenAPI_release_data_t *OpenAPI_release_data_create( release_data_local_var->add_ue_location = add_ue_location; release_data_local_var->secondary_rat_usage_report = secondary_rat_usage_report; release_data_local_var->secondary_rat_usage_info = secondary_rat_usage_info; + release_data_local_var->n4_info = n4_info; + release_data_local_var->n4_info_ext1 = n4_info_ext1; + release_data_local_var->n4_info_ext2 = n4_info_ext2; return release_data_local_var; } @@ -49,6 +55,9 @@ void OpenAPI_release_data_free(OpenAPI_release_data_t *release_data) OpenAPI_secondary_rat_usage_info_free(node->data); } OpenAPI_list_free(release_data->secondary_rat_usage_info); + OpenAPI_n4_information_free(release_data->n4_info); + OpenAPI_n4_information_free(release_data->n4_info_ext1); + OpenAPI_n4_information_free(release_data->n4_info_ext2); ogs_free(release_data); } @@ -162,6 +171,45 @@ cJSON *OpenAPI_release_data_convertToJSON(OpenAPI_release_data_t *release_data) } } + if (release_data->n4_info) { + cJSON *n4_info_local_JSON = OpenAPI_n4_information_convertToJSON(release_data->n4_info); + if (n4_info_local_JSON == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [n4_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4Info", n4_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [n4_info]"); + goto end; + } + } + + if (release_data->n4_info_ext1) { + cJSON *n4_info_ext1_local_JSON = OpenAPI_n4_information_convertToJSON(release_data->n4_info_ext1); + if (n4_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt1", n4_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + } + + if (release_data->n4_info_ext2) { + cJSON *n4_info_ext2_local_JSON = OpenAPI_n4_information_convertToJSON(release_data->n4_info_ext2); + if (n4_info_ext2_local_JSON == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt2", n4_info_ext2_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_release_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + } + end: return item; } @@ -265,6 +313,27 @@ OpenAPI_release_data_t *OpenAPI_release_data_parseFromJSON(cJSON *release_dataJS } } + cJSON *n4_info = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "n4Info"); + + OpenAPI_n4_information_t *n4_info_local_nonprim = NULL; + if (n4_info) { + n4_info_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info); + } + + cJSON *n4_info_ext1 = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "n4InfoExt1"); + + OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; + if (n4_info_ext1) { + n4_info_ext1_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext1); + } + + cJSON *n4_info_ext2 = cJSON_GetObjectItemCaseSensitive(release_dataJSON, "n4InfoExt2"); + + OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + if (n4_info_ext2) { + n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); + } + release_data_local_var = OpenAPI_release_data_create ( cause ? causeVariable : 0, ng_ap_cause ? ng_ap_cause_local_nonprim : NULL, @@ -273,7 +342,10 @@ OpenAPI_release_data_t *OpenAPI_release_data_parseFromJSON(cJSON *release_dataJS ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL, add_ue_location ? add_ue_location_local_nonprim : NULL, secondary_rat_usage_report ? secondary_rat_usage_reportList : NULL, - secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL + secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL, + n4_info ? n4_info_local_nonprim : NULL, + n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL ); return release_data_local_var; diff --git a/lib/sbi/openapi/model/release_data.h b/lib/sbi/openapi/model/release_data.h index bf49a4f9a..3cb17c39e 100644 --- a/lib/sbi/openapi/model/release_data.h +++ b/lib/sbi/openapi/model/release_data.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "cause.h" +#include "n4_information.h" #include "ng_ap_cause.h" #include "secondary_rat_usage_info.h" #include "secondary_rat_usage_report.h" @@ -32,6 +33,9 @@ typedef struct OpenAPI_release_data_s { struct OpenAPI_user_location_s *add_ue_location; OpenAPI_list_t *secondary_rat_usage_report; OpenAPI_list_t *secondary_rat_usage_info; + struct OpenAPI_n4_information_s *n4_info; + struct OpenAPI_n4_information_s *n4_info_ext1; + struct OpenAPI_n4_information_s *n4_info_ext2; } OpenAPI_release_data_t; OpenAPI_release_data_t *OpenAPI_release_data_create( @@ -42,7 +46,10 @@ OpenAPI_release_data_t *OpenAPI_release_data_create( char *ue_time_zone, OpenAPI_user_location_t *add_ue_location, OpenAPI_list_t *secondary_rat_usage_report, - OpenAPI_list_t *secondary_rat_usage_info + OpenAPI_list_t *secondary_rat_usage_info, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 ); void OpenAPI_release_data_free(OpenAPI_release_data_t *release_data); OpenAPI_release_data_t *OpenAPI_release_data_parseFromJSON(cJSON *release_dataJSON); diff --git a/lib/sbi/openapi/model/released_data.c b/lib/sbi/openapi/model/released_data.c index 06510abf5..44e9959b5 100644 --- a/lib/sbi/openapi/model/released_data.c +++ b/lib/sbi/openapi/model/released_data.c @@ -6,7 +6,10 @@ OpenAPI_released_data_t *OpenAPI_released_data_create( OpenAPI_small_data_rate_status_t *small_data_rate_status, - OpenAPI_apn_rate_status_t *apn_rate_status + OpenAPI_apn_rate_status_t *apn_rate_status, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 ) { OpenAPI_released_data_t *released_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_released_data_t)); @@ -15,6 +18,9 @@ OpenAPI_released_data_t *OpenAPI_released_data_create( } released_data_local_var->small_data_rate_status = small_data_rate_status; released_data_local_var->apn_rate_status = apn_rate_status; + released_data_local_var->n4_info = n4_info; + released_data_local_var->n4_info_ext1 = n4_info_ext1; + released_data_local_var->n4_info_ext2 = n4_info_ext2; return released_data_local_var; } @@ -27,6 +33,9 @@ void OpenAPI_released_data_free(OpenAPI_released_data_t *released_data) OpenAPI_lnode_t *node; OpenAPI_small_data_rate_status_free(released_data->small_data_rate_status); OpenAPI_apn_rate_status_free(released_data->apn_rate_status); + OpenAPI_n4_information_free(released_data->n4_info); + OpenAPI_n4_information_free(released_data->n4_info_ext1); + OpenAPI_n4_information_free(released_data->n4_info_ext2); ogs_free(released_data); } @@ -66,6 +75,45 @@ cJSON *OpenAPI_released_data_convertToJSON(OpenAPI_released_data_t *released_dat } } + if (released_data->n4_info) { + cJSON *n4_info_local_JSON = OpenAPI_n4_information_convertToJSON(released_data->n4_info); + if (n4_info_local_JSON == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [n4_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n4Info", n4_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [n4_info]"); + goto end; + } + } + + if (released_data->n4_info_ext1) { + cJSON *n4_info_ext1_local_JSON = OpenAPI_n4_information_convertToJSON(released_data->n4_info_ext1); + if (n4_info_ext1_local_JSON == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt1", n4_info_ext1_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [n4_info_ext1]"); + goto end; + } + } + + if (released_data->n4_info_ext2) { + cJSON *n4_info_ext2_local_JSON = OpenAPI_n4_information_convertToJSON(released_data->n4_info_ext2); + if (n4_info_ext2_local_JSON == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt2", n4_info_ext2_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_released_data_convertToJSON() failed [n4_info_ext2]"); + goto end; + } + } + end: return item; } @@ -87,9 +135,33 @@ OpenAPI_released_data_t *OpenAPI_released_data_parseFromJSON(cJSON *released_dat apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); } + cJSON *n4_info = cJSON_GetObjectItemCaseSensitive(released_dataJSON, "n4Info"); + + OpenAPI_n4_information_t *n4_info_local_nonprim = NULL; + if (n4_info) { + n4_info_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info); + } + + cJSON *n4_info_ext1 = cJSON_GetObjectItemCaseSensitive(released_dataJSON, "n4InfoExt1"); + + OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; + if (n4_info_ext1) { + n4_info_ext1_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext1); + } + + cJSON *n4_info_ext2 = cJSON_GetObjectItemCaseSensitive(released_dataJSON, "n4InfoExt2"); + + OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + if (n4_info_ext2) { + n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); + } + released_data_local_var = OpenAPI_released_data_create ( small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, - apn_rate_status ? apn_rate_status_local_nonprim : NULL + apn_rate_status ? apn_rate_status_local_nonprim : NULL, + n4_info ? n4_info_local_nonprim : NULL, + n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL ); return released_data_local_var; diff --git a/lib/sbi/openapi/model/released_data.h b/lib/sbi/openapi/model/released_data.h index c2e3945bd..21c5d2778 100644 --- a/lib/sbi/openapi/model/released_data.h +++ b/lib/sbi/openapi/model/released_data.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "apn_rate_status.h" +#include "n4_information.h" #include "small_data_rate_status.h" #ifdef __cplusplus @@ -23,11 +24,17 @@ typedef struct OpenAPI_released_data_s OpenAPI_released_data_t; typedef struct OpenAPI_released_data_s { struct OpenAPI_small_data_rate_status_s *small_data_rate_status; struct OpenAPI_apn_rate_status_s *apn_rate_status; + struct OpenAPI_n4_information_s *n4_info; + struct OpenAPI_n4_information_s *n4_info_ext1; + struct OpenAPI_n4_information_s *n4_info_ext2; } OpenAPI_released_data_t; OpenAPI_released_data_t *OpenAPI_released_data_create( OpenAPI_small_data_rate_status_t *small_data_rate_status, - OpenAPI_apn_rate_status_t *apn_rate_status + OpenAPI_apn_rate_status_t *apn_rate_status, + OpenAPI_n4_information_t *n4_info, + OpenAPI_n4_information_t *n4_info_ext1, + OpenAPI_n4_information_t *n4_info_ext2 ); void OpenAPI_released_data_free(OpenAPI_released_data_t *released_data); OpenAPI_released_data_t *OpenAPI_released_data_parseFromJSON(cJSON *released_dataJSON); diff --git a/lib/sbi/openapi/model/report_amount_mdt.c b/lib/sbi/openapi/model/report_amount_mdt.c new file mode 100644 index 000000000..6335c104b --- /dev/null +++ b/lib/sbi/openapi/model/report_amount_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "report_amount_mdt.h" + +char* OpenAPI_report_amount_mdt_ToString(OpenAPI_report_amount_mdt_e report_amount_mdt) +{ + const char *report_amount_mdtArray[] = { "NULL", "_1", "_2", "_4", "_8", "_16", "_32", "_64", "infinity" }; + size_t sizeofArray = sizeof(report_amount_mdtArray) / sizeof(report_amount_mdtArray[0]); + if (report_amount_mdt < sizeofArray) + return (char *)report_amount_mdtArray[report_amount_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_report_amount_mdt_e OpenAPI_report_amount_mdt_FromString(char* report_amount_mdt) +{ + int stringToReturn = 0; + const char *report_amount_mdtArray[] = { "NULL", "_1", "_2", "_4", "_8", "_16", "_32", "_64", "infinity" }; + size_t sizeofArray = sizeof(report_amount_mdtArray) / sizeof(report_amount_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(report_amount_mdt, report_amount_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/report_amount_mdt.h b/lib/sbi/openapi/model/report_amount_mdt.h new file mode 100644 index 000000000..c6306efea --- /dev/null +++ b/lib/sbi/openapi/model/report_amount_mdt.h @@ -0,0 +1,31 @@ +/* + * report_amount_mdt.h + * + * + */ + +#ifndef _OpenAPI_report_amount_mdt_H_ +#define _OpenAPI_report_amount_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_report_amount_mdt_NULL = 0, OpenAPI_report_amount_mdt__1, OpenAPI_report_amount_mdt__2, OpenAPI_report_amount_mdt__4, OpenAPI_report_amount_mdt__8, OpenAPI_report_amount_mdt__16, OpenAPI_report_amount_mdt__32, OpenAPI_report_amount_mdt__64, OpenAPI_report_amount_mdt_infinity } OpenAPI_report_amount_mdt_e; + +char* OpenAPI_report_amount_mdt_ToString(OpenAPI_report_amount_mdt_e report_amount_mdt); + +OpenAPI_report_amount_mdt_e OpenAPI_report_amount_mdt_FromString(char* report_amount_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_report_amount_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/report_interval_mdt.c b/lib/sbi/openapi/model/report_interval_mdt.c new file mode 100644 index 000000000..f82e99156 --- /dev/null +++ b/lib/sbi/openapi/model/report_interval_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "report_interval_mdt.h" + +char* OpenAPI_report_interval_mdt_ToString(OpenAPI_report_interval_mdt_e report_interval_mdt) +{ + const char *report_interval_mdtArray[] = { "NULL", "_120", "_240", "_480", "_640", "_1024", "_2048", "_5120", "_10240", "_60000", "_360000", "_720000", "_1800000", "_3600000" }; + size_t sizeofArray = sizeof(report_interval_mdtArray) / sizeof(report_interval_mdtArray[0]); + if (report_interval_mdt < sizeofArray) + return (char *)report_interval_mdtArray[report_interval_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_report_interval_mdt_e OpenAPI_report_interval_mdt_FromString(char* report_interval_mdt) +{ + int stringToReturn = 0; + const char *report_interval_mdtArray[] = { "NULL", "_120", "_240", "_480", "_640", "_1024", "_2048", "_5120", "_10240", "_60000", "_360000", "_720000", "_1800000", "_3600000" }; + size_t sizeofArray = sizeof(report_interval_mdtArray) / sizeof(report_interval_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(report_interval_mdt, report_interval_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/report_interval_mdt.h b/lib/sbi/openapi/model/report_interval_mdt.h new file mode 100644 index 000000000..c9a1601fe --- /dev/null +++ b/lib/sbi/openapi/model/report_interval_mdt.h @@ -0,0 +1,31 @@ +/* + * report_interval_mdt.h + * + * + */ + +#ifndef _OpenAPI_report_interval_mdt_H_ +#define _OpenAPI_report_interval_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_report_interval_mdt_NULL = 0, OpenAPI_report_interval_mdt__120, OpenAPI_report_interval_mdt__240, OpenAPI_report_interval_mdt__480, OpenAPI_report_interval_mdt__640, OpenAPI_report_interval_mdt__1024, OpenAPI_report_interval_mdt__2048, OpenAPI_report_interval_mdt__5120, OpenAPI_report_interval_mdt__10240, OpenAPI_report_interval_mdt__60000, OpenAPI_report_interval_mdt__360000, OpenAPI_report_interval_mdt__720000, OpenAPI_report_interval_mdt__1800000, OpenAPI_report_interval_mdt__3600000 } OpenAPI_report_interval_mdt_e; + +char* OpenAPI_report_interval_mdt_ToString(OpenAPI_report_interval_mdt_e report_interval_mdt); + +OpenAPI_report_interval_mdt_e OpenAPI_report_interval_mdt_FromString(char* report_interval_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_report_interval_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/report_interval_nr_mdt.c b/lib/sbi/openapi/model/report_interval_nr_mdt.c new file mode 100644 index 000000000..ad37b6632 --- /dev/null +++ b/lib/sbi/openapi/model/report_interval_nr_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "report_interval_nr_mdt.h" + +char* OpenAPI_report_interval_nr_mdt_ToString(OpenAPI_report_interval_nr_mdt_e report_interval_nr_mdt) +{ + const char *report_interval_nr_mdtArray[] = { "NULL", "_120", "_240", "_480", "_640", "_1024", "_2048", "_5120", "_10240", "_20480", "_40960", "_60000", "_360000", "_720000", "_1800000", "_3600000" }; + size_t sizeofArray = sizeof(report_interval_nr_mdtArray) / sizeof(report_interval_nr_mdtArray[0]); + if (report_interval_nr_mdt < sizeofArray) + return (char *)report_interval_nr_mdtArray[report_interval_nr_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_report_interval_nr_mdt_e OpenAPI_report_interval_nr_mdt_FromString(char* report_interval_nr_mdt) +{ + int stringToReturn = 0; + const char *report_interval_nr_mdtArray[] = { "NULL", "_120", "_240", "_480", "_640", "_1024", "_2048", "_5120", "_10240", "_20480", "_40960", "_60000", "_360000", "_720000", "_1800000", "_3600000" }; + size_t sizeofArray = sizeof(report_interval_nr_mdtArray) / sizeof(report_interval_nr_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(report_interval_nr_mdt, report_interval_nr_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/report_interval_nr_mdt.h b/lib/sbi/openapi/model/report_interval_nr_mdt.h new file mode 100644 index 000000000..a929395c8 --- /dev/null +++ b/lib/sbi/openapi/model/report_interval_nr_mdt.h @@ -0,0 +1,31 @@ +/* + * report_interval_nr_mdt.h + * + * + */ + +#ifndef _OpenAPI_report_interval_nr_mdt_H_ +#define _OpenAPI_report_interval_nr_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_report_interval_nr_mdt_NULL = 0, OpenAPI_report_interval_nr_mdt__120, OpenAPI_report_interval_nr_mdt__240, OpenAPI_report_interval_nr_mdt__480, OpenAPI_report_interval_nr_mdt__640, OpenAPI_report_interval_nr_mdt__1024, OpenAPI_report_interval_nr_mdt__2048, OpenAPI_report_interval_nr_mdt__5120, OpenAPI_report_interval_nr_mdt__10240, OpenAPI_report_interval_nr_mdt__20480, OpenAPI_report_interval_nr_mdt__40960, OpenAPI_report_interval_nr_mdt__60000, OpenAPI_report_interval_nr_mdt__360000, OpenAPI_report_interval_nr_mdt__720000, OpenAPI_report_interval_nr_mdt__1800000, OpenAPI_report_interval_nr_mdt__3600000 } OpenAPI_report_interval_nr_mdt_e; + +char* OpenAPI_report_interval_nr_mdt_ToString(OpenAPI_report_interval_nr_mdt_e report_interval_nr_mdt); + +OpenAPI_report_interval_nr_mdt_e OpenAPI_report_interval_nr_mdt_FromString(char* report_interval_nr_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_report_interval_nr_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/report_type_mdt.c b/lib/sbi/openapi/model/report_type_mdt.c new file mode 100644 index 000000000..4c271052f --- /dev/null +++ b/lib/sbi/openapi/model/report_type_mdt.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "report_type_mdt.h" + +char* OpenAPI_report_type_mdt_ToString(OpenAPI_report_type_mdt_e report_type_mdt) +{ + const char *report_type_mdtArray[] = { "NULL", "PERIODICAL", "EVENT_TRIGGED" }; + size_t sizeofArray = sizeof(report_type_mdtArray) / sizeof(report_type_mdtArray[0]); + if (report_type_mdt < sizeofArray) + return (char *)report_type_mdtArray[report_type_mdt]; + else + return (char *)"Unknown"; +} + +OpenAPI_report_type_mdt_e OpenAPI_report_type_mdt_FromString(char* report_type_mdt) +{ + int stringToReturn = 0; + const char *report_type_mdtArray[] = { "NULL", "PERIODICAL", "EVENT_TRIGGED" }; + size_t sizeofArray = sizeof(report_type_mdtArray) / sizeof(report_type_mdtArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(report_type_mdt, report_type_mdtArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/report_type_mdt.h b/lib/sbi/openapi/model/report_type_mdt.h new file mode 100644 index 000000000..b047604de --- /dev/null +++ b/lib/sbi/openapi/model/report_type_mdt.h @@ -0,0 +1,31 @@ +/* + * report_type_mdt.h + * + * + */ + +#ifndef _OpenAPI_report_type_mdt_H_ +#define _OpenAPI_report_type_mdt_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_report_type_mdt_NULL = 0, OpenAPI_report_type_mdt_PERIODICAL, OpenAPI_report_type_mdt_EVENT_TRIGGED } OpenAPI_report_type_mdt_e; + +char* OpenAPI_report_type_mdt_ToString(OpenAPI_report_type_mdt_e report_type_mdt); + +OpenAPI_report_type_mdt_e OpenAPI_report_type_mdt_FromString(char* report_type_mdt); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_report_type_mdt_H_ */ + diff --git a/lib/sbi/openapi/model/reporting_trigger.c b/lib/sbi/openapi/model/reporting_trigger.c new file mode 100644 index 000000000..ca55a5960 --- /dev/null +++ b/lib/sbi/openapi/model/reporting_trigger.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "reporting_trigger.h" + +char* OpenAPI_reporting_trigger_ToString(OpenAPI_reporting_trigger_e reporting_trigger) +{ + const char *reporting_triggerArray[] = { "NULL", "PERIODICAL", "EVENT_A2", "EVENT_A2_PERIODIC", "ALL_RRM_EVENT_TRIGGERS" }; + size_t sizeofArray = sizeof(reporting_triggerArray) / sizeof(reporting_triggerArray[0]); + if (reporting_trigger < sizeofArray) + return (char *)reporting_triggerArray[reporting_trigger]; + else + return (char *)"Unknown"; +} + +OpenAPI_reporting_trigger_e OpenAPI_reporting_trigger_FromString(char* reporting_trigger) +{ + int stringToReturn = 0; + const char *reporting_triggerArray[] = { "NULL", "PERIODICAL", "EVENT_A2", "EVENT_A2_PERIODIC", "ALL_RRM_EVENT_TRIGGERS" }; + size_t sizeofArray = sizeof(reporting_triggerArray) / sizeof(reporting_triggerArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(reporting_trigger, reporting_triggerArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/reporting_trigger.h b/lib/sbi/openapi/model/reporting_trigger.h new file mode 100644 index 000000000..7c2963e95 --- /dev/null +++ b/lib/sbi/openapi/model/reporting_trigger.h @@ -0,0 +1,31 @@ +/* + * reporting_trigger.h + * + * + */ + +#ifndef _OpenAPI_reporting_trigger_H_ +#define _OpenAPI_reporting_trigger_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_reporting_trigger_NULL = 0, OpenAPI_reporting_trigger_PERIODICAL, OpenAPI_reporting_trigger_EVENT_A2, OpenAPI_reporting_trigger_EVENT_A2_PERIODIC, OpenAPI_reporting_trigger_ALL_RRM_EVENT_TRIGGERS } OpenAPI_reporting_trigger_e; + +char* OpenAPI_reporting_trigger_ToString(OpenAPI_reporting_trigger_e reporting_trigger); + +OpenAPI_reporting_trigger_e OpenAPI_reporting_trigger_FromString(char* reporting_trigger); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reporting_trigger_H_ */ + diff --git a/lib/sbi/openapi/model/request_indication.c b/lib/sbi/openapi/model/request_indication.c index 990143c59..79abfad12 100644 --- a/lib/sbi/openapi/model/request_indication.c +++ b/lib/sbi/openapi/model/request_indication.c @@ -6,7 +6,7 @@ char* OpenAPI_request_indication_ToString(OpenAPI_request_indication_e request_indication) { - const char *request_indicationArray[] = { "NULL", "UE_REQ_PDU_SES_MOD", "UE_REQ_PDU_SES_REL", "PDU_SES_MOB", "NW_REQ_PDU_SES_AUTH", "NW_REQ_PDU_SES_MOD", "NW_REQ_PDU_SES_REL", "EBI_ASSIGNMENT_REQ" }; + const char *request_indicationArray[] = { "NULL", "UE_REQ_PDU_SES_MOD", "UE_REQ_PDU_SES_REL", "PDU_SES_MOB", "NW_REQ_PDU_SES_AUTH", "NW_REQ_PDU_SES_MOD", "NW_REQ_PDU_SES_REL", "EBI_ASSIGNMENT_REQ", "REL_DUE_TO_5G_AN_REQUEST" }; size_t sizeofArray = sizeof(request_indicationArray) / sizeof(request_indicationArray[0]); if (request_indication < sizeofArray) return (char *)request_indicationArray[request_indication]; @@ -17,7 +17,7 @@ char* OpenAPI_request_indication_ToString(OpenAPI_request_indication_e request_i OpenAPI_request_indication_e OpenAPI_request_indication_FromString(char* request_indication) { int stringToReturn = 0; - const char *request_indicationArray[] = { "NULL", "UE_REQ_PDU_SES_MOD", "UE_REQ_PDU_SES_REL", "PDU_SES_MOB", "NW_REQ_PDU_SES_AUTH", "NW_REQ_PDU_SES_MOD", "NW_REQ_PDU_SES_REL", "EBI_ASSIGNMENT_REQ" }; + const char *request_indicationArray[] = { "NULL", "UE_REQ_PDU_SES_MOD", "UE_REQ_PDU_SES_REL", "PDU_SES_MOB", "NW_REQ_PDU_SES_AUTH", "NW_REQ_PDU_SES_MOD", "NW_REQ_PDU_SES_REL", "EBI_ASSIGNMENT_REQ", "REL_DUE_TO_5G_AN_REQUEST" }; size_t sizeofArray = sizeof(request_indicationArray) / sizeof(request_indicationArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(request_indication, request_indicationArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/request_indication.h b/lib/sbi/openapi/model/request_indication.h index b963a2292..2e7a5df3d 100644 --- a/lib/sbi/openapi/model/request_indication.h +++ b/lib/sbi/openapi/model/request_indication.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_request_indication_NULL = 0, OpenAPI_request_indication_UE_REQ_PDU_SES_MOD, OpenAPI_request_indication_UE_REQ_PDU_SES_REL, OpenAPI_request_indication_PDU_SES_MOB, OpenAPI_request_indication_NW_REQ_PDU_SES_AUTH, OpenAPI_request_indication_NW_REQ_PDU_SES_MOD, OpenAPI_request_indication_NW_REQ_PDU_SES_REL, OpenAPI_request_indication_EBI_ASSIGNMENT_REQ } OpenAPI_request_indication_e; +typedef enum { OpenAPI_request_indication_NULL = 0, OpenAPI_request_indication_UE_REQ_PDU_SES_MOD, OpenAPI_request_indication_UE_REQ_PDU_SES_REL, OpenAPI_request_indication_PDU_SES_MOB, OpenAPI_request_indication_NW_REQ_PDU_SES_AUTH, OpenAPI_request_indication_NW_REQ_PDU_SES_MOD, OpenAPI_request_indication_NW_REQ_PDU_SES_REL, OpenAPI_request_indication_EBI_ASSIGNMENT_REQ, OpenAPI_request_indication_REL_DUE_TO_5G_AN_REQUEST } OpenAPI_request_indication_e; char* OpenAPI_request_indication_ToString(OpenAPI_request_indication_e request_indication); diff --git a/lib/sbi/openapi/model/retrieve_data.c b/lib/sbi/openapi/model/retrieve_data.c new file mode 100644 index 000000000..91935f49f --- /dev/null +++ b/lib/sbi/openapi/model/retrieve_data.c @@ -0,0 +1,104 @@ + +#include +#include +#include +#include "retrieve_data.h" + +OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_create( + int small_data_rate_status_req + ) +{ + OpenAPI_retrieve_data_t *retrieve_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_retrieve_data_t)); + if (!retrieve_data_local_var) { + return NULL; + } + retrieve_data_local_var->small_data_rate_status_req = small_data_rate_status_req; + + return retrieve_data_local_var; +} + +void OpenAPI_retrieve_data_free(OpenAPI_retrieve_data_t *retrieve_data) +{ + if (NULL == retrieve_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(retrieve_data); +} + +cJSON *OpenAPI_retrieve_data_convertToJSON(OpenAPI_retrieve_data_t *retrieve_data) +{ + cJSON *item = NULL; + + if (retrieve_data == NULL) { + ogs_error("OpenAPI_retrieve_data_convertToJSON() failed [RetrieveData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (retrieve_data->small_data_rate_status_req) { + if (cJSON_AddBoolToObject(item, "smallDataRateStatusReq", retrieve_data->small_data_rate_status_req) == NULL) { + ogs_error("OpenAPI_retrieve_data_convertToJSON() failed [small_data_rate_status_req]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_parseFromJSON(cJSON *retrieve_dataJSON) +{ + OpenAPI_retrieve_data_t *retrieve_data_local_var = NULL; + cJSON *small_data_rate_status_req = cJSON_GetObjectItemCaseSensitive(retrieve_dataJSON, "smallDataRateStatusReq"); + + if (small_data_rate_status_req) { + if (!cJSON_IsBool(small_data_rate_status_req)) { + ogs_error("OpenAPI_retrieve_data_parseFromJSON() failed [small_data_rate_status_req]"); + goto end; + } + } + + retrieve_data_local_var = OpenAPI_retrieve_data_create ( + small_data_rate_status_req ? small_data_rate_status_req->valueint : 0 + ); + + return retrieve_data_local_var; +end: + return NULL; +} + +OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_copy(OpenAPI_retrieve_data_t *dst, OpenAPI_retrieve_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_retrieve_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_retrieve_data_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_retrieve_data_free(dst); + dst = OpenAPI_retrieve_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/retrieve_data.h b/lib/sbi/openapi/model/retrieve_data.h new file mode 100644 index 000000000..e4d263110 --- /dev/null +++ b/lib/sbi/openapi/model/retrieve_data.h @@ -0,0 +1,38 @@ +/* + * retrieve_data.h + * + * + */ + +#ifndef _OpenAPI_retrieve_data_H_ +#define _OpenAPI_retrieve_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_retrieve_data_s OpenAPI_retrieve_data_t; +typedef struct OpenAPI_retrieve_data_s { + int small_data_rate_status_req; +} OpenAPI_retrieve_data_t; + +OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_create( + int small_data_rate_status_req + ); +void OpenAPI_retrieve_data_free(OpenAPI_retrieve_data_t *retrieve_data); +OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_parseFromJSON(cJSON *retrieve_dataJSON); +cJSON *OpenAPI_retrieve_data_convertToJSON(OpenAPI_retrieve_data_t *retrieve_data); +OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_copy(OpenAPI_retrieve_data_t *dst, OpenAPI_retrieve_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_retrieve_data_H_ */ + diff --git a/lib/sbi/openapi/model/retrieved_data.c b/lib/sbi/openapi/model/retrieved_data.c new file mode 100644 index 000000000..601f0d2d4 --- /dev/null +++ b/lib/sbi/openapi/model/retrieved_data.c @@ -0,0 +1,109 @@ + +#include +#include +#include +#include "retrieved_data.h" + +OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_create( + OpenAPI_small_data_rate_status_t *small_data_rate_status + ) +{ + OpenAPI_retrieved_data_t *retrieved_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_retrieved_data_t)); + if (!retrieved_data_local_var) { + return NULL; + } + retrieved_data_local_var->small_data_rate_status = small_data_rate_status; + + return retrieved_data_local_var; +} + +void OpenAPI_retrieved_data_free(OpenAPI_retrieved_data_t *retrieved_data) +{ + if (NULL == retrieved_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_small_data_rate_status_free(retrieved_data->small_data_rate_status); + ogs_free(retrieved_data); +} + +cJSON *OpenAPI_retrieved_data_convertToJSON(OpenAPI_retrieved_data_t *retrieved_data) +{ + cJSON *item = NULL; + + if (retrieved_data == NULL) { + ogs_error("OpenAPI_retrieved_data_convertToJSON() failed [RetrievedData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (retrieved_data->small_data_rate_status) { + cJSON *small_data_rate_status_local_JSON = OpenAPI_small_data_rate_status_convertToJSON(retrieved_data->small_data_rate_status); + if (small_data_rate_status_local_JSON == NULL) { + ogs_error("OpenAPI_retrieved_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + cJSON_AddItemToObject(item, "smallDataRateStatus", small_data_rate_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_retrieved_data_convertToJSON() failed [small_data_rate_status]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_parseFromJSON(cJSON *retrieved_dataJSON) +{ + OpenAPI_retrieved_data_t *retrieved_data_local_var = NULL; + cJSON *small_data_rate_status = cJSON_GetObjectItemCaseSensitive(retrieved_dataJSON, "smallDataRateStatus"); + + OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + if (small_data_rate_status) { + small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); + } + + retrieved_data_local_var = OpenAPI_retrieved_data_create ( + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL + ); + + return retrieved_data_local_var; +end: + return NULL; +} + +OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_copy(OpenAPI_retrieved_data_t *dst, OpenAPI_retrieved_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_retrieved_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_retrieved_data_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_retrieved_data_free(dst); + dst = OpenAPI_retrieved_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/retrieved_data.h b/lib/sbi/openapi/model/retrieved_data.h new file mode 100644 index 000000000..08635fb19 --- /dev/null +++ b/lib/sbi/openapi/model/retrieved_data.h @@ -0,0 +1,39 @@ +/* + * retrieved_data.h + * + * + */ + +#ifndef _OpenAPI_retrieved_data_H_ +#define _OpenAPI_retrieved_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "small_data_rate_status.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_retrieved_data_s OpenAPI_retrieved_data_t; +typedef struct OpenAPI_retrieved_data_s { + struct OpenAPI_small_data_rate_status_s *small_data_rate_status; +} OpenAPI_retrieved_data_t; + +OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_create( + OpenAPI_small_data_rate_status_t *small_data_rate_status + ); +void OpenAPI_retrieved_data_free(OpenAPI_retrieved_data_t *retrieved_data); +OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_parseFromJSON(cJSON *retrieved_dataJSON); +cJSON *OpenAPI_retrieved_data_convertToJSON(OpenAPI_retrieved_data_t *retrieved_data); +OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_copy(OpenAPI_retrieved_data_t *dst, OpenAPI_retrieved_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_retrieved_data_H_ */ + diff --git a/lib/sbi/openapi/model/roaming_indication.c b/lib/sbi/openapi/model/roaming_indication.c new file mode 100644 index 000000000..51a2bb03f --- /dev/null +++ b/lib/sbi/openapi/model/roaming_indication.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "roaming_indication.h" + +char* OpenAPI_roaming_indication_ToString(OpenAPI_roaming_indication_e roaming_indication) +{ + const char *roaming_indicationArray[] = { "NULL", "NON_ROAMING", "LOCAL_BREAKOUT", "HOME_ROUTED_ROAMING" }; + size_t sizeofArray = sizeof(roaming_indicationArray) / sizeof(roaming_indicationArray[0]); + if (roaming_indication < sizeofArray) + return (char *)roaming_indicationArray[roaming_indication]; + else + return (char *)"Unknown"; +} + +OpenAPI_roaming_indication_e OpenAPI_roaming_indication_FromString(char* roaming_indication) +{ + int stringToReturn = 0; + const char *roaming_indicationArray[] = { "NULL", "NON_ROAMING", "LOCAL_BREAKOUT", "HOME_ROUTED_ROAMING" }; + size_t sizeofArray = sizeof(roaming_indicationArray) / sizeof(roaming_indicationArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(roaming_indication, roaming_indicationArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/roaming_indication.h b/lib/sbi/openapi/model/roaming_indication.h new file mode 100644 index 000000000..5e366bce1 --- /dev/null +++ b/lib/sbi/openapi/model/roaming_indication.h @@ -0,0 +1,31 @@ +/* + * roaming_indication.h + * + * + */ + +#ifndef _OpenAPI_roaming_indication_H_ +#define _OpenAPI_roaming_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_roaming_indication_NULL = 0, OpenAPI_roaming_indication_NON_ROAMING, OpenAPI_roaming_indication_LOCAL_BREAKOUT, OpenAPI_roaming_indication_HOME_ROUTED_ROAMING } OpenAPI_roaming_indication_e; + +char* OpenAPI_roaming_indication_ToString(OpenAPI_roaming_indication_e roaming_indication); + +OpenAPI_roaming_indication_e OpenAPI_roaming_indication_FromString(char* roaming_indication); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_roaming_indication_H_ */ + diff --git a/lib/sbi/openapi/model/roaming_odb.c b/lib/sbi/openapi/model/roaming_odb.c index 2d92e3d80..fd526bf2f 100644 --- a/lib/sbi/openapi/model/roaming_odb.c +++ b/lib/sbi/openapi/model/roaming_odb.c @@ -4,82 +4,27 @@ #include #include "roaming_odb.h" -OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_create( - ) +char* OpenAPI_roaming_odb_ToString(OpenAPI_roaming_odb_e roaming_odb) { - OpenAPI_roaming_odb_t *roaming_odb_local_var = OpenAPI_malloc(sizeof(OpenAPI_roaming_odb_t)); - if (!roaming_odb_local_var) { - return NULL; - } - - return roaming_odb_local_var; + const char *roaming_odbArray[] = { "NULL", "OUTSIDE_HOME_PLMN", "OUTSIDE_HOME_PLMN_COUNTRY" }; + size_t sizeofArray = sizeof(roaming_odbArray) / sizeof(roaming_odbArray[0]); + if (roaming_odb < sizeofArray) + return (char *)roaming_odbArray[roaming_odb]; + else + return (char *)"Unknown"; } -void OpenAPI_roaming_odb_free(OpenAPI_roaming_odb_t *roaming_odb) +OpenAPI_roaming_odb_e OpenAPI_roaming_odb_FromString(char* roaming_odb) { - if (NULL == roaming_odb) { - return; + int stringToReturn = 0; + const char *roaming_odbArray[] = { "NULL", "OUTSIDE_HOME_PLMN", "OUTSIDE_HOME_PLMN_COUNTRY" }; + size_t sizeofArray = sizeof(roaming_odbArray) / sizeof(roaming_odbArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(roaming_odb, roaming_odbArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(roaming_odb); -} - -cJSON *OpenAPI_roaming_odb_convertToJSON(OpenAPI_roaming_odb_t *roaming_odb) -{ - cJSON *item = NULL; - - if (roaming_odb == NULL) { - ogs_error("OpenAPI_roaming_odb_convertToJSON() failed [RoamingOdb]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_parseFromJSON(cJSON *roaming_odbJSON) -{ - OpenAPI_roaming_odb_t *roaming_odb_local_var = NULL; - roaming_odb_local_var = OpenAPI_roaming_odb_create ( - ); - - return roaming_odb_local_var; -end: - return NULL; -} - -OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_copy(OpenAPI_roaming_odb_t *dst, OpenAPI_roaming_odb_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_roaming_odb_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_roaming_odb_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_roaming_odb_free(dst); - dst = OpenAPI_roaming_odb_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/roaming_odb.h b/lib/sbi/openapi/model/roaming_odb.h index 3e47ff8e2..59eb505d9 100644 --- a/lib/sbi/openapi/model/roaming_odb.h +++ b/lib/sbi/openapi/model/roaming_odb.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_roaming_odb_s OpenAPI_roaming_odb_t; -typedef struct OpenAPI_roaming_odb_s { -} OpenAPI_roaming_odb_t; +typedef enum { OpenAPI_roaming_odb_NULL = 0, OpenAPI_roaming_odb_OUTSIDE_HOME_PLMN, OpenAPI_roaming_odb_OUTSIDE_HOME_PLMN_COUNTRY } OpenAPI_roaming_odb_e; -OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_create( - ); -void OpenAPI_roaming_odb_free(OpenAPI_roaming_odb_t *roaming_odb); -OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_parseFromJSON(cJSON *roaming_odbJSON); -cJSON *OpenAPI_roaming_odb_convertToJSON(OpenAPI_roaming_odb_t *roaming_odb); -OpenAPI_roaming_odb_t *OpenAPI_roaming_odb_copy(OpenAPI_roaming_odb_t *dst, OpenAPI_roaming_odb_t *src); +char* OpenAPI_roaming_odb_ToString(OpenAPI_roaming_odb_e roaming_odb); + +OpenAPI_roaming_odb_e OpenAPI_roaming_odb_FromString(char* roaming_odb); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/scp_domain_cond.c b/lib/sbi/openapi/model/scp_domain_cond.c new file mode 100644 index 000000000..4f6ca6cf3 --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_cond.c @@ -0,0 +1,128 @@ + +#include +#include +#include +#include "scp_domain_cond.h" + +OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_create( + OpenAPI_list_t *scp_domains + ) +{ + OpenAPI_scp_domain_cond_t *scp_domain_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_scp_domain_cond_t)); + if (!scp_domain_cond_local_var) { + return NULL; + } + scp_domain_cond_local_var->scp_domains = scp_domains; + + return scp_domain_cond_local_var; +} + +void OpenAPI_scp_domain_cond_free(OpenAPI_scp_domain_cond_t *scp_domain_cond) +{ + if (NULL == scp_domain_cond) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(scp_domain_cond->scp_domains, node) { + ogs_free(node->data); + } + OpenAPI_list_free(scp_domain_cond->scp_domains); + ogs_free(scp_domain_cond); +} + +cJSON *OpenAPI_scp_domain_cond_convertToJSON(OpenAPI_scp_domain_cond_t *scp_domain_cond) +{ + cJSON *item = NULL; + + if (scp_domain_cond == NULL) { + ogs_error("OpenAPI_scp_domain_cond_convertToJSON() failed [ScpDomainCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (scp_domain_cond->scp_domains) { + cJSON *scp_domains = cJSON_AddArrayToObject(item, "scpDomains"); + if (scp_domains == NULL) { + ogs_error("OpenAPI_scp_domain_cond_convertToJSON() failed [scp_domains]"); + goto end; + } + + OpenAPI_lnode_t *scp_domains_node; + OpenAPI_list_for_each(scp_domain_cond->scp_domains, scp_domains_node) { + if (cJSON_AddStringToObject(scp_domains, "", (char*)scp_domains_node->data) == NULL) { + ogs_error("OpenAPI_scp_domain_cond_convertToJSON() failed [scp_domains]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_parseFromJSON(cJSON *scp_domain_condJSON) +{ + OpenAPI_scp_domain_cond_t *scp_domain_cond_local_var = NULL; + cJSON *scp_domains = cJSON_GetObjectItemCaseSensitive(scp_domain_condJSON, "scpDomains"); + + OpenAPI_list_t *scp_domainsList; + if (scp_domains) { + cJSON *scp_domains_local; + if (!cJSON_IsArray(scp_domains)) { + ogs_error("OpenAPI_scp_domain_cond_parseFromJSON() failed [scp_domains]"); + goto end; + } + scp_domainsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(scp_domains_local, scp_domains) { + if (!cJSON_IsString(scp_domains_local)) { + ogs_error("OpenAPI_scp_domain_cond_parseFromJSON() failed [scp_domains]"); + goto end; + } + OpenAPI_list_add(scp_domainsList, ogs_strdup(scp_domains_local->valuestring)); + } + } + + scp_domain_cond_local_var = OpenAPI_scp_domain_cond_create ( + scp_domains ? scp_domainsList : NULL + ); + + return scp_domain_cond_local_var; +end: + return NULL; +} + +OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_copy(OpenAPI_scp_domain_cond_t *dst, OpenAPI_scp_domain_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scp_domain_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scp_domain_cond_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_scp_domain_cond_free(dst); + dst = OpenAPI_scp_domain_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scp_domain_cond.h b/lib/sbi/openapi/model/scp_domain_cond.h new file mode 100644 index 000000000..53d29d305 --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_cond.h @@ -0,0 +1,38 @@ +/* + * scp_domain_cond.h + * + * Subscription to a set of NF or SCP instances belonging to certain SCP domains + */ + +#ifndef _OpenAPI_scp_domain_cond_H_ +#define _OpenAPI_scp_domain_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_scp_domain_cond_s OpenAPI_scp_domain_cond_t; +typedef struct OpenAPI_scp_domain_cond_s { + OpenAPI_list_t *scp_domains; +} OpenAPI_scp_domain_cond_t; + +OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_create( + OpenAPI_list_t *scp_domains + ); +void OpenAPI_scp_domain_cond_free(OpenAPI_scp_domain_cond_t *scp_domain_cond); +OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_parseFromJSON(cJSON *scp_domain_condJSON); +cJSON *OpenAPI_scp_domain_cond_convertToJSON(OpenAPI_scp_domain_cond_t *scp_domain_cond); +OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_copy(OpenAPI_scp_domain_cond_t *dst, OpenAPI_scp_domain_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_domain_cond_H_ */ + diff --git a/lib/sbi/openapi/model/scp_domain_info.c b/lib/sbi/openapi/model/scp_domain_info.c new file mode 100644 index 000000000..4caa6ee1f --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_info.c @@ -0,0 +1,216 @@ + +#include +#include +#include +#include "scp_domain_info.h" + +OpenAPI_scp_domain_info_t *OpenAPI_scp_domain_info_create( + char *scp_fqdn, + OpenAPI_list_t *scp_ip_end_points, + char *scp_prefix, + OpenAPI_list_t* scp_ports + ) +{ + OpenAPI_scp_domain_info_t *scp_domain_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_scp_domain_info_t)); + if (!scp_domain_info_local_var) { + return NULL; + } + scp_domain_info_local_var->scp_fqdn = scp_fqdn; + scp_domain_info_local_var->scp_ip_end_points = scp_ip_end_points; + scp_domain_info_local_var->scp_prefix = scp_prefix; + scp_domain_info_local_var->scp_ports = scp_ports; + + return scp_domain_info_local_var; +} + +void OpenAPI_scp_domain_info_free(OpenAPI_scp_domain_info_t *scp_domain_info) +{ + if (NULL == scp_domain_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(scp_domain_info->scp_fqdn); + OpenAPI_list_for_each(scp_domain_info->scp_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(scp_domain_info->scp_ip_end_points); + ogs_free(scp_domain_info->scp_prefix); + OpenAPI_list_for_each(scp_domain_info->scp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(scp_domain_info->scp_ports); + ogs_free(scp_domain_info); +} + +cJSON *OpenAPI_scp_domain_info_convertToJSON(OpenAPI_scp_domain_info_t *scp_domain_info) +{ + cJSON *item = NULL; + + if (scp_domain_info == NULL) { + ogs_error("OpenAPI_scp_domain_info_convertToJSON() failed [ScpDomainInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (scp_domain_info->scp_fqdn) { + if (cJSON_AddStringToObject(item, "scpFqdn", scp_domain_info->scp_fqdn) == NULL) { + ogs_error("OpenAPI_scp_domain_info_convertToJSON() failed [scp_fqdn]"); + goto end; + } + } + + if (scp_domain_info->scp_ip_end_points) { + cJSON *scp_ip_end_pointsList = cJSON_AddArrayToObject(item, "scpIpEndPoints"); + if (scp_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_scp_domain_info_convertToJSON() failed [scp_ip_end_points]"); + goto end; + } + + OpenAPI_lnode_t *scp_ip_end_points_node; + if (scp_domain_info->scp_ip_end_points) { + OpenAPI_list_for_each(scp_domain_info->scp_ip_end_points, scp_ip_end_points_node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(scp_ip_end_points_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_scp_domain_info_convertToJSON() failed [scp_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(scp_ip_end_pointsList, itemLocal); + } + } + } + + if (scp_domain_info->scp_prefix) { + if (cJSON_AddStringToObject(item, "scpPrefix", scp_domain_info->scp_prefix) == NULL) { + ogs_error("OpenAPI_scp_domain_info_convertToJSON() failed [scp_prefix]"); + goto end; + } + } + + if (scp_domain_info->scp_ports) { + cJSON *scp_ports = cJSON_AddObjectToObject(item, "scpPorts"); + if (scp_ports == NULL) { + ogs_error("OpenAPI_scp_domain_info_convertToJSON() failed [scp_ports]"); + goto end; + } + cJSON *localMapObject = scp_ports; + OpenAPI_lnode_t *scp_ports_node; + if (scp_domain_info->scp_ports) { + OpenAPI_list_for_each(scp_domain_info->scp_ports, scp_ports_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)scp_ports_node->data; + } + } + } + +end: + return item; +} + +OpenAPI_scp_domain_info_t *OpenAPI_scp_domain_info_parseFromJSON(cJSON *scp_domain_infoJSON) +{ + OpenAPI_scp_domain_info_t *scp_domain_info_local_var = NULL; + cJSON *scp_fqdn = cJSON_GetObjectItemCaseSensitive(scp_domain_infoJSON, "scpFqdn"); + + if (scp_fqdn) { + if (!cJSON_IsString(scp_fqdn)) { + ogs_error("OpenAPI_scp_domain_info_parseFromJSON() failed [scp_fqdn]"); + goto end; + } + } + + cJSON *scp_ip_end_points = cJSON_GetObjectItemCaseSensitive(scp_domain_infoJSON, "scpIpEndPoints"); + + OpenAPI_list_t *scp_ip_end_pointsList; + if (scp_ip_end_points) { + cJSON *scp_ip_end_points_local_nonprimitive; + if (!cJSON_IsArray(scp_ip_end_points)) { + ogs_error("OpenAPI_scp_domain_info_parseFromJSON() failed [scp_ip_end_points]"); + goto end; + } + + scp_ip_end_pointsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(scp_ip_end_points_local_nonprimitive, scp_ip_end_points ) { + if (!cJSON_IsObject(scp_ip_end_points_local_nonprimitive)) { + ogs_error("OpenAPI_scp_domain_info_parseFromJSON() failed [scp_ip_end_points]"); + goto end; + } + OpenAPI_ip_end_point_t *scp_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(scp_ip_end_points_local_nonprimitive); + + OpenAPI_list_add(scp_ip_end_pointsList, scp_ip_end_pointsItem); + } + } + + cJSON *scp_prefix = cJSON_GetObjectItemCaseSensitive(scp_domain_infoJSON, "scpPrefix"); + + if (scp_prefix) { + if (!cJSON_IsString(scp_prefix)) { + ogs_error("OpenAPI_scp_domain_info_parseFromJSON() failed [scp_prefix]"); + goto end; + } + } + + cJSON *scp_ports = cJSON_GetObjectItemCaseSensitive(scp_domain_infoJSON, "scpPorts"); + + OpenAPI_list_t *scp_portsList; + if (scp_ports) { + cJSON *scp_ports_local_map; + if (!cJSON_IsObject(scp_ports)) { + ogs_error("OpenAPI_scp_domain_info_parseFromJSON() failed [scp_ports]"); + goto end; + } + scp_portsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(scp_ports_local_map, scp_ports) { + cJSON *localMapObject = scp_ports_local_map; + OpenAPI_list_add(scp_portsList, localMapKeyPair); + } + } + + scp_domain_info_local_var = OpenAPI_scp_domain_info_create ( + scp_fqdn ? ogs_strdup(scp_fqdn->valuestring) : NULL, + scp_ip_end_points ? scp_ip_end_pointsList : NULL, + scp_prefix ? ogs_strdup(scp_prefix->valuestring) : NULL, + scp_ports ? scp_portsList : NULL + ); + + return scp_domain_info_local_var; +end: + return NULL; +} + +OpenAPI_scp_domain_info_t *OpenAPI_scp_domain_info_copy(OpenAPI_scp_domain_info_t *dst, OpenAPI_scp_domain_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scp_domain_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scp_domain_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_scp_domain_info_free(dst); + dst = OpenAPI_scp_domain_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scp_domain_info.h b/lib/sbi/openapi/model/scp_domain_info.h new file mode 100644 index 000000000..6d0dbcf36 --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_info.h @@ -0,0 +1,45 @@ +/* + * scp_domain_info.h + * + * SCP Domain specific information + */ + +#ifndef _OpenAPI_scp_domain_info_H_ +#define _OpenAPI_scp_domain_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_scp_domain_info_s OpenAPI_scp_domain_info_t; +typedef struct OpenAPI_scp_domain_info_s { + char *scp_fqdn; + OpenAPI_list_t *scp_ip_end_points; + char *scp_prefix; + OpenAPI_list_t* scp_ports; +} OpenAPI_scp_domain_info_t; + +OpenAPI_scp_domain_info_t *OpenAPI_scp_domain_info_create( + char *scp_fqdn, + OpenAPI_list_t *scp_ip_end_points, + char *scp_prefix, + OpenAPI_list_t* scp_ports + ); +void OpenAPI_scp_domain_info_free(OpenAPI_scp_domain_info_t *scp_domain_info); +OpenAPI_scp_domain_info_t *OpenAPI_scp_domain_info_parseFromJSON(cJSON *scp_domain_infoJSON); +cJSON *OpenAPI_scp_domain_info_convertToJSON(OpenAPI_scp_domain_info_t *scp_domain_info); +OpenAPI_scp_domain_info_t *OpenAPI_scp_domain_info_copy(OpenAPI_scp_domain_info_t *dst, OpenAPI_scp_domain_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_domain_info_H_ */ + diff --git a/lib/sbi/openapi/model/scp_info.c b/lib/sbi/openapi/model/scp_info.c new file mode 100644 index 000000000..e09ba9293 --- /dev/null +++ b/lib/sbi/openapi/model/scp_info.c @@ -0,0 +1,509 @@ + +#include +#include +#include +#include "scp_info.h" + +OpenAPI_scp_info_t *OpenAPI_scp_info_create( + OpenAPI_list_t* scp_domain_info_list, + char *scp_prefix, + OpenAPI_list_t* scp_ports, + OpenAPI_list_t *address_domains, + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_prefixes, + OpenAPI_list_t *ipv4_addr_ranges, + OpenAPI_list_t *ipv6_prefix_ranges, + OpenAPI_list_t *served_nf_set_id_list, + OpenAPI_list_t *remote_plmn_list + ) +{ + OpenAPI_scp_info_t *scp_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_scp_info_t)); + if (!scp_info_local_var) { + return NULL; + } + scp_info_local_var->scp_domain_info_list = scp_domain_info_list; + scp_info_local_var->scp_prefix = scp_prefix; + scp_info_local_var->scp_ports = scp_ports; + scp_info_local_var->address_domains = address_domains; + scp_info_local_var->ipv4_addresses = ipv4_addresses; + scp_info_local_var->ipv6_prefixes = ipv6_prefixes; + scp_info_local_var->ipv4_addr_ranges = ipv4_addr_ranges; + scp_info_local_var->ipv6_prefix_ranges = ipv6_prefix_ranges; + scp_info_local_var->served_nf_set_id_list = served_nf_set_id_list; + scp_info_local_var->remote_plmn_list = remote_plmn_list; + + return scp_info_local_var; +} + +void OpenAPI_scp_info_free(OpenAPI_scp_info_t *scp_info) +{ + if (NULL == scp_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(scp_info->scp_domain_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(scp_info->scp_domain_info_list); + ogs_free(scp_info->scp_prefix); + OpenAPI_list_for_each(scp_info->scp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(scp_info->scp_ports); + OpenAPI_list_for_each(scp_info->address_domains, node) { + ogs_free(node->data); + } + OpenAPI_list_free(scp_info->address_domains); + OpenAPI_list_for_each(scp_info->ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(scp_info->ipv4_addresses); + OpenAPI_list_for_each(scp_info->ipv6_prefixes, node) { + ogs_free(node->data); + } + OpenAPI_list_free(scp_info->ipv6_prefixes); + OpenAPI_list_for_each(scp_info->ipv4_addr_ranges, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(scp_info->ipv4_addr_ranges); + OpenAPI_list_for_each(scp_info->ipv6_prefix_ranges, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(scp_info->ipv6_prefix_ranges); + OpenAPI_list_for_each(scp_info->served_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(scp_info->served_nf_set_id_list); + OpenAPI_list_for_each(scp_info->remote_plmn_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(scp_info->remote_plmn_list); + ogs_free(scp_info); +} + +cJSON *OpenAPI_scp_info_convertToJSON(OpenAPI_scp_info_t *scp_info) +{ + cJSON *item = NULL; + + if (scp_info == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ScpInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (scp_info->scp_domain_info_list) { + cJSON *scp_domain_info_list = cJSON_AddObjectToObject(item, "scpDomainInfoList"); + if (scp_domain_info_list == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [scp_domain_info_list]"); + goto end; + } + cJSON *localMapObject = scp_domain_info_list; + OpenAPI_lnode_t *scp_domain_info_list_node; + if (scp_info->scp_domain_info_list) { + OpenAPI_list_for_each(scp_info->scp_domain_info_list, scp_domain_info_list_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)scp_domain_info_list_node->data; + } + } + } + + if (scp_info->scp_prefix) { + if (cJSON_AddStringToObject(item, "scpPrefix", scp_info->scp_prefix) == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [scp_prefix]"); + goto end; + } + } + + if (scp_info->scp_ports) { + cJSON *scp_ports = cJSON_AddObjectToObject(item, "scpPorts"); + if (scp_ports == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [scp_ports]"); + goto end; + } + cJSON *localMapObject = scp_ports; + OpenAPI_lnode_t *scp_ports_node; + if (scp_info->scp_ports) { + OpenAPI_list_for_each(scp_info->scp_ports, scp_ports_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)scp_ports_node->data; + } + } + } + + if (scp_info->address_domains) { + cJSON *address_domains = cJSON_AddArrayToObject(item, "addressDomains"); + if (address_domains == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [address_domains]"); + goto end; + } + + OpenAPI_lnode_t *address_domains_node; + OpenAPI_list_for_each(scp_info->address_domains, address_domains_node) { + if (cJSON_AddStringToObject(address_domains, "", (char*)address_domains_node->data) == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [address_domains]"); + goto end; + } + } + } + + if (scp_info->ipv4_addresses) { + cJSON *ipv4_addresses = cJSON_AddArrayToObject(item, "ipv4Addresses"); + if (ipv4_addresses == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + + OpenAPI_lnode_t *ipv4_addresses_node; + OpenAPI_list_for_each(scp_info->ipv4_addresses, ipv4_addresses_node) { + if (cJSON_AddStringToObject(ipv4_addresses, "", (char*)ipv4_addresses_node->data) == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + } + } + + if (scp_info->ipv6_prefixes) { + cJSON *ipv6_prefixes = cJSON_AddArrayToObject(item, "ipv6Prefixes"); + if (ipv6_prefixes == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv6_prefixes]"); + goto end; + } + + OpenAPI_lnode_t *ipv6_prefixes_node; + OpenAPI_list_for_each(scp_info->ipv6_prefixes, ipv6_prefixes_node) { + if (cJSON_AddStringToObject(ipv6_prefixes, "", (char*)ipv6_prefixes_node->data) == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv6_prefixes]"); + goto end; + } + } + } + + if (scp_info->ipv4_addr_ranges) { + cJSON *ipv4_addr_rangesList = cJSON_AddArrayToObject(item, "ipv4AddrRanges"); + if (ipv4_addr_rangesList == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv4_addr_ranges]"); + goto end; + } + + OpenAPI_lnode_t *ipv4_addr_ranges_node; + if (scp_info->ipv4_addr_ranges) { + OpenAPI_list_for_each(scp_info->ipv4_addr_ranges, ipv4_addr_ranges_node) { + cJSON *itemLocal = OpenAPI_ipv4_address_range_convertToJSON(ipv4_addr_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv4_addr_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv4_addr_rangesList, itemLocal); + } + } + } + + if (scp_info->ipv6_prefix_ranges) { + cJSON *ipv6_prefix_rangesList = cJSON_AddArrayToObject(item, "ipv6PrefixRanges"); + if (ipv6_prefix_rangesList == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + + OpenAPI_lnode_t *ipv6_prefix_ranges_node; + if (scp_info->ipv6_prefix_ranges) { + OpenAPI_list_for_each(scp_info->ipv6_prefix_ranges, ipv6_prefix_ranges_node) { + cJSON *itemLocal = OpenAPI_ipv6_prefix_range_convertToJSON(ipv6_prefix_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv6_prefix_rangesList, itemLocal); + } + } + } + + if (scp_info->served_nf_set_id_list) { + cJSON *served_nf_set_id_list = cJSON_AddArrayToObject(item, "servedNfSetIdList"); + if (served_nf_set_id_list == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [served_nf_set_id_list]"); + goto end; + } + + OpenAPI_lnode_t *served_nf_set_id_list_node; + OpenAPI_list_for_each(scp_info->served_nf_set_id_list, served_nf_set_id_list_node) { + if (cJSON_AddStringToObject(served_nf_set_id_list, "", (char*)served_nf_set_id_list_node->data) == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [served_nf_set_id_list]"); + goto end; + } + } + } + + if (scp_info->remote_plmn_list) { + cJSON *remote_plmn_listList = cJSON_AddArrayToObject(item, "remotePlmnList"); + if (remote_plmn_listList == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + + OpenAPI_lnode_t *remote_plmn_list_node; + if (scp_info->remote_plmn_list) { + OpenAPI_list_for_each(scp_info->remote_plmn_list, remote_plmn_list_node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(remote_plmn_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_plmn_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON) +{ + OpenAPI_scp_info_t *scp_info_local_var = NULL; + cJSON *scp_domain_info_list = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "scpDomainInfoList"); + + OpenAPI_list_t *scp_domain_info_listList; + if (scp_domain_info_list) { + cJSON *scp_domain_info_list_local_map; + if (!cJSON_IsObject(scp_domain_info_list)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [scp_domain_info_list]"); + goto end; + } + scp_domain_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(scp_domain_info_list_local_map, scp_domain_info_list) { + cJSON *localMapObject = scp_domain_info_list_local_map; + OpenAPI_list_add(scp_domain_info_listList, localMapKeyPair); + } + } + + cJSON *scp_prefix = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "scpPrefix"); + + if (scp_prefix) { + if (!cJSON_IsString(scp_prefix)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [scp_prefix]"); + goto end; + } + } + + cJSON *scp_ports = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "scpPorts"); + + OpenAPI_list_t *scp_portsList; + if (scp_ports) { + cJSON *scp_ports_local_map; + if (!cJSON_IsObject(scp_ports)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [scp_ports]"); + goto end; + } + scp_portsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(scp_ports_local_map, scp_ports) { + cJSON *localMapObject = scp_ports_local_map; + OpenAPI_list_add(scp_portsList, localMapKeyPair); + } + } + + cJSON *address_domains = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "addressDomains"); + + OpenAPI_list_t *address_domainsList; + if (address_domains) { + cJSON *address_domains_local; + if (!cJSON_IsArray(address_domains)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [address_domains]"); + goto end; + } + address_domainsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(address_domains_local, address_domains) { + if (!cJSON_IsString(address_domains_local)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [address_domains]"); + goto end; + } + OpenAPI_list_add(address_domainsList, ogs_strdup(address_domains_local->valuestring)); + } + } + + cJSON *ipv4_addresses = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "ipv4Addresses"); + + OpenAPI_list_t *ipv4_addressesList; + if (ipv4_addresses) { + cJSON *ipv4_addresses_local; + if (!cJSON_IsArray(ipv4_addresses)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv4_addresses]"); + goto end; + } + ipv4_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_addresses_local, ipv4_addresses) { + if (!cJSON_IsString(ipv4_addresses_local)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(ipv4_addressesList, ogs_strdup(ipv4_addresses_local->valuestring)); + } + } + + cJSON *ipv6_prefixes = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "ipv6Prefixes"); + + OpenAPI_list_t *ipv6_prefixesList; + if (ipv6_prefixes) { + cJSON *ipv6_prefixes_local; + if (!cJSON_IsArray(ipv6_prefixes)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv6_prefixes]"); + goto end; + } + ipv6_prefixesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_prefixes_local, ipv6_prefixes) { + if (!cJSON_IsString(ipv6_prefixes_local)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv6_prefixes]"); + goto end; + } + OpenAPI_list_add(ipv6_prefixesList, ogs_strdup(ipv6_prefixes_local->valuestring)); + } + } + + cJSON *ipv4_addr_ranges = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "ipv4AddrRanges"); + + OpenAPI_list_t *ipv4_addr_rangesList; + if (ipv4_addr_ranges) { + cJSON *ipv4_addr_ranges_local_nonprimitive; + if (!cJSON_IsArray(ipv4_addr_ranges)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv4_addr_ranges]"); + goto end; + } + + ipv4_addr_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_addr_ranges_local_nonprimitive, ipv4_addr_ranges ) { + if (!cJSON_IsObject(ipv4_addr_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv4_addr_ranges]"); + goto end; + } + OpenAPI_ipv4_address_range_t *ipv4_addr_rangesItem = OpenAPI_ipv4_address_range_parseFromJSON(ipv4_addr_ranges_local_nonprimitive); + + OpenAPI_list_add(ipv4_addr_rangesList, ipv4_addr_rangesItem); + } + } + + cJSON *ipv6_prefix_ranges = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "ipv6PrefixRanges"); + + OpenAPI_list_t *ipv6_prefix_rangesList; + if (ipv6_prefix_ranges) { + cJSON *ipv6_prefix_ranges_local_nonprimitive; + if (!cJSON_IsArray(ipv6_prefix_ranges)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + + ipv6_prefix_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_prefix_ranges_local_nonprimitive, ipv6_prefix_ranges ) { + if (!cJSON_IsObject(ipv6_prefix_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + OpenAPI_ipv6_prefix_range_t *ipv6_prefix_rangesItem = OpenAPI_ipv6_prefix_range_parseFromJSON(ipv6_prefix_ranges_local_nonprimitive); + + OpenAPI_list_add(ipv6_prefix_rangesList, ipv6_prefix_rangesItem); + } + } + + cJSON *served_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "servedNfSetIdList"); + + OpenAPI_list_t *served_nf_set_id_listList; + if (served_nf_set_id_list) { + cJSON *served_nf_set_id_list_local; + if (!cJSON_IsArray(served_nf_set_id_list)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [served_nf_set_id_list]"); + goto end; + } + served_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(served_nf_set_id_list_local, served_nf_set_id_list) { + if (!cJSON_IsString(served_nf_set_id_list_local)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [served_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(served_nf_set_id_listList, ogs_strdup(served_nf_set_id_list_local->valuestring)); + } + } + + cJSON *remote_plmn_list = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "remotePlmnList"); + + OpenAPI_list_t *remote_plmn_listList; + if (remote_plmn_list) { + cJSON *remote_plmn_list_local_nonprimitive; + if (!cJSON_IsArray(remote_plmn_list)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + + remote_plmn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_plmn_list_local_nonprimitive, remote_plmn_list ) { + if (!cJSON_IsObject(remote_plmn_list_local_nonprimitive)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + OpenAPI_plmn_id_t *remote_plmn_listItem = OpenAPI_plmn_id_parseFromJSON(remote_plmn_list_local_nonprimitive); + + OpenAPI_list_add(remote_plmn_listList, remote_plmn_listItem); + } + } + + scp_info_local_var = OpenAPI_scp_info_create ( + scp_domain_info_list ? scp_domain_info_listList : NULL, + scp_prefix ? ogs_strdup(scp_prefix->valuestring) : NULL, + scp_ports ? scp_portsList : NULL, + address_domains ? address_domainsList : NULL, + ipv4_addresses ? ipv4_addressesList : NULL, + ipv6_prefixes ? ipv6_prefixesList : NULL, + ipv4_addr_ranges ? ipv4_addr_rangesList : NULL, + ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL, + served_nf_set_id_list ? served_nf_set_id_listList : NULL, + remote_plmn_list ? remote_plmn_listList : NULL + ); + + return scp_info_local_var; +end: + return NULL; +} + +OpenAPI_scp_info_t *OpenAPI_scp_info_copy(OpenAPI_scp_info_t *dst, OpenAPI_scp_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scp_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scp_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_scp_info_free(dst); + dst = OpenAPI_scp_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scp_info.h b/lib/sbi/openapi/model/scp_info.h new file mode 100644 index 000000000..3b4c275da --- /dev/null +++ b/lib/sbi/openapi/model/scp_info.h @@ -0,0 +1,60 @@ +/* + * scp_info.h + * + * Information of an SCP Instance + */ + +#ifndef _OpenAPI_scp_info_H_ +#define _OpenAPI_scp_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ipv4_address_range.h" +#include "ipv6_prefix_range.h" +#include "plmn_id.h" +#include "scp_domain_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_scp_info_s OpenAPI_scp_info_t; +typedef struct OpenAPI_scp_info_s { + OpenAPI_list_t* scp_domain_info_list; + char *scp_prefix; + OpenAPI_list_t* scp_ports; + OpenAPI_list_t *address_domains; + OpenAPI_list_t *ipv4_addresses; + OpenAPI_list_t *ipv6_prefixes; + OpenAPI_list_t *ipv4_addr_ranges; + OpenAPI_list_t *ipv6_prefix_ranges; + OpenAPI_list_t *served_nf_set_id_list; + OpenAPI_list_t *remote_plmn_list; +} OpenAPI_scp_info_t; + +OpenAPI_scp_info_t *OpenAPI_scp_info_create( + OpenAPI_list_t* scp_domain_info_list, + char *scp_prefix, + OpenAPI_list_t* scp_ports, + OpenAPI_list_t *address_domains, + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_prefixes, + OpenAPI_list_t *ipv4_addr_ranges, + OpenAPI_list_t *ipv6_prefix_ranges, + OpenAPI_list_t *served_nf_set_id_list, + OpenAPI_list_t *remote_plmn_list + ); +void OpenAPI_scp_info_free(OpenAPI_scp_info_t *scp_info); +OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON); +cJSON *OpenAPI_scp_info_convertToJSON(OpenAPI_scp_info_t *scp_info); +OpenAPI_scp_info_t *OpenAPI_scp_info_copy(OpenAPI_scp_info_t *dst, OpenAPI_scp_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_info_H_ */ + diff --git a/lib/sbi/openapi/model/sd_range.c b/lib/sbi/openapi/model/sd_range.c new file mode 100644 index 000000000..5473e515e --- /dev/null +++ b/lib/sbi/openapi/model/sd_range.c @@ -0,0 +1,125 @@ + +#include +#include +#include +#include "sd_range.h" + +OpenAPI_sd_range_t *OpenAPI_sd_range_create( + char *start, + char *end + ) +{ + OpenAPI_sd_range_t *sd_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_sd_range_t)); + if (!sd_range_local_var) { + return NULL; + } + sd_range_local_var->start = start; + sd_range_local_var->end = end; + + return sd_range_local_var; +} + +void OpenAPI_sd_range_free(OpenAPI_sd_range_t *sd_range) +{ + if (NULL == sd_range) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(sd_range->start); + ogs_free(sd_range->end); + ogs_free(sd_range); +} + +cJSON *OpenAPI_sd_range_convertToJSON(OpenAPI_sd_range_t *sd_range) +{ + cJSON *item = NULL; + + if (sd_range == NULL) { + ogs_error("OpenAPI_sd_range_convertToJSON() failed [SdRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sd_range->start) { + if (cJSON_AddStringToObject(item, "start", sd_range->start) == NULL) { + ogs_error("OpenAPI_sd_range_convertToJSON() failed [start]"); + goto end; + } + } + + if (sd_range->end) { + if (cJSON_AddStringToObject(item, "end", sd_range->end) == NULL) { + ogs_error("OpenAPI_sd_range_convertToJSON() failed [end]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sd_range_t *OpenAPI_sd_range_parseFromJSON(cJSON *sd_rangeJSON) +{ + OpenAPI_sd_range_t *sd_range_local_var = NULL; + cJSON *start = cJSON_GetObjectItemCaseSensitive(sd_rangeJSON, "start"); + + if (start) { + if (!cJSON_IsString(start)) { + ogs_error("OpenAPI_sd_range_parseFromJSON() failed [start]"); + goto end; + } + } + + cJSON *end = cJSON_GetObjectItemCaseSensitive(sd_rangeJSON, "end"); + + if (end) { + if (!cJSON_IsString(end)) { + ogs_error("OpenAPI_sd_range_parseFromJSON() failed [end]"); + goto end; + } + } + + sd_range_local_var = OpenAPI_sd_range_create ( + start ? ogs_strdup(start->valuestring) : NULL, + end ? ogs_strdup(end->valuestring) : NULL + ); + + return sd_range_local_var; +end: + return NULL; +} + +OpenAPI_sd_range_t *OpenAPI_sd_range_copy(OpenAPI_sd_range_t *dst, OpenAPI_sd_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sd_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sd_range_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_sd_range_free(dst); + dst = OpenAPI_sd_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sd_range.h b/lib/sbi/openapi/model/sd_range.h new file mode 100644 index 000000000..180880143 --- /dev/null +++ b/lib/sbi/openapi/model/sd_range.h @@ -0,0 +1,40 @@ +/* + * sd_range.h + * + * A range of SDs (Slice Differentiators) + */ + +#ifndef _OpenAPI_sd_range_H_ +#define _OpenAPI_sd_range_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sd_range_s OpenAPI_sd_range_t; +typedef struct OpenAPI_sd_range_s { + char *start; + char *end; +} OpenAPI_sd_range_t; + +OpenAPI_sd_range_t *OpenAPI_sd_range_create( + char *start, + char *end + ); +void OpenAPI_sd_range_free(OpenAPI_sd_range_t *sd_range); +OpenAPI_sd_range_t *OpenAPI_sd_range_parseFromJSON(cJSON *sd_rangeJSON); +cJSON *OpenAPI_sd_range_convertToJSON(OpenAPI_sd_range_t *sd_range); +OpenAPI_sd_range_t *OpenAPI_sd_range_copy(OpenAPI_sd_range_t *dst, OpenAPI_sd_range_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sd_range_H_ */ + diff --git a/lib/sbi/openapi/model/sdm_subscription.c b/lib/sbi/openapi/model/sdm_subscription.c index 3bc0e7150..e7db03027 100644 --- a/lib/sbi/openapi/model/sdm_subscription.c +++ b/lib/sbi/openapi/model/sdm_subscription.c @@ -16,7 +16,9 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( char *subscription_id, OpenAPI_plmn_id_t *plmn_id, int immediate_report, - OpenAPI_subscription_data_sets_t *report + OpenAPI_subscription_data_sets_t *report, + char *supported_features, + OpenAPI_context_info_t *context_info ) { OpenAPI_sdm_subscription_t *sdm_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_sdm_subscription_t)); @@ -35,6 +37,8 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( sdm_subscription_local_var->plmn_id = plmn_id; sdm_subscription_local_var->immediate_report = immediate_report; sdm_subscription_local_var->report = report; + sdm_subscription_local_var->supported_features = supported_features; + sdm_subscription_local_var->context_info = context_info; return sdm_subscription_local_var; } @@ -58,6 +62,8 @@ void OpenAPI_sdm_subscription_free(OpenAPI_sdm_subscription_t *sdm_subscription) ogs_free(sdm_subscription->subscription_id); OpenAPI_plmn_id_free(sdm_subscription->plmn_id); OpenAPI_subscription_data_sets_free(sdm_subscription->report); + ogs_free(sdm_subscription->supported_features); + OpenAPI_context_info_free(sdm_subscription->context_info); ogs_free(sdm_subscription); } @@ -188,6 +194,26 @@ cJSON *OpenAPI_sdm_subscription_convertToJSON(OpenAPI_sdm_subscription_t *sdm_su } } + if (sdm_subscription->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sdm_subscription->supported_features) == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (sdm_subscription->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(sdm_subscription->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [context_info]"); + goto end; + } + } + end: return item; } @@ -317,6 +343,22 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_su report_local_nonprim = OpenAPI_subscription_data_sets_parseFromJSON(report); } + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_sdm_subscription_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + cJSON *context_info = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "contextInfo"); + + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + sdm_subscription_local_var = OpenAPI_sdm_subscription_create ( ogs_strdup(nf_instance_id->valuestring), implicit_unsubscribe ? implicit_unsubscribe->valueint : 0, @@ -329,7 +371,9 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_su subscription_id ? ogs_strdup(subscription_id->valuestring) : NULL, plmn_id ? plmn_id_local_nonprim : NULL, immediate_report ? immediate_report->valueint : 0, - report ? report_local_nonprim : NULL + report ? report_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL ); return sdm_subscription_local_var; diff --git a/lib/sbi/openapi/model/sdm_subscription.h b/lib/sbi/openapi/model/sdm_subscription.h index 1282a61d1..07e194cea 100644 --- a/lib/sbi/openapi/model/sdm_subscription.h +++ b/lib/sbi/openapi/model/sdm_subscription.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "context_info.h" #include "plmn_id.h" #include "snssai.h" #include "subscription_data_sets.h" @@ -34,6 +35,8 @@ typedef struct OpenAPI_sdm_subscription_s { struct OpenAPI_plmn_id_s *plmn_id; int immediate_report; struct OpenAPI_subscription_data_sets_s *report; + char *supported_features; + struct OpenAPI_context_info_s *context_info; } OpenAPI_sdm_subscription_t; OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( @@ -48,7 +51,9 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( char *subscription_id, OpenAPI_plmn_id_t *plmn_id, int immediate_report, - OpenAPI_subscription_data_sets_t *report + OpenAPI_subscription_data_sets_t *report, + char *supported_features, + OpenAPI_context_info_t *context_info ); void OpenAPI_sdm_subscription_free(OpenAPI_sdm_subscription_t *sdm_subscription); OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_subscriptionJSON); diff --git a/lib/sbi/openapi/model/security_result.c b/lib/sbi/openapi/model/security_result.c new file mode 100644 index 000000000..c42917dfe --- /dev/null +++ b/lib/sbi/openapi/model/security_result.c @@ -0,0 +1,127 @@ + +#include +#include +#include +#include "security_result.h" + +OpenAPI_security_result_t *OpenAPI_security_result_create( + OpenAPI_protection_result_e integrity_protection_result, + OpenAPI_protection_result_e confidentiality_protection_result + ) +{ + OpenAPI_security_result_t *security_result_local_var = OpenAPI_malloc(sizeof(OpenAPI_security_result_t)); + if (!security_result_local_var) { + return NULL; + } + security_result_local_var->integrity_protection_result = integrity_protection_result; + security_result_local_var->confidentiality_protection_result = confidentiality_protection_result; + + return security_result_local_var; +} + +void OpenAPI_security_result_free(OpenAPI_security_result_t *security_result) +{ + if (NULL == security_result) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(security_result); +} + +cJSON *OpenAPI_security_result_convertToJSON(OpenAPI_security_result_t *security_result) +{ + cJSON *item = NULL; + + if (security_result == NULL) { + ogs_error("OpenAPI_security_result_convertToJSON() failed [SecurityResult]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (security_result->integrity_protection_result) { + if (cJSON_AddStringToObject(item, "integrityProtectionResult", OpenAPI_protection_result_ToString(security_result->integrity_protection_result)) == NULL) { + ogs_error("OpenAPI_security_result_convertToJSON() failed [integrity_protection_result]"); + goto end; + } + } + + if (security_result->confidentiality_protection_result) { + if (cJSON_AddStringToObject(item, "confidentialityProtectionResult", OpenAPI_protection_result_ToString(security_result->confidentiality_protection_result)) == NULL) { + ogs_error("OpenAPI_security_result_convertToJSON() failed [confidentiality_protection_result]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_security_result_t *OpenAPI_security_result_parseFromJSON(cJSON *security_resultJSON) +{ + OpenAPI_security_result_t *security_result_local_var = NULL; + cJSON *integrity_protection_result = cJSON_GetObjectItemCaseSensitive(security_resultJSON, "integrityProtectionResult"); + + OpenAPI_protection_result_e integrity_protection_resultVariable; + if (integrity_protection_result) { + if (!cJSON_IsString(integrity_protection_result)) { + ogs_error("OpenAPI_security_result_parseFromJSON() failed [integrity_protection_result]"); + goto end; + } + integrity_protection_resultVariable = OpenAPI_protection_result_FromString(integrity_protection_result->valuestring); + } + + cJSON *confidentiality_protection_result = cJSON_GetObjectItemCaseSensitive(security_resultJSON, "confidentialityProtectionResult"); + + OpenAPI_protection_result_e confidentiality_protection_resultVariable; + if (confidentiality_protection_result) { + if (!cJSON_IsString(confidentiality_protection_result)) { + ogs_error("OpenAPI_security_result_parseFromJSON() failed [confidentiality_protection_result]"); + goto end; + } + confidentiality_protection_resultVariable = OpenAPI_protection_result_FromString(confidentiality_protection_result->valuestring); + } + + security_result_local_var = OpenAPI_security_result_create ( + integrity_protection_result ? integrity_protection_resultVariable : 0, + confidentiality_protection_result ? confidentiality_protection_resultVariable : 0 + ); + + return security_result_local_var; +end: + return NULL; +} + +OpenAPI_security_result_t *OpenAPI_security_result_copy(OpenAPI_security_result_t *dst, OpenAPI_security_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_security_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_security_result_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_security_result_free(dst); + dst = OpenAPI_security_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/security_result.h b/lib/sbi/openapi/model/security_result.h new file mode 100644 index 000000000..5c8a522f1 --- /dev/null +++ b/lib/sbi/openapi/model/security_result.h @@ -0,0 +1,41 @@ +/* + * security_result.h + * + * + */ + +#ifndef _OpenAPI_security_result_H_ +#define _OpenAPI_security_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "protection_result.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_security_result_s OpenAPI_security_result_t; +typedef struct OpenAPI_security_result_s { + OpenAPI_protection_result_e integrity_protection_result; + OpenAPI_protection_result_e confidentiality_protection_result; +} OpenAPI_security_result_t; + +OpenAPI_security_result_t *OpenAPI_security_result_create( + OpenAPI_protection_result_e integrity_protection_result, + OpenAPI_protection_result_e confidentiality_protection_result + ); +void OpenAPI_security_result_free(OpenAPI_security_result_t *security_result); +OpenAPI_security_result_t *OpenAPI_security_result_parseFromJSON(cJSON *security_resultJSON); +cJSON *OpenAPI_security_result_convertToJSON(OpenAPI_security_result_t *security_result); +OpenAPI_security_result_t *OpenAPI_security_result_copy(OpenAPI_security_result_t *dst, OpenAPI_security_result_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_security_result_H_ */ + diff --git a/lib/sbi/openapi/model/send_mo_data_req_data.c b/lib/sbi/openapi/model/send_mo_data_req_data.c index cffa8b81b..9e414357a 100644 --- a/lib/sbi/openapi/model/send_mo_data_req_data.c +++ b/lib/sbi/openapi/model/send_mo_data_req_data.c @@ -6,7 +6,6 @@ OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_create( OpenAPI_ref_to_binary_data_t *mo_data, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, OpenAPI_user_location_t *ue_location ) @@ -16,7 +15,6 @@ OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_create( return NULL; } send_mo_data_req_data_local_var->mo_data = mo_data; - send_mo_data_req_data_local_var->mo_exp_data_ind = mo_exp_data_ind; send_mo_data_req_data_local_var->mo_exp_data_counter = mo_exp_data_counter; send_mo_data_req_data_local_var->ue_location = ue_location; @@ -30,7 +28,6 @@ void OpenAPI_send_mo_data_req_data_free(OpenAPI_send_mo_data_req_data_t *send_mo } OpenAPI_lnode_t *node; OpenAPI_ref_to_binary_data_free(send_mo_data_req_data->mo_data); - OpenAPI_mo_exception_data_flag_free(send_mo_data_req_data->mo_exp_data_ind); OpenAPI_mo_exp_data_counter_free(send_mo_data_req_data->mo_exp_data_counter); OpenAPI_user_location_free(send_mo_data_req_data->ue_location); ogs_free(send_mo_data_req_data); @@ -61,19 +58,6 @@ cJSON *OpenAPI_send_mo_data_req_data_convertToJSON(OpenAPI_send_mo_data_req_data goto end; } - if (send_mo_data_req_data->mo_exp_data_ind) { - cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(send_mo_data_req_data->mo_exp_data_ind); - if (mo_exp_data_ind_local_JSON == NULL) { - ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_send_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - } - if (send_mo_data_req_data->mo_exp_data_counter) { cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(send_mo_data_req_data->mo_exp_data_counter); if (mo_exp_data_counter_local_JSON == NULL) { @@ -117,13 +101,6 @@ OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_parseFromJSON(cJS mo_data_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(mo_data); - cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(send_mo_data_req_dataJSON, "moExpDataInd"); - - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; - if (mo_exp_data_ind) { - mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); - } - cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(send_mo_data_req_dataJSON, "moExpDataCounter"); OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; @@ -140,7 +117,6 @@ OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_parseFromJSON(cJS send_mo_data_req_data_local_var = OpenAPI_send_mo_data_req_data_create ( mo_data_local_nonprim, - mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, ue_location ? ue_location_local_nonprim : NULL ); diff --git a/lib/sbi/openapi/model/send_mo_data_req_data.h b/lib/sbi/openapi/model/send_mo_data_req_data.h index 9c8420e79..704ba33e2 100644 --- a/lib/sbi/openapi/model/send_mo_data_req_data.h +++ b/lib/sbi/openapi/model/send_mo_data_req_data.h @@ -12,7 +12,6 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "mo_exception_data_flag.h" #include "mo_exp_data_counter.h" #include "ref_to_binary_data.h" #include "user_location.h" @@ -24,14 +23,12 @@ extern "C" { typedef struct OpenAPI_send_mo_data_req_data_s OpenAPI_send_mo_data_req_data_t; typedef struct OpenAPI_send_mo_data_req_data_s { struct OpenAPI_ref_to_binary_data_s *mo_data; - struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; struct OpenAPI_user_location_s *ue_location; } OpenAPI_send_mo_data_req_data_t; OpenAPI_send_mo_data_req_data_t *OpenAPI_send_mo_data_req_data_create( OpenAPI_ref_to_binary_data_t *mo_data, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, OpenAPI_user_location_t *ue_location ); diff --git a/lib/sbi/openapi/model/sensor_measurement.c b/lib/sbi/openapi/model/sensor_measurement.c new file mode 100644 index 000000000..34cc71631 --- /dev/null +++ b/lib/sbi/openapi/model/sensor_measurement.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "sensor_measurement.h" + +char* OpenAPI_sensor_measurement_ToString(OpenAPI_sensor_measurement_e sensor_measurement) +{ + const char *sensor_measurementArray[] = { "NULL", "BAROMETRIC_PRESSURE", "UE_SPEED", "UE_ORIENTATION" }; + size_t sizeofArray = sizeof(sensor_measurementArray) / sizeof(sensor_measurementArray[0]); + if (sensor_measurement < sizeofArray) + return (char *)sensor_measurementArray[sensor_measurement]; + else + return (char *)"Unknown"; +} + +OpenAPI_sensor_measurement_e OpenAPI_sensor_measurement_FromString(char* sensor_measurement) +{ + int stringToReturn = 0; + const char *sensor_measurementArray[] = { "NULL", "BAROMETRIC_PRESSURE", "UE_SPEED", "UE_ORIENTATION" }; + size_t sizeofArray = sizeof(sensor_measurementArray) / sizeof(sensor_measurementArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(sensor_measurement, sensor_measurementArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/sensor_measurement.h b/lib/sbi/openapi/model/sensor_measurement.h new file mode 100644 index 000000000..de11ad3a1 --- /dev/null +++ b/lib/sbi/openapi/model/sensor_measurement.h @@ -0,0 +1,31 @@ +/* + * sensor_measurement.h + * + * + */ + +#ifndef _OpenAPI_sensor_measurement_H_ +#define _OpenAPI_sensor_measurement_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_sensor_measurement_NULL = 0, OpenAPI_sensor_measurement_BAROMETRIC_PRESSURE, OpenAPI_sensor_measurement_UE_SPEED, OpenAPI_sensor_measurement_UE_ORIENTATION } OpenAPI_sensor_measurement_e; + +char* OpenAPI_sensor_measurement_ToString(OpenAPI_sensor_measurement_e sensor_measurement); + +OpenAPI_sensor_measurement_e OpenAPI_sensor_measurement_FromString(char* sensor_measurement); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sensor_measurement_H_ */ + diff --git a/lib/sbi/openapi/model/service_type_unrelated_class.c b/lib/sbi/openapi/model/service_type_unrelated_class.c index d102c7c65..c47018d70 100644 --- a/lib/sbi/openapi/model/service_type_unrelated_class.c +++ b/lib/sbi/openapi/model/service_type_unrelated_class.c @@ -9,7 +9,8 @@ OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_cre OpenAPI_list_t *allowed_geographic_area, OpenAPI_privacy_check_related_action_e privacy_check_related_action, OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_t *valid_time_period + OpenAPI_valid_time_period_t *valid_time_period, + OpenAPI_list_t *code_word_list ) { OpenAPI_service_type_unrelated_class_t *service_type_unrelated_class_local_var = OpenAPI_malloc(sizeof(OpenAPI_service_type_unrelated_class_t)); @@ -21,6 +22,7 @@ OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_cre service_type_unrelated_class_local_var->privacy_check_related_action = privacy_check_related_action; service_type_unrelated_class_local_var->code_word_ind = code_word_ind; service_type_unrelated_class_local_var->valid_time_period = valid_time_period; + service_type_unrelated_class_local_var->code_word_list = code_word_list; return service_type_unrelated_class_local_var; } @@ -36,6 +38,10 @@ void OpenAPI_service_type_unrelated_class_free(OpenAPI_service_type_unrelated_cl } OpenAPI_list_free(service_type_unrelated_class->allowed_geographic_area); OpenAPI_valid_time_period_free(service_type_unrelated_class->valid_time_period); + OpenAPI_list_for_each(service_type_unrelated_class->code_word_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_type_unrelated_class->code_word_list); ogs_free(service_type_unrelated_class); } @@ -105,6 +111,22 @@ cJSON *OpenAPI_service_type_unrelated_class_convertToJSON(OpenAPI_service_type_u } } + if (service_type_unrelated_class->code_word_list) { + cJSON *code_word_list = cJSON_AddArrayToObject(item, "codeWordList"); + if (code_word_list == NULL) { + ogs_error("OpenAPI_service_type_unrelated_class_convertToJSON() failed [code_word_list]"); + goto end; + } + + OpenAPI_lnode_t *code_word_list_node; + OpenAPI_list_for_each(service_type_unrelated_class->code_word_list, code_word_list_node) { + if (cJSON_AddStringToObject(code_word_list, "", (char*)code_word_list_node->data) == NULL) { + ogs_error("OpenAPI_service_type_unrelated_class_convertToJSON() failed [code_word_list]"); + goto end; + } + } + } + end: return item; } @@ -176,12 +198,33 @@ OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_par valid_time_period_local_nonprim = OpenAPI_valid_time_period_parseFromJSON(valid_time_period); } + cJSON *code_word_list = cJSON_GetObjectItemCaseSensitive(service_type_unrelated_classJSON, "codeWordList"); + + OpenAPI_list_t *code_word_listList; + if (code_word_list) { + cJSON *code_word_list_local; + if (!cJSON_IsArray(code_word_list)) { + ogs_error("OpenAPI_service_type_unrelated_class_parseFromJSON() failed [code_word_list]"); + goto end; + } + code_word_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(code_word_list_local, code_word_list) { + if (!cJSON_IsString(code_word_list_local)) { + ogs_error("OpenAPI_service_type_unrelated_class_parseFromJSON() failed [code_word_list]"); + goto end; + } + OpenAPI_list_add(code_word_listList, ogs_strdup(code_word_list_local->valuestring)); + } + } + service_type_unrelated_class_local_var = OpenAPI_service_type_unrelated_class_create ( service_type->valuedouble, allowed_geographic_area ? allowed_geographic_areaList : NULL, privacy_check_related_action ? privacy_check_related_actionVariable : 0, code_word_ind ? code_word_indVariable : 0, - valid_time_period ? valid_time_period_local_nonprim : NULL + valid_time_period ? valid_time_period_local_nonprim : NULL, + code_word_list ? code_word_listList : NULL ); return service_type_unrelated_class_local_var; diff --git a/lib/sbi/openapi/model/service_type_unrelated_class.h b/lib/sbi/openapi/model/service_type_unrelated_class.h index a4c5a99a4..43703fbdd 100644 --- a/lib/sbi/openapi/model/service_type_unrelated_class.h +++ b/lib/sbi/openapi/model/service_type_unrelated_class.h @@ -28,6 +28,7 @@ typedef struct OpenAPI_service_type_unrelated_class_s { OpenAPI_privacy_check_related_action_e privacy_check_related_action; OpenAPI_code_word_ind_e code_word_ind; struct OpenAPI_valid_time_period_s *valid_time_period; + OpenAPI_list_t *code_word_list; } OpenAPI_service_type_unrelated_class_t; OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_create( @@ -35,7 +36,8 @@ OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_cre OpenAPI_list_t *allowed_geographic_area, OpenAPI_privacy_check_related_action_e privacy_check_related_action, OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_t *valid_time_period + OpenAPI_valid_time_period_t *valid_time_period, + OpenAPI_list_t *code_word_list ); void OpenAPI_service_type_unrelated_class_free(OpenAPI_service_type_unrelated_class_t *service_type_unrelated_class); OpenAPI_service_type_unrelated_class_t *OpenAPI_service_type_unrelated_class_parseFromJSON(cJSON *service_type_unrelated_classJSON); diff --git a/lib/sbi/openapi/model/session_management_subscription_data.c b/lib/sbi/openapi/model/session_management_subscription_data.c index 73fbf4c85..ad60c9cce 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data.c +++ b/lib/sbi/openapi/model/session_management_subscription_data.c @@ -8,10 +8,9 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc OpenAPI_snssai_t *single_nssai, OpenAPI_list_t* dnn_configurations, OpenAPI_list_t *internal_group_ids, - OpenAPI_list_t* vn_group_info, OpenAPI_list_t* shared_vn_group_data_ids, char *shared_dnn_configurations_id, - OpenAPI_odb_packet_services_t *odb_packet_services, + OpenAPI_odb_packet_services_e odb_packet_services, OpenAPI_trace_data_t *trace_data, char *shared_trace_data_id, OpenAPI_list_t* expected_ue_behaviours_list, @@ -26,7 +25,6 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc session_management_subscription_data_local_var->single_nssai = single_nssai; session_management_subscription_data_local_var->dnn_configurations = dnn_configurations; session_management_subscription_data_local_var->internal_group_ids = internal_group_ids; - session_management_subscription_data_local_var->vn_group_info = vn_group_info; session_management_subscription_data_local_var->shared_vn_group_data_ids = shared_vn_group_data_ids; session_management_subscription_data_local_var->shared_dnn_configurations_id = shared_dnn_configurations_id; session_management_subscription_data_local_var->odb_packet_services = odb_packet_services; @@ -56,12 +54,6 @@ void OpenAPI_session_management_subscription_data_free(OpenAPI_session_managemen ogs_free(node->data); } OpenAPI_list_free(session_management_subscription_data->internal_group_ids); - OpenAPI_list_for_each(session_management_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(session_management_subscription_data->vn_group_info); OpenAPI_list_for_each(session_management_subscription_data->shared_vn_group_data_ids, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->value); @@ -69,7 +61,6 @@ void OpenAPI_session_management_subscription_data_free(OpenAPI_session_managemen } OpenAPI_list_free(session_management_subscription_data->shared_vn_group_data_ids); ogs_free(session_management_subscription_data->shared_dnn_configurations_id); - OpenAPI_odb_packet_services_free(session_management_subscription_data->odb_packet_services); OpenAPI_trace_data_free(session_management_subscription_data->trace_data); ogs_free(session_management_subscription_data->shared_trace_data_id); OpenAPI_list_for_each(session_management_subscription_data->expected_ue_behaviours_list, node) { @@ -150,27 +141,6 @@ cJSON *OpenAPI_session_management_subscription_data_convertToJSON(OpenAPI_sessio } } - if (session_management_subscription_data->vn_group_info) { - cJSON *vn_group_info = cJSON_AddObjectToObject(item, "vnGroupInfo"); - if (vn_group_info == NULL) { - ogs_error("OpenAPI_session_management_subscription_data_convertToJSON() failed [vn_group_info]"); - goto end; - } - cJSON *localMapObject = vn_group_info; - OpenAPI_lnode_t *vn_group_info_node; - if (session_management_subscription_data->vn_group_info) { - OpenAPI_list_for_each(session_management_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_session_management_subscription_data_convertToJSON() failed [vn_group_info]"); - goto end; - } - cJSON_AddItemToObject(vn_group_info, localKeyValue->key, itemLocal); - } - } - } - if (session_management_subscription_data->shared_vn_group_data_ids) { cJSON *shared_vn_group_data_ids = cJSON_AddObjectToObject(item, "sharedVnGroupDataIds"); if (shared_vn_group_data_ids == NULL) { @@ -194,13 +164,7 @@ cJSON *OpenAPI_session_management_subscription_data_convertToJSON(OpenAPI_sessio } if (session_management_subscription_data->odb_packet_services) { - cJSON *odb_packet_services_local_JSON = OpenAPI_odb_packet_services_convertToJSON(session_management_subscription_data->odb_packet_services); - if (odb_packet_services_local_JSON == NULL) { - ogs_error("OpenAPI_session_management_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(session_management_subscription_data->odb_packet_services)) == NULL) { ogs_error("OpenAPI_session_management_subscription_data_convertToJSON() failed [odb_packet_services]"); goto end; } @@ -335,29 +299,6 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc } } - cJSON *vn_group_info = cJSON_GetObjectItemCaseSensitive(session_management_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_session_management_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_session_management_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(session_management_subscription_dataJSON, "sharedVnGroupDataIds"); OpenAPI_list_t *shared_vn_group_data_idsList; @@ -386,9 +327,13 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc cJSON *odb_packet_services = cJSON_GetObjectItemCaseSensitive(session_management_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_session_management_subscription_data_parseFromJSON() failed [odb_packet_services]"); + goto end; + } + odb_packet_servicesVariable = OpenAPI_odb_packet_services_FromString(odb_packet_services->valuestring); } cJSON *trace_data = cJSON_GetObjectItemCaseSensitive(session_management_subscription_dataJSON, "traceData"); @@ -466,10 +411,9 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc single_nssai_local_nonprim, dnn_configurations ? dnn_configurationsList : 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, shared_dnn_configurations_id ? ogs_strdup(shared_dnn_configurations_id->valuestring) : NULL, - odb_packet_services ? odb_packet_services_local_nonprim : NULL, + odb_packet_services ? odb_packet_servicesVariable : 0, trace_data ? trace_data_local_nonprim : NULL, shared_trace_data_id ? ogs_strdup(shared_trace_data_id->valuestring) : NULL, expected_ue_behaviours_list ? expected_ue_behaviours_listList : NULL, diff --git a/lib/sbi/openapi/model/session_management_subscription_data.h b/lib/sbi/openapi/model/session_management_subscription_data.h index 0ee761551..16c690134 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data.h +++ b/lib/sbi/openapi/model/session_management_subscription_data.h @@ -18,7 +18,6 @@ #include "snssai.h" #include "suggested_packet_num_dl.h" #include "trace_data.h" -#include "vn_group_data.h" #ifdef __cplusplus extern "C" { @@ -29,10 +28,9 @@ typedef struct OpenAPI_session_management_subscription_data_s { struct OpenAPI_snssai_s *single_nssai; OpenAPI_list_t* dnn_configurations; OpenAPI_list_t *internal_group_ids; - OpenAPI_list_t* vn_group_info; OpenAPI_list_t* shared_vn_group_data_ids; char *shared_dnn_configurations_id; - struct OpenAPI_odb_packet_services_s *odb_packet_services; + OpenAPI_odb_packet_services_e odb_packet_services; struct OpenAPI_trace_data_s *trace_data; char *shared_trace_data_id; OpenAPI_list_t* expected_ue_behaviours_list; @@ -44,10 +42,9 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc OpenAPI_snssai_t *single_nssai, OpenAPI_list_t* dnn_configurations, OpenAPI_list_t *internal_group_ids, - OpenAPI_list_t* vn_group_info, OpenAPI_list_t* shared_vn_group_data_ids, char *shared_dnn_configurations_id, - OpenAPI_odb_packet_services_t *odb_packet_services, + OpenAPI_odb_packet_services_e odb_packet_services, OpenAPI_trace_data_t *trace_data, char *shared_trace_data_id, OpenAPI_list_t* expected_ue_behaviours_list, diff --git a/lib/sbi/openapi/model/slice_info_for_pdu_session.c b/lib/sbi/openapi/model/slice_info_for_pdu_session.c new file mode 100644 index 000000000..cc729dee0 --- /dev/null +++ b/lib/sbi/openapi/model/slice_info_for_pdu_session.c @@ -0,0 +1,164 @@ + +#include +#include +#include +#include "slice_info_for_pdu_session.h" + +OpenAPI_slice_info_for_pdu_session_t *OpenAPI_slice_info_for_pdu_session_create( + OpenAPI_snssai_t *s_nssai, + OpenAPI_roaming_indication_e roaming_indication, + OpenAPI_snssai_t *home_snssai + ) +{ + OpenAPI_slice_info_for_pdu_session_t *slice_info_for_pdu_session_local_var = OpenAPI_malloc(sizeof(OpenAPI_slice_info_for_pdu_session_t)); + if (!slice_info_for_pdu_session_local_var) { + return NULL; + } + slice_info_for_pdu_session_local_var->s_nssai = s_nssai; + slice_info_for_pdu_session_local_var->roaming_indication = roaming_indication; + slice_info_for_pdu_session_local_var->home_snssai = home_snssai; + + return slice_info_for_pdu_session_local_var; +} + +void OpenAPI_slice_info_for_pdu_session_free(OpenAPI_slice_info_for_pdu_session_t *slice_info_for_pdu_session) +{ + if (NULL == slice_info_for_pdu_session) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(slice_info_for_pdu_session->s_nssai); + OpenAPI_snssai_free(slice_info_for_pdu_session->home_snssai); + ogs_free(slice_info_for_pdu_session); +} + +cJSON *OpenAPI_slice_info_for_pdu_session_convertToJSON(OpenAPI_slice_info_for_pdu_session_t *slice_info_for_pdu_session) +{ + cJSON *item = NULL; + + if (slice_info_for_pdu_session == NULL) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [SliceInfoForPDUSession]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!slice_info_for_pdu_session->s_nssai) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(slice_info_for_pdu_session->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!slice_info_for_pdu_session->roaming_indication) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [roaming_indication]"); + goto end; + } + if (cJSON_AddStringToObject(item, "roamingIndication", OpenAPI_roaming_indication_ToString(slice_info_for_pdu_session->roaming_indication)) == NULL) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [roaming_indication]"); + goto end; + } + + if (slice_info_for_pdu_session->home_snssai) { + cJSON *home_snssai_local_JSON = OpenAPI_snssai_convertToJSON(slice_info_for_pdu_session->home_snssai); + if (home_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [home_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "homeSnssai", home_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() failed [home_snssai]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_slice_info_for_pdu_session_t *OpenAPI_slice_info_for_pdu_session_parseFromJSON(cJSON *slice_info_for_pdu_sessionJSON) +{ + OpenAPI_slice_info_for_pdu_session_t *slice_info_for_pdu_session_local_var = NULL; + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_pdu_sessionJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_slice_info_for_pdu_session_parseFromJSON() failed [s_nssai]"); + goto end; + } + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + + cJSON *roaming_indication = cJSON_GetObjectItemCaseSensitive(slice_info_for_pdu_sessionJSON, "roamingIndication"); + if (!roaming_indication) { + ogs_error("OpenAPI_slice_info_for_pdu_session_parseFromJSON() failed [roaming_indication]"); + goto end; + } + + OpenAPI_roaming_indication_e roaming_indicationVariable; + + if (!cJSON_IsString(roaming_indication)) { + ogs_error("OpenAPI_slice_info_for_pdu_session_parseFromJSON() failed [roaming_indication]"); + goto end; + } + roaming_indicationVariable = OpenAPI_roaming_indication_FromString(roaming_indication->valuestring); + + cJSON *home_snssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_pdu_sessionJSON, "homeSnssai"); + + OpenAPI_snssai_t *home_snssai_local_nonprim = NULL; + if (home_snssai) { + home_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(home_snssai); + } + + slice_info_for_pdu_session_local_var = OpenAPI_slice_info_for_pdu_session_create ( + s_nssai_local_nonprim, + roaming_indicationVariable, + home_snssai ? home_snssai_local_nonprim : NULL + ); + + return slice_info_for_pdu_session_local_var; +end: + return NULL; +} + +OpenAPI_slice_info_for_pdu_session_t *OpenAPI_slice_info_for_pdu_session_copy(OpenAPI_slice_info_for_pdu_session_t *dst, OpenAPI_slice_info_for_pdu_session_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_info_for_pdu_session_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_info_for_pdu_session_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_slice_info_for_pdu_session_free(dst); + dst = OpenAPI_slice_info_for_pdu_session_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_info_for_pdu_session.h b/lib/sbi/openapi/model/slice_info_for_pdu_session.h new file mode 100644 index 000000000..57a9ec358 --- /dev/null +++ b/lib/sbi/openapi/model/slice_info_for_pdu_session.h @@ -0,0 +1,44 @@ +/* + * slice_info_for_pdu_session.h + * + * + */ + +#ifndef _OpenAPI_slice_info_for_pdu_session_H_ +#define _OpenAPI_slice_info_for_pdu_session_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "roaming_indication.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_info_for_pdu_session_s OpenAPI_slice_info_for_pdu_session_t; +typedef struct OpenAPI_slice_info_for_pdu_session_s { + struct OpenAPI_snssai_s *s_nssai; + OpenAPI_roaming_indication_e roaming_indication; + struct OpenAPI_snssai_s *home_snssai; +} OpenAPI_slice_info_for_pdu_session_t; + +OpenAPI_slice_info_for_pdu_session_t *OpenAPI_slice_info_for_pdu_session_create( + OpenAPI_snssai_t *s_nssai, + OpenAPI_roaming_indication_e roaming_indication, + OpenAPI_snssai_t *home_snssai + ); +void OpenAPI_slice_info_for_pdu_session_free(OpenAPI_slice_info_for_pdu_session_t *slice_info_for_pdu_session); +OpenAPI_slice_info_for_pdu_session_t *OpenAPI_slice_info_for_pdu_session_parseFromJSON(cJSON *slice_info_for_pdu_sessionJSON); +cJSON *OpenAPI_slice_info_for_pdu_session_convertToJSON(OpenAPI_slice_info_for_pdu_session_t *slice_info_for_pdu_session); +OpenAPI_slice_info_for_pdu_session_t *OpenAPI_slice_info_for_pdu_session_copy(OpenAPI_slice_info_for_pdu_session_t *dst, OpenAPI_slice_info_for_pdu_session_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_info_for_pdu_session_H_ */ + diff --git a/lib/sbi/openapi/model/slice_info_for_registration.c b/lib/sbi/openapi/model/slice_info_for_registration.c new file mode 100644 index 000000000..0cef11580 --- /dev/null +++ b/lib/sbi/openapi/model/slice_info_for_registration.c @@ -0,0 +1,371 @@ + +#include +#include +#include +#include "slice_info_for_registration.h" + +OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_create( + OpenAPI_list_t *subscribed_nssai, + OpenAPI_allowed_nssai_t *allowed_nssai_current_access, + OpenAPI_allowed_nssai_t *allowed_nssai_other_access, + OpenAPI_list_t *s_nssai_for_mapping, + OpenAPI_list_t *requested_nssai, + int default_configured_snssai_ind, + OpenAPI_list_t *mapping_of_nssai, + int request_mapping + ) +{ + OpenAPI_slice_info_for_registration_t *slice_info_for_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_slice_info_for_registration_t)); + if (!slice_info_for_registration_local_var) { + return NULL; + } + slice_info_for_registration_local_var->subscribed_nssai = subscribed_nssai; + slice_info_for_registration_local_var->allowed_nssai_current_access = allowed_nssai_current_access; + slice_info_for_registration_local_var->allowed_nssai_other_access = allowed_nssai_other_access; + slice_info_for_registration_local_var->s_nssai_for_mapping = s_nssai_for_mapping; + slice_info_for_registration_local_var->requested_nssai = requested_nssai; + slice_info_for_registration_local_var->default_configured_snssai_ind = default_configured_snssai_ind; + slice_info_for_registration_local_var->mapping_of_nssai = mapping_of_nssai; + slice_info_for_registration_local_var->request_mapping = request_mapping; + + return slice_info_for_registration_local_var; +} + +void OpenAPI_slice_info_for_registration_free(OpenAPI_slice_info_for_registration_t *slice_info_for_registration) +{ + if (NULL == slice_info_for_registration) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(slice_info_for_registration->subscribed_nssai, node) { + OpenAPI_subscribed_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_registration->subscribed_nssai); + OpenAPI_allowed_nssai_free(slice_info_for_registration->allowed_nssai_current_access); + OpenAPI_allowed_nssai_free(slice_info_for_registration->allowed_nssai_other_access); + OpenAPI_list_for_each(slice_info_for_registration->s_nssai_for_mapping, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_registration->s_nssai_for_mapping); + OpenAPI_list_for_each(slice_info_for_registration->requested_nssai, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_registration->requested_nssai); + OpenAPI_list_for_each(slice_info_for_registration->mapping_of_nssai, node) { + OpenAPI_mapping_of_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_registration->mapping_of_nssai); + ogs_free(slice_info_for_registration); +} + +cJSON *OpenAPI_slice_info_for_registration_convertToJSON(OpenAPI_slice_info_for_registration_t *slice_info_for_registration) +{ + cJSON *item = NULL; + + if (slice_info_for_registration == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [SliceInfoForRegistration]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (slice_info_for_registration->subscribed_nssai) { + cJSON *subscribed_nssaiList = cJSON_AddArrayToObject(item, "subscribedNssai"); + if (subscribed_nssaiList == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [subscribed_nssai]"); + goto end; + } + + OpenAPI_lnode_t *subscribed_nssai_node; + if (slice_info_for_registration->subscribed_nssai) { + OpenAPI_list_for_each(slice_info_for_registration->subscribed_nssai, subscribed_nssai_node) { + cJSON *itemLocal = OpenAPI_subscribed_snssai_convertToJSON(subscribed_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [subscribed_nssai]"); + goto end; + } + cJSON_AddItemToArray(subscribed_nssaiList, itemLocal); + } + } + } + + if (slice_info_for_registration->allowed_nssai_current_access) { + cJSON *allowed_nssai_current_access_local_JSON = OpenAPI_allowed_nssai_convertToJSON(slice_info_for_registration->allowed_nssai_current_access); + if (allowed_nssai_current_access_local_JSON == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [allowed_nssai_current_access]"); + goto end; + } + cJSON_AddItemToObject(item, "allowedNssaiCurrentAccess", allowed_nssai_current_access_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [allowed_nssai_current_access]"); + goto end; + } + } + + if (slice_info_for_registration->allowed_nssai_other_access) { + cJSON *allowed_nssai_other_access_local_JSON = OpenAPI_allowed_nssai_convertToJSON(slice_info_for_registration->allowed_nssai_other_access); + if (allowed_nssai_other_access_local_JSON == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [allowed_nssai_other_access]"); + goto end; + } + cJSON_AddItemToObject(item, "allowedNssaiOtherAccess", allowed_nssai_other_access_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [allowed_nssai_other_access]"); + goto end; + } + } + + if (slice_info_for_registration->s_nssai_for_mapping) { + cJSON *s_nssai_for_mappingList = cJSON_AddArrayToObject(item, "sNssaiForMapping"); + if (s_nssai_for_mappingList == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [s_nssai_for_mapping]"); + goto end; + } + + OpenAPI_lnode_t *s_nssai_for_mapping_node; + if (slice_info_for_registration->s_nssai_for_mapping) { + OpenAPI_list_for_each(slice_info_for_registration->s_nssai_for_mapping, s_nssai_for_mapping_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(s_nssai_for_mapping_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [s_nssai_for_mapping]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_for_mappingList, itemLocal); + } + } + } + + if (slice_info_for_registration->requested_nssai) { + cJSON *requested_nssaiList = cJSON_AddArrayToObject(item, "requestedNssai"); + if (requested_nssaiList == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [requested_nssai]"); + goto end; + } + + OpenAPI_lnode_t *requested_nssai_node; + if (slice_info_for_registration->requested_nssai) { + OpenAPI_list_for_each(slice_info_for_registration->requested_nssai, requested_nssai_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(requested_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [requested_nssai]"); + goto end; + } + cJSON_AddItemToArray(requested_nssaiList, itemLocal); + } + } + } + + if (slice_info_for_registration->default_configured_snssai_ind) { + if (cJSON_AddBoolToObject(item, "defaultConfiguredSnssaiInd", slice_info_for_registration->default_configured_snssai_ind) == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [default_configured_snssai_ind]"); + goto end; + } + } + + if (slice_info_for_registration->mapping_of_nssai) { + cJSON *mapping_of_nssaiList = cJSON_AddArrayToObject(item, "mappingOfNssai"); + if (mapping_of_nssaiList == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [mapping_of_nssai]"); + goto end; + } + + OpenAPI_lnode_t *mapping_of_nssai_node; + if (slice_info_for_registration->mapping_of_nssai) { + OpenAPI_list_for_each(slice_info_for_registration->mapping_of_nssai, mapping_of_nssai_node) { + cJSON *itemLocal = OpenAPI_mapping_of_snssai_convertToJSON(mapping_of_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [mapping_of_nssai]"); + goto end; + } + cJSON_AddItemToArray(mapping_of_nssaiList, itemLocal); + } + } + } + + if (slice_info_for_registration->request_mapping) { + if (cJSON_AddBoolToObject(item, "requestMapping", slice_info_for_registration->request_mapping) == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [request_mapping]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_parseFromJSON(cJSON *slice_info_for_registrationJSON) +{ + OpenAPI_slice_info_for_registration_t *slice_info_for_registration_local_var = NULL; + cJSON *subscribed_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "subscribedNssai"); + + OpenAPI_list_t *subscribed_nssaiList; + if (subscribed_nssai) { + cJSON *subscribed_nssai_local_nonprimitive; + if (!cJSON_IsArray(subscribed_nssai)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [subscribed_nssai]"); + goto end; + } + + subscribed_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(subscribed_nssai_local_nonprimitive, subscribed_nssai ) { + if (!cJSON_IsObject(subscribed_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [subscribed_nssai]"); + goto end; + } + OpenAPI_subscribed_snssai_t *subscribed_nssaiItem = OpenAPI_subscribed_snssai_parseFromJSON(subscribed_nssai_local_nonprimitive); + + OpenAPI_list_add(subscribed_nssaiList, subscribed_nssaiItem); + } + } + + cJSON *allowed_nssai_current_access = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "allowedNssaiCurrentAccess"); + + OpenAPI_allowed_nssai_t *allowed_nssai_current_access_local_nonprim = NULL; + if (allowed_nssai_current_access) { + allowed_nssai_current_access_local_nonprim = OpenAPI_allowed_nssai_parseFromJSON(allowed_nssai_current_access); + } + + cJSON *allowed_nssai_other_access = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "allowedNssaiOtherAccess"); + + OpenAPI_allowed_nssai_t *allowed_nssai_other_access_local_nonprim = NULL; + if (allowed_nssai_other_access) { + allowed_nssai_other_access_local_nonprim = OpenAPI_allowed_nssai_parseFromJSON(allowed_nssai_other_access); + } + + cJSON *s_nssai_for_mapping = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "sNssaiForMapping"); + + OpenAPI_list_t *s_nssai_for_mappingList; + if (s_nssai_for_mapping) { + cJSON *s_nssai_for_mapping_local_nonprimitive; + if (!cJSON_IsArray(s_nssai_for_mapping)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [s_nssai_for_mapping]"); + goto end; + } + + s_nssai_for_mappingList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_for_mapping_local_nonprimitive, s_nssai_for_mapping ) { + if (!cJSON_IsObject(s_nssai_for_mapping_local_nonprimitive)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [s_nssai_for_mapping]"); + goto end; + } + OpenAPI_snssai_t *s_nssai_for_mappingItem = OpenAPI_snssai_parseFromJSON(s_nssai_for_mapping_local_nonprimitive); + + OpenAPI_list_add(s_nssai_for_mappingList, s_nssai_for_mappingItem); + } + } + + cJSON *requested_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "requestedNssai"); + + OpenAPI_list_t *requested_nssaiList; + if (requested_nssai) { + cJSON *requested_nssai_local_nonprimitive; + if (!cJSON_IsArray(requested_nssai)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [requested_nssai]"); + goto end; + } + + requested_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(requested_nssai_local_nonprimitive, requested_nssai ) { + if (!cJSON_IsObject(requested_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [requested_nssai]"); + goto end; + } + OpenAPI_snssai_t *requested_nssaiItem = OpenAPI_snssai_parseFromJSON(requested_nssai_local_nonprimitive); + + OpenAPI_list_add(requested_nssaiList, requested_nssaiItem); + } + } + + cJSON *default_configured_snssai_ind = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "defaultConfiguredSnssaiInd"); + + if (default_configured_snssai_ind) { + if (!cJSON_IsBool(default_configured_snssai_ind)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [default_configured_snssai_ind]"); + goto end; + } + } + + cJSON *mapping_of_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "mappingOfNssai"); + + OpenAPI_list_t *mapping_of_nssaiList; + if (mapping_of_nssai) { + cJSON *mapping_of_nssai_local_nonprimitive; + if (!cJSON_IsArray(mapping_of_nssai)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [mapping_of_nssai]"); + goto end; + } + + mapping_of_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mapping_of_nssai_local_nonprimitive, mapping_of_nssai ) { + if (!cJSON_IsObject(mapping_of_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [mapping_of_nssai]"); + goto end; + } + OpenAPI_mapping_of_snssai_t *mapping_of_nssaiItem = OpenAPI_mapping_of_snssai_parseFromJSON(mapping_of_nssai_local_nonprimitive); + + OpenAPI_list_add(mapping_of_nssaiList, mapping_of_nssaiItem); + } + } + + cJSON *request_mapping = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "requestMapping"); + + if (request_mapping) { + if (!cJSON_IsBool(request_mapping)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [request_mapping]"); + goto end; + } + } + + slice_info_for_registration_local_var = OpenAPI_slice_info_for_registration_create ( + subscribed_nssai ? subscribed_nssaiList : NULL, + allowed_nssai_current_access ? allowed_nssai_current_access_local_nonprim : NULL, + allowed_nssai_other_access ? allowed_nssai_other_access_local_nonprim : NULL, + s_nssai_for_mapping ? s_nssai_for_mappingList : NULL, + requested_nssai ? requested_nssaiList : NULL, + default_configured_snssai_ind ? default_configured_snssai_ind->valueint : 0, + mapping_of_nssai ? mapping_of_nssaiList : NULL, + request_mapping ? request_mapping->valueint : 0 + ); + + return slice_info_for_registration_local_var; +end: + return NULL; +} + +OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_copy(OpenAPI_slice_info_for_registration_t *dst, OpenAPI_slice_info_for_registration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_info_for_registration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_info_for_registration_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_slice_info_for_registration_free(dst); + dst = OpenAPI_slice_info_for_registration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_info_for_registration.h b/lib/sbi/openapi/model/slice_info_for_registration.h new file mode 100644 index 000000000..cf45a7a6b --- /dev/null +++ b/lib/sbi/openapi/model/slice_info_for_registration.h @@ -0,0 +1,56 @@ +/* + * slice_info_for_registration.h + * + * + */ + +#ifndef _OpenAPI_slice_info_for_registration_H_ +#define _OpenAPI_slice_info_for_registration_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "allowed_nssai.h" +#include "mapping_of_snssai.h" +#include "snssai.h" +#include "subscribed_snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_info_for_registration_s OpenAPI_slice_info_for_registration_t; +typedef struct OpenAPI_slice_info_for_registration_s { + OpenAPI_list_t *subscribed_nssai; + struct OpenAPI_allowed_nssai_s *allowed_nssai_current_access; + struct OpenAPI_allowed_nssai_s *allowed_nssai_other_access; + OpenAPI_list_t *s_nssai_for_mapping; + OpenAPI_list_t *requested_nssai; + int default_configured_snssai_ind; + OpenAPI_list_t *mapping_of_nssai; + int request_mapping; +} OpenAPI_slice_info_for_registration_t; + +OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_create( + OpenAPI_list_t *subscribed_nssai, + OpenAPI_allowed_nssai_t *allowed_nssai_current_access, + OpenAPI_allowed_nssai_t *allowed_nssai_other_access, + OpenAPI_list_t *s_nssai_for_mapping, + OpenAPI_list_t *requested_nssai, + int default_configured_snssai_ind, + OpenAPI_list_t *mapping_of_nssai, + int request_mapping + ); +void OpenAPI_slice_info_for_registration_free(OpenAPI_slice_info_for_registration_t *slice_info_for_registration); +OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_parseFromJSON(cJSON *slice_info_for_registrationJSON); +cJSON *OpenAPI_slice_info_for_registration_convertToJSON(OpenAPI_slice_info_for_registration_t *slice_info_for_registration); +OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_copy(OpenAPI_slice_info_for_registration_t *dst, OpenAPI_slice_info_for_registration_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_info_for_registration_H_ */ + diff --git a/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.c b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.c new file mode 100644 index 000000000..05087af6a --- /dev/null +++ b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.c @@ -0,0 +1,302 @@ + +#include +#include +#include +#include "slice_info_for_ue_configuration_update.h" + +OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_create( + OpenAPI_list_t *subscribed_nssai, + OpenAPI_allowed_nssai_t *allowed_nssai_current_access, + OpenAPI_allowed_nssai_t *allowed_nssai_other_access, + int default_configured_snssai_ind, + OpenAPI_list_t *requested_nssai, + OpenAPI_list_t *mapping_of_nssai + ) +{ + OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update_local_var = OpenAPI_malloc(sizeof(OpenAPI_slice_info_for_ue_configuration_update_t)); + if (!slice_info_for_ue_configuration_update_local_var) { + return NULL; + } + slice_info_for_ue_configuration_update_local_var->subscribed_nssai = subscribed_nssai; + slice_info_for_ue_configuration_update_local_var->allowed_nssai_current_access = allowed_nssai_current_access; + slice_info_for_ue_configuration_update_local_var->allowed_nssai_other_access = allowed_nssai_other_access; + slice_info_for_ue_configuration_update_local_var->default_configured_snssai_ind = default_configured_snssai_ind; + slice_info_for_ue_configuration_update_local_var->requested_nssai = requested_nssai; + slice_info_for_ue_configuration_update_local_var->mapping_of_nssai = mapping_of_nssai; + + return slice_info_for_ue_configuration_update_local_var; +} + +void OpenAPI_slice_info_for_ue_configuration_update_free(OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update) +{ + if (NULL == slice_info_for_ue_configuration_update) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->subscribed_nssai, node) { + OpenAPI_subscribed_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_ue_configuration_update->subscribed_nssai); + OpenAPI_allowed_nssai_free(slice_info_for_ue_configuration_update->allowed_nssai_current_access); + OpenAPI_allowed_nssai_free(slice_info_for_ue_configuration_update->allowed_nssai_other_access); + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->requested_nssai, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_ue_configuration_update->requested_nssai); + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->mapping_of_nssai, node) { + OpenAPI_mapping_of_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_ue_configuration_update->mapping_of_nssai); + ogs_free(slice_info_for_ue_configuration_update); +} + +cJSON *OpenAPI_slice_info_for_ue_configuration_update_convertToJSON(OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update) +{ + cJSON *item = NULL; + + if (slice_info_for_ue_configuration_update == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [SliceInfoForUEConfigurationUpdate]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (slice_info_for_ue_configuration_update->subscribed_nssai) { + cJSON *subscribed_nssaiList = cJSON_AddArrayToObject(item, "subscribedNssai"); + if (subscribed_nssaiList == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [subscribed_nssai]"); + goto end; + } + + OpenAPI_lnode_t *subscribed_nssai_node; + if (slice_info_for_ue_configuration_update->subscribed_nssai) { + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->subscribed_nssai, subscribed_nssai_node) { + cJSON *itemLocal = OpenAPI_subscribed_snssai_convertToJSON(subscribed_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [subscribed_nssai]"); + goto end; + } + cJSON_AddItemToArray(subscribed_nssaiList, itemLocal); + } + } + } + + if (slice_info_for_ue_configuration_update->allowed_nssai_current_access) { + cJSON *allowed_nssai_current_access_local_JSON = OpenAPI_allowed_nssai_convertToJSON(slice_info_for_ue_configuration_update->allowed_nssai_current_access); + if (allowed_nssai_current_access_local_JSON == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [allowed_nssai_current_access]"); + goto end; + } + cJSON_AddItemToObject(item, "allowedNssaiCurrentAccess", allowed_nssai_current_access_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [allowed_nssai_current_access]"); + goto end; + } + } + + if (slice_info_for_ue_configuration_update->allowed_nssai_other_access) { + cJSON *allowed_nssai_other_access_local_JSON = OpenAPI_allowed_nssai_convertToJSON(slice_info_for_ue_configuration_update->allowed_nssai_other_access); + if (allowed_nssai_other_access_local_JSON == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [allowed_nssai_other_access]"); + goto end; + } + cJSON_AddItemToObject(item, "allowedNssaiOtherAccess", allowed_nssai_other_access_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [allowed_nssai_other_access]"); + goto end; + } + } + + if (slice_info_for_ue_configuration_update->default_configured_snssai_ind) { + if (cJSON_AddBoolToObject(item, "defaultConfiguredSnssaiInd", slice_info_for_ue_configuration_update->default_configured_snssai_ind) == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [default_configured_snssai_ind]"); + goto end; + } + } + + if (slice_info_for_ue_configuration_update->requested_nssai) { + cJSON *requested_nssaiList = cJSON_AddArrayToObject(item, "requestedNssai"); + if (requested_nssaiList == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [requested_nssai]"); + goto end; + } + + OpenAPI_lnode_t *requested_nssai_node; + if (slice_info_for_ue_configuration_update->requested_nssai) { + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->requested_nssai, requested_nssai_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(requested_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [requested_nssai]"); + goto end; + } + cJSON_AddItemToArray(requested_nssaiList, itemLocal); + } + } + } + + if (slice_info_for_ue_configuration_update->mapping_of_nssai) { + cJSON *mapping_of_nssaiList = cJSON_AddArrayToObject(item, "mappingOfNssai"); + if (mapping_of_nssaiList == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [mapping_of_nssai]"); + goto end; + } + + OpenAPI_lnode_t *mapping_of_nssai_node; + if (slice_info_for_ue_configuration_update->mapping_of_nssai) { + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->mapping_of_nssai, mapping_of_nssai_node) { + cJSON *itemLocal = OpenAPI_mapping_of_snssai_convertToJSON(mapping_of_nssai_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [mapping_of_nssai]"); + goto end; + } + cJSON_AddItemToArray(mapping_of_nssaiList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON(cJSON *slice_info_for_ue_configuration_updateJSON) +{ + OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update_local_var = NULL; + cJSON *subscribed_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "subscribedNssai"); + + OpenAPI_list_t *subscribed_nssaiList; + if (subscribed_nssai) { + cJSON *subscribed_nssai_local_nonprimitive; + if (!cJSON_IsArray(subscribed_nssai)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [subscribed_nssai]"); + goto end; + } + + subscribed_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(subscribed_nssai_local_nonprimitive, subscribed_nssai ) { + if (!cJSON_IsObject(subscribed_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [subscribed_nssai]"); + goto end; + } + OpenAPI_subscribed_snssai_t *subscribed_nssaiItem = OpenAPI_subscribed_snssai_parseFromJSON(subscribed_nssai_local_nonprimitive); + + OpenAPI_list_add(subscribed_nssaiList, subscribed_nssaiItem); + } + } + + cJSON *allowed_nssai_current_access = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "allowedNssaiCurrentAccess"); + + OpenAPI_allowed_nssai_t *allowed_nssai_current_access_local_nonprim = NULL; + if (allowed_nssai_current_access) { + allowed_nssai_current_access_local_nonprim = OpenAPI_allowed_nssai_parseFromJSON(allowed_nssai_current_access); + } + + cJSON *allowed_nssai_other_access = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "allowedNssaiOtherAccess"); + + OpenAPI_allowed_nssai_t *allowed_nssai_other_access_local_nonprim = NULL; + if (allowed_nssai_other_access) { + allowed_nssai_other_access_local_nonprim = OpenAPI_allowed_nssai_parseFromJSON(allowed_nssai_other_access); + } + + cJSON *default_configured_snssai_ind = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "defaultConfiguredSnssaiInd"); + + if (default_configured_snssai_ind) { + if (!cJSON_IsBool(default_configured_snssai_ind)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [default_configured_snssai_ind]"); + goto end; + } + } + + cJSON *requested_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "requestedNssai"); + + OpenAPI_list_t *requested_nssaiList; + if (requested_nssai) { + cJSON *requested_nssai_local_nonprimitive; + if (!cJSON_IsArray(requested_nssai)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [requested_nssai]"); + goto end; + } + + requested_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(requested_nssai_local_nonprimitive, requested_nssai ) { + if (!cJSON_IsObject(requested_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [requested_nssai]"); + goto end; + } + OpenAPI_snssai_t *requested_nssaiItem = OpenAPI_snssai_parseFromJSON(requested_nssai_local_nonprimitive); + + OpenAPI_list_add(requested_nssaiList, requested_nssaiItem); + } + } + + cJSON *mapping_of_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "mappingOfNssai"); + + OpenAPI_list_t *mapping_of_nssaiList; + if (mapping_of_nssai) { + cJSON *mapping_of_nssai_local_nonprimitive; + if (!cJSON_IsArray(mapping_of_nssai)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [mapping_of_nssai]"); + goto end; + } + + mapping_of_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mapping_of_nssai_local_nonprimitive, mapping_of_nssai ) { + if (!cJSON_IsObject(mapping_of_nssai_local_nonprimitive)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [mapping_of_nssai]"); + goto end; + } + OpenAPI_mapping_of_snssai_t *mapping_of_nssaiItem = OpenAPI_mapping_of_snssai_parseFromJSON(mapping_of_nssai_local_nonprimitive); + + OpenAPI_list_add(mapping_of_nssaiList, mapping_of_nssaiItem); + } + } + + slice_info_for_ue_configuration_update_local_var = OpenAPI_slice_info_for_ue_configuration_update_create ( + subscribed_nssai ? subscribed_nssaiList : NULL, + allowed_nssai_current_access ? allowed_nssai_current_access_local_nonprim : NULL, + allowed_nssai_other_access ? allowed_nssai_other_access_local_nonprim : NULL, + default_configured_snssai_ind ? default_configured_snssai_ind->valueint : 0, + requested_nssai ? requested_nssaiList : NULL, + mapping_of_nssai ? mapping_of_nssaiList : NULL + ); + + return slice_info_for_ue_configuration_update_local_var; +end: + return NULL; +} + +OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_copy(OpenAPI_slice_info_for_ue_configuration_update_t *dst, OpenAPI_slice_info_for_ue_configuration_update_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_info_for_ue_configuration_update_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_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_slice_info_for_ue_configuration_update_free(dst); + dst = OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.h b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.h new file mode 100644 index 000000000..78b2ba061 --- /dev/null +++ b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.h @@ -0,0 +1,52 @@ +/* + * slice_info_for_ue_configuration_update.h + * + * + */ + +#ifndef _OpenAPI_slice_info_for_ue_configuration_update_H_ +#define _OpenAPI_slice_info_for_ue_configuration_update_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "allowed_nssai.h" +#include "mapping_of_snssai.h" +#include "snssai.h" +#include "subscribed_snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_info_for_ue_configuration_update_s OpenAPI_slice_info_for_ue_configuration_update_t; +typedef struct OpenAPI_slice_info_for_ue_configuration_update_s { + OpenAPI_list_t *subscribed_nssai; + struct OpenAPI_allowed_nssai_s *allowed_nssai_current_access; + struct OpenAPI_allowed_nssai_s *allowed_nssai_other_access; + int default_configured_snssai_ind; + OpenAPI_list_t *requested_nssai; + OpenAPI_list_t *mapping_of_nssai; +} OpenAPI_slice_info_for_ue_configuration_update_t; + +OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_create( + OpenAPI_list_t *subscribed_nssai, + OpenAPI_allowed_nssai_t *allowed_nssai_current_access, + OpenAPI_allowed_nssai_t *allowed_nssai_other_access, + int default_configured_snssai_ind, + OpenAPI_list_t *requested_nssai, + OpenAPI_list_t *mapping_of_nssai + ); +void OpenAPI_slice_info_for_ue_configuration_update_free(OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update); +OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON(cJSON *slice_info_for_ue_configuration_updateJSON); +cJSON *OpenAPI_slice_info_for_ue_configuration_update_convertToJSON(OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update); +OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_copy(OpenAPI_slice_info_for_ue_configuration_update_t *dst, OpenAPI_slice_info_for_ue_configuration_update_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_info_for_ue_configuration_update_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context.c b/lib/sbi/openapi/model/sm_context.c index 2e022b72e..0bfa3e1e0 100644 --- a/lib/sbi/openapi/model/sm_context.c +++ b/lib/sbi/openapi/model/sm_context.c @@ -24,6 +24,9 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( OpenAPI_list_t *qos_flows_list, char *h_smf_instance_id, char *smf_instance_id, + char *pdu_session_smf_set_id, + char *pdu_session_smf_service_set_id, + OpenAPI_sbi_binding_level_e pdu_session_smf_binding, int enable_pause_charging, char *ue_ipv4_address, char *ue_ipv6_prefix, @@ -40,7 +43,9 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( char *home_provided_charging_id, OpenAPI_charging_information_t *charging_info, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, - int nef_ext_buf_support_ind + int nef_ext_buf_support_ind, + int ipv6_index, + OpenAPI_ip_address_t *dn_aaa_address ) { OpenAPI_sm_context_t *sm_context_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_t)); @@ -66,6 +71,9 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( sm_context_local_var->qos_flows_list = qos_flows_list; sm_context_local_var->h_smf_instance_id = h_smf_instance_id; sm_context_local_var->smf_instance_id = smf_instance_id; + sm_context_local_var->pdu_session_smf_set_id = pdu_session_smf_set_id; + sm_context_local_var->pdu_session_smf_service_set_id = pdu_session_smf_service_set_id; + sm_context_local_var->pdu_session_smf_binding = pdu_session_smf_binding; sm_context_local_var->enable_pause_charging = enable_pause_charging; sm_context_local_var->ue_ipv4_address = ue_ipv4_address; sm_context_local_var->ue_ipv6_prefix = ue_ipv6_prefix; @@ -83,6 +91,8 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( sm_context_local_var->charging_info = charging_info; sm_context_local_var->roaming_charging_profile = roaming_charging_profile; sm_context_local_var->nef_ext_buf_support_ind = nef_ext_buf_support_ind; + sm_context_local_var->ipv6_index = ipv6_index; + sm_context_local_var->dn_aaa_address = dn_aaa_address; return sm_context_local_var; } @@ -112,6 +122,8 @@ void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context) OpenAPI_list_free(sm_context->qos_flows_list); ogs_free(sm_context->h_smf_instance_id); ogs_free(sm_context->smf_instance_id); + ogs_free(sm_context->pdu_session_smf_set_id); + ogs_free(sm_context->pdu_session_smf_service_set_id); ogs_free(sm_context->ue_ipv4_address); ogs_free(sm_context->ue_ipv6_prefix); OpenAPI_eps_pdn_cnx_info_free(sm_context->eps_pdn_cnx_info); @@ -127,6 +139,7 @@ void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context) ogs_free(sm_context->home_provided_charging_id); OpenAPI_charging_information_free(sm_context->charging_info); OpenAPI_roaming_charging_profile_free(sm_context->roaming_charging_profile); + OpenAPI_ip_address_free(sm_context->dn_aaa_address); ogs_free(sm_context); } @@ -316,6 +329,27 @@ cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context) } } + if (sm_context->pdu_session_smf_set_id) { + if (cJSON_AddStringToObject(item, "pduSessionSmfSetId", sm_context->pdu_session_smf_set_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_smf_set_id]"); + goto end; + } + } + + if (sm_context->pdu_session_smf_service_set_id) { + if (cJSON_AddStringToObject(item, "pduSessionSmfServiceSetId", sm_context->pdu_session_smf_service_set_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_smf_service_set_id]"); + goto end; + } + } + + if (sm_context->pdu_session_smf_binding) { + if (cJSON_AddStringToObject(item, "pduSessionSmfBinding", OpenAPI_sbi_binding_level_ToString(sm_context->pdu_session_smf_binding)) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [pdu_session_smf_binding]"); + goto end; + } + } + if (sm_context->enable_pause_charging) { if (cJSON_AddBoolToObject(item, "enablePauseCharging", sm_context->enable_pause_charging) == NULL) { ogs_error("OpenAPI_sm_context_convertToJSON() failed [enable_pause_charging]"); @@ -478,6 +512,26 @@ cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context) } } + if (sm_context->ipv6_index) { + if (cJSON_AddNumberToObject(item, "ipv6Index", sm_context->ipv6_index) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [ipv6_index]"); + goto end; + } + } + + if (sm_context->dn_aaa_address) { + cJSON *dn_aaa_address_local_JSON = OpenAPI_ip_address_convertToJSON(sm_context->dn_aaa_address); + if (dn_aaa_address_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + cJSON_AddItemToObject(item, "dnAaaAddress", dn_aaa_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [dn_aaa_address]"); + goto end; + } + } + end: return item; } @@ -686,6 +740,35 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) } } + cJSON *pdu_session_smf_set_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pduSessionSmfSetId"); + + if (pdu_session_smf_set_id) { + if (!cJSON_IsString(pdu_session_smf_set_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_smf_set_id]"); + goto end; + } + } + + cJSON *pdu_session_smf_service_set_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pduSessionSmfServiceSetId"); + + if (pdu_session_smf_service_set_id) { + if (!cJSON_IsString(pdu_session_smf_service_set_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_smf_service_set_id]"); + goto end; + } + } + + cJSON *pdu_session_smf_binding = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pduSessionSmfBinding"); + + OpenAPI_sbi_binding_level_e pdu_session_smf_bindingVariable; + if (pdu_session_smf_binding) { + if (!cJSON_IsString(pdu_session_smf_binding)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_smf_binding]"); + goto end; + } + pdu_session_smf_bindingVariable = OpenAPI_sbi_binding_level_FromString(pdu_session_smf_binding->valuestring); + } + cJSON *enable_pause_charging = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "enablePauseCharging"); if (enable_pause_charging) { @@ -845,6 +928,22 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) } } + cJSON *ipv6_index = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "ipv6Index"); + + if (ipv6_index) { + if (!cJSON_IsNumber(ipv6_index)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [ipv6_index]"); + goto end; + } + } + + cJSON *dn_aaa_address = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "dnAaaAddress"); + + OpenAPI_ip_address_t *dn_aaa_address_local_nonprim = NULL; + if (dn_aaa_address) { + dn_aaa_address_local_nonprim = OpenAPI_ip_address_parseFromJSON(dn_aaa_address); + } + sm_context_local_var = OpenAPI_sm_context_create ( pdu_session_id->valuedouble, ogs_strdup(dnn->valuestring), @@ -865,6 +964,9 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) qos_flows_listList, h_smf_instance_id ? ogs_strdup(h_smf_instance_id->valuestring) : NULL, smf_instance_id ? ogs_strdup(smf_instance_id->valuestring) : NULL, + pdu_session_smf_set_id ? ogs_strdup(pdu_session_smf_set_id->valuestring) : NULL, + pdu_session_smf_service_set_id ? ogs_strdup(pdu_session_smf_service_set_id->valuestring) : NULL, + pdu_session_smf_binding ? pdu_session_smf_bindingVariable : 0, enable_pause_charging ? enable_pause_charging->valueint : 0, ue_ipv4_address ? ogs_strdup(ue_ipv4_address->valuestring) : NULL, ue_ipv6_prefix ? ogs_strdup(ue_ipv6_prefix->valuestring) : NULL, @@ -881,7 +983,9 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) home_provided_charging_id ? ogs_strdup(home_provided_charging_id->valuestring) : NULL, charging_info ? charging_info_local_nonprim : NULL, roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, - nef_ext_buf_support_ind ? nef_ext_buf_support_ind->valueint : 0 + nef_ext_buf_support_ind ? nef_ext_buf_support_ind->valueint : 0, + ipv6_index ? ipv6_index->valuedouble : 0, + dn_aaa_address ? dn_aaa_address_local_nonprim : NULL ); return sm_context_local_var; diff --git a/lib/sbi/openapi/model/sm_context.h b/lib/sbi/openapi/model/sm_context.h index 877f75824..4b02acf9a 100644 --- a/lib/sbi/openapi/model/sm_context.h +++ b/lib/sbi/openapi/model/sm_context.h @@ -17,10 +17,12 @@ #include "dnn_selection_mode.h" #include "eps_bearer_info.h" #include "eps_pdn_cnx_info.h" +#include "ip_address.h" #include "max_integrity_protected_data_rate.h" #include "pdu_session_type.h" #include "qos_flow_setup_item.h" #include "roaming_charging_profile.h" +#include "sbi_binding_level.h" #include "snssai.h" #include "tunnel_info.h" #include "up_security.h" @@ -50,6 +52,9 @@ typedef struct OpenAPI_sm_context_s { OpenAPI_list_t *qos_flows_list; char *h_smf_instance_id; char *smf_instance_id; + char *pdu_session_smf_set_id; + char *pdu_session_smf_service_set_id; + OpenAPI_sbi_binding_level_e pdu_session_smf_binding; int enable_pause_charging; char *ue_ipv4_address; char *ue_ipv6_prefix; @@ -67,6 +72,8 @@ typedef struct OpenAPI_sm_context_s { struct OpenAPI_charging_information_s *charging_info; struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; int nef_ext_buf_support_ind; + int ipv6_index; + struct OpenAPI_ip_address_s *dn_aaa_address; } OpenAPI_sm_context_t; OpenAPI_sm_context_t *OpenAPI_sm_context_create( @@ -89,6 +96,9 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( OpenAPI_list_t *qos_flows_list, char *h_smf_instance_id, char *smf_instance_id, + char *pdu_session_smf_set_id, + char *pdu_session_smf_service_set_id, + OpenAPI_sbi_binding_level_e pdu_session_smf_binding, int enable_pause_charging, char *ue_ipv4_address, char *ue_ipv6_prefix, @@ -105,7 +115,9 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( char *home_provided_charging_id, OpenAPI_charging_information_t *charging_info, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, - int nef_ext_buf_support_ind + int nef_ext_buf_support_ind, + int ipv6_index, + OpenAPI_ip_address_t *dn_aaa_address ); void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context); OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON); diff --git a/lib/sbi/openapi/model/sm_context_create_data.c b/lib/sbi/openapi/model/sm_context_create_data.c index 8a33d36ac..d92f9df13 100644 --- a/lib/sbi/openapi/model/sm_context_create_data.c +++ b/lib/sbi/openapi/model/sm_context_create_data.c @@ -11,6 +11,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( char *gpsi, int pdu_session_id, char *dnn, + char *selected_dnn, OpenAPI_snssai_t *s_nssai, OpenAPI_snssai_t *hplmn_snssai, char *serving_nf_id, @@ -28,9 +29,13 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_user_location_t *add_ue_location, char *sm_context_status_uri, char *h_smf_uri, + char *h_smf_id, char *smf_uri, + char *smf_id, OpenAPI_list_t *additional_hsmf_uri, + OpenAPI_list_t *additional_hsmf_id, OpenAPI_list_t *additional_smf_uri, + OpenAPI_list_t *additional_smf_id, int old_pdu_session_id, OpenAPI_list_t *pdu_sessions_activate_list, char *ue_eps_pdn_connection, @@ -47,6 +52,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( char *routing_indicator, OpenAPI_eps_interworking_indication_e eps_interworking_ind, int indirect_forwarding_flag, + int direct_forwarding_flag, OpenAPI_ng_ran_target_id_t *target_id, char *eps_bearer_ctx_status, int cp_ciot_enabled, @@ -59,6 +65,10 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, char *sm_context_ref, + char *sm_context_smf_id, + char *sm_context_smf_set_id, + char *sm_context_smf_service_set_id, + OpenAPI_sbi_binding_level_e sm_context_smf_binding, OpenAPI_up_cnx_state_e up_cnx_state, OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, @@ -83,6 +93,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( sm_context_create_data_local_var->gpsi = gpsi; sm_context_create_data_local_var->pdu_session_id = pdu_session_id; sm_context_create_data_local_var->dnn = dnn; + sm_context_create_data_local_var->selected_dnn = selected_dnn; sm_context_create_data_local_var->s_nssai = s_nssai; sm_context_create_data_local_var->hplmn_snssai = hplmn_snssai; sm_context_create_data_local_var->serving_nf_id = serving_nf_id; @@ -100,9 +111,13 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( sm_context_create_data_local_var->add_ue_location = add_ue_location; sm_context_create_data_local_var->sm_context_status_uri = sm_context_status_uri; sm_context_create_data_local_var->h_smf_uri = h_smf_uri; + sm_context_create_data_local_var->h_smf_id = h_smf_id; sm_context_create_data_local_var->smf_uri = smf_uri; + sm_context_create_data_local_var->smf_id = smf_id; sm_context_create_data_local_var->additional_hsmf_uri = additional_hsmf_uri; + sm_context_create_data_local_var->additional_hsmf_id = additional_hsmf_id; sm_context_create_data_local_var->additional_smf_uri = additional_smf_uri; + sm_context_create_data_local_var->additional_smf_id = additional_smf_id; sm_context_create_data_local_var->old_pdu_session_id = old_pdu_session_id; sm_context_create_data_local_var->pdu_sessions_activate_list = pdu_sessions_activate_list; sm_context_create_data_local_var->ue_eps_pdn_connection = ue_eps_pdn_connection; @@ -119,6 +134,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( sm_context_create_data_local_var->routing_indicator = routing_indicator; sm_context_create_data_local_var->eps_interworking_ind = eps_interworking_ind; sm_context_create_data_local_var->indirect_forwarding_flag = indirect_forwarding_flag; + sm_context_create_data_local_var->direct_forwarding_flag = direct_forwarding_flag; sm_context_create_data_local_var->target_id = target_id; sm_context_create_data_local_var->eps_bearer_ctx_status = eps_bearer_ctx_status; sm_context_create_data_local_var->cp_ciot_enabled = cp_ciot_enabled; @@ -131,6 +147,10 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( sm_context_create_data_local_var->n2_sm_info_ext1 = n2_sm_info_ext1; sm_context_create_data_local_var->n2_sm_info_type_ext1 = n2_sm_info_type_ext1; sm_context_create_data_local_var->sm_context_ref = sm_context_ref; + sm_context_create_data_local_var->sm_context_smf_id = sm_context_smf_id; + sm_context_create_data_local_var->sm_context_smf_set_id = sm_context_smf_set_id; + sm_context_create_data_local_var->sm_context_smf_service_set_id = sm_context_smf_service_set_id; + sm_context_create_data_local_var->sm_context_smf_binding = sm_context_smf_binding; sm_context_create_data_local_var->up_cnx_state = up_cnx_state; sm_context_create_data_local_var->small_data_rate_status = small_data_rate_status; sm_context_create_data_local_var->apn_rate_status = apn_rate_status; @@ -157,6 +177,7 @@ void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_co ogs_free(sm_context_create_data->pei); ogs_free(sm_context_create_data->gpsi); ogs_free(sm_context_create_data->dnn); + ogs_free(sm_context_create_data->selected_dnn); OpenAPI_snssai_free(sm_context_create_data->s_nssai); OpenAPI_snssai_free(sm_context_create_data->hplmn_snssai); ogs_free(sm_context_create_data->serving_nf_id); @@ -169,15 +190,25 @@ void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_co OpenAPI_user_location_free(sm_context_create_data->add_ue_location); ogs_free(sm_context_create_data->sm_context_status_uri); ogs_free(sm_context_create_data->h_smf_uri); + ogs_free(sm_context_create_data->h_smf_id); ogs_free(sm_context_create_data->smf_uri); + ogs_free(sm_context_create_data->smf_id); OpenAPI_list_for_each(sm_context_create_data->additional_hsmf_uri, node) { ogs_free(node->data); } OpenAPI_list_free(sm_context_create_data->additional_hsmf_uri); + OpenAPI_list_for_each(sm_context_create_data->additional_hsmf_id, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_create_data->additional_hsmf_id); OpenAPI_list_for_each(sm_context_create_data->additional_smf_uri, node) { ogs_free(node->data); } OpenAPI_list_free(sm_context_create_data->additional_smf_uri); + OpenAPI_list_for_each(sm_context_create_data->additional_smf_id, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_create_data->additional_smf_id); OpenAPI_list_for_each(sm_context_create_data->pdu_sessions_activate_list, node) { ogs_free(node->data); } @@ -200,6 +231,9 @@ void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_co OpenAPI_ref_to_binary_data_free(sm_context_create_data->n2_sm_info); OpenAPI_ref_to_binary_data_free(sm_context_create_data->n2_sm_info_ext1); ogs_free(sm_context_create_data->sm_context_ref); + ogs_free(sm_context_create_data->sm_context_smf_id); + ogs_free(sm_context_create_data->sm_context_smf_set_id); + ogs_free(sm_context_create_data->sm_context_smf_service_set_id); OpenAPI_small_data_rate_status_free(sm_context_create_data->small_data_rate_status); OpenAPI_apn_rate_status_free(sm_context_create_data->apn_rate_status); OpenAPI_ddn_failure_subs_free(sm_context_create_data->ddn_failure_subs); @@ -263,6 +297,13 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->selected_dnn) { + if (cJSON_AddStringToObject(item, "selectedDnn", sm_context_create_data->selected_dnn) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [selected_dnn]"); + goto end; + } + } + if (sm_context_create_data->s_nssai) { cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(sm_context_create_data->s_nssai); if (s_nssai_local_JSON == NULL) { @@ -432,6 +473,13 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->h_smf_id) { + if (cJSON_AddStringToObject(item, "hSmfId", sm_context_create_data->h_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [h_smf_id]"); + goto end; + } + } + if (sm_context_create_data->smf_uri) { if (cJSON_AddStringToObject(item, "smfUri", sm_context_create_data->smf_uri) == NULL) { ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [smf_uri]"); @@ -439,6 +487,13 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->smf_id) { + if (cJSON_AddStringToObject(item, "smfId", sm_context_create_data->smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [smf_id]"); + goto end; + } + } + if (sm_context_create_data->additional_hsmf_uri) { cJSON *additional_hsmf_uri = cJSON_AddArrayToObject(item, "additionalHsmfUri"); if (additional_hsmf_uri == NULL) { @@ -455,6 +510,22 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->additional_hsmf_id) { + cJSON *additional_hsmf_id = cJSON_AddArrayToObject(item, "additionalHsmfId"); + if (additional_hsmf_id == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_hsmf_id]"); + goto end; + } + + OpenAPI_lnode_t *additional_hsmf_id_node; + OpenAPI_list_for_each(sm_context_create_data->additional_hsmf_id, additional_hsmf_id_node) { + if (cJSON_AddStringToObject(additional_hsmf_id, "", (char*)additional_hsmf_id_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_hsmf_id]"); + goto end; + } + } + } + if (sm_context_create_data->additional_smf_uri) { cJSON *additional_smf_uri = cJSON_AddArrayToObject(item, "additionalSmfUri"); if (additional_smf_uri == NULL) { @@ -471,6 +542,22 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->additional_smf_id) { + cJSON *additional_smf_id = cJSON_AddArrayToObject(item, "additionalSmfId"); + if (additional_smf_id == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_smf_id]"); + goto end; + } + + OpenAPI_lnode_t *additional_smf_id_node; + OpenAPI_list_for_each(sm_context_create_data->additional_smf_id, additional_smf_id_node) { + if (cJSON_AddStringToObject(additional_smf_id, "", (char*)additional_smf_id_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [additional_smf_id]"); + goto end; + } + } + } + if (sm_context_create_data->old_pdu_session_id) { if (cJSON_AddNumberToObject(item, "oldPduSessionId", sm_context_create_data->old_pdu_session_id) == NULL) { ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [old_pdu_session_id]"); @@ -611,6 +698,13 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->direct_forwarding_flag) { + if (cJSON_AddBoolToObject(item, "directForwardingFlag", sm_context_create_data->direct_forwarding_flag) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [direct_forwarding_flag]"); + goto end; + } + } + if (sm_context_create_data->target_id) { cJSON *target_id_local_JSON = OpenAPI_ng_ran_target_id_convertToJSON(sm_context_create_data->target_id); if (target_id_local_JSON == NULL) { @@ -713,6 +807,34 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->sm_context_smf_id) { + if (cJSON_AddStringToObject(item, "smContextSmfId", sm_context_create_data->sm_context_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_id]"); + goto end; + } + } + + if (sm_context_create_data->sm_context_smf_set_id) { + if (cJSON_AddStringToObject(item, "smContextSmfSetId", sm_context_create_data->sm_context_smf_set_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_set_id]"); + goto end; + } + } + + if (sm_context_create_data->sm_context_smf_service_set_id) { + if (cJSON_AddStringToObject(item, "smContextSmfServiceSetId", sm_context_create_data->sm_context_smf_service_set_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_service_set_id]"); + goto end; + } + } + + if (sm_context_create_data->sm_context_smf_binding) { + if (cJSON_AddStringToObject(item, "smContextSmfBinding", OpenAPI_sbi_binding_level_ToString(sm_context_create_data->sm_context_smf_binding)) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_binding]"); + goto end; + } + } + if (sm_context_create_data->up_cnx_state) { if (cJSON_AddStringToObject(item, "upCnxState", OpenAPI_up_cnx_state_ToString(sm_context_create_data->up_cnx_state)) == NULL) { ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [up_cnx_state]"); @@ -894,6 +1016,15 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + cJSON *selected_dnn = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "selectedDnn"); + + if (selected_dnn) { + if (!cJSON_IsString(selected_dnn)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [selected_dnn]"); + goto end; + } + } + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "sNssai"); OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; @@ -1055,6 +1186,15 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + cJSON *h_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "hSmfId"); + + if (h_smf_id) { + if (!cJSON_IsString(h_smf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [h_smf_id]"); + goto end; + } + } + cJSON *smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smfUri"); if (smf_uri) { @@ -1064,6 +1204,15 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + cJSON *smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smfId"); + + if (smf_id) { + if (!cJSON_IsString(smf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [smf_id]"); + goto end; + } + } + cJSON *additional_hsmf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "additionalHsmfUri"); OpenAPI_list_t *additional_hsmf_uriList; @@ -1084,6 +1233,26 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + cJSON *additional_hsmf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "additionalHsmfId"); + + OpenAPI_list_t *additional_hsmf_idList; + if (additional_hsmf_id) { + cJSON *additional_hsmf_id_local; + if (!cJSON_IsArray(additional_hsmf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_hsmf_id]"); + goto end; + } + additional_hsmf_idList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_hsmf_id_local, additional_hsmf_id) { + if (!cJSON_IsString(additional_hsmf_id_local)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_hsmf_id]"); + goto end; + } + OpenAPI_list_add(additional_hsmf_idList, ogs_strdup(additional_hsmf_id_local->valuestring)); + } + } + cJSON *additional_smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "additionalSmfUri"); OpenAPI_list_t *additional_smf_uriList; @@ -1104,6 +1273,26 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + cJSON *additional_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "additionalSmfId"); + + OpenAPI_list_t *additional_smf_idList; + if (additional_smf_id) { + cJSON *additional_smf_id_local; + if (!cJSON_IsArray(additional_smf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_smf_id]"); + goto end; + } + additional_smf_idList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_smf_id_local, additional_smf_id) { + if (!cJSON_IsString(additional_smf_id_local)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [additional_smf_id]"); + goto end; + } + OpenAPI_list_add(additional_smf_idList, ogs_strdup(additional_smf_id_local->valuestring)); + } + } + cJSON *old_pdu_session_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "oldPduSessionId"); if (old_pdu_session_id) { @@ -1277,6 +1466,15 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + cJSON *direct_forwarding_flag = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "directForwardingFlag"); + + if (direct_forwarding_flag) { + if (!cJSON_IsBool(direct_forwarding_flag)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [direct_forwarding_flag]"); + goto end; + } + } + cJSON *target_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "targetId"); OpenAPI_ng_ran_target_id_t *target_id_local_nonprim = NULL; @@ -1383,6 +1581,44 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + cJSON *sm_context_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextSmfId"); + + if (sm_context_smf_id) { + if (!cJSON_IsString(sm_context_smf_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_smf_id]"); + goto end; + } + } + + cJSON *sm_context_smf_set_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextSmfSetId"); + + if (sm_context_smf_set_id) { + if (!cJSON_IsString(sm_context_smf_set_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_smf_set_id]"); + goto end; + } + } + + cJSON *sm_context_smf_service_set_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextSmfServiceSetId"); + + if (sm_context_smf_service_set_id) { + if (!cJSON_IsString(sm_context_smf_service_set_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_smf_service_set_id]"); + goto end; + } + } + + cJSON *sm_context_smf_binding = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextSmfBinding"); + + OpenAPI_sbi_binding_level_e sm_context_smf_bindingVariable; + if (sm_context_smf_binding) { + if (!cJSON_IsString(sm_context_smf_binding)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_smf_binding]"); + goto end; + } + sm_context_smf_bindingVariable = OpenAPI_sbi_binding_level_FromString(sm_context_smf_binding->valuestring); + } + cJSON *up_cnx_state = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "upCnxState"); OpenAPI_up_cnx_state_e up_cnx_stateVariable; @@ -1488,6 +1724,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c gpsi ? ogs_strdup(gpsi->valuestring) : NULL, pdu_session_id ? pdu_session_id->valuedouble : 0, dnn ? ogs_strdup(dnn->valuestring) : NULL, + selected_dnn ? ogs_strdup(selected_dnn->valuestring) : NULL, s_nssai ? s_nssai_local_nonprim : NULL, hplmn_snssai ? hplmn_snssai_local_nonprim : NULL, ogs_strdup(serving_nf_id->valuestring), @@ -1505,9 +1742,13 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c add_ue_location ? add_ue_location_local_nonprim : NULL, ogs_strdup(sm_context_status_uri->valuestring), h_smf_uri ? ogs_strdup(h_smf_uri->valuestring) : NULL, + h_smf_id ? ogs_strdup(h_smf_id->valuestring) : NULL, smf_uri ? ogs_strdup(smf_uri->valuestring) : NULL, + smf_id ? ogs_strdup(smf_id->valuestring) : NULL, additional_hsmf_uri ? additional_hsmf_uriList : NULL, + additional_hsmf_id ? additional_hsmf_idList : NULL, additional_smf_uri ? additional_smf_uriList : NULL, + additional_smf_id ? additional_smf_idList : NULL, old_pdu_session_id ? old_pdu_session_id->valuedouble : 0, pdu_sessions_activate_list ? pdu_sessions_activate_listList : NULL, ue_eps_pdn_connection ? ogs_strdup(ue_eps_pdn_connection->valuestring) : NULL, @@ -1524,6 +1765,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c routing_indicator ? ogs_strdup(routing_indicator->valuestring) : NULL, eps_interworking_ind ? eps_interworking_indVariable : 0, indirect_forwarding_flag ? indirect_forwarding_flag->valueint : 0, + direct_forwarding_flag ? direct_forwarding_flag->valueint : 0, target_id ? target_id_local_nonprim : NULL, eps_bearer_ctx_status ? ogs_strdup(eps_bearer_ctx_status->valuestring) : NULL, cp_ciot_enabled ? cp_ciot_enabled->valueint : 0, @@ -1536,6 +1778,10 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c n2_sm_info_ext1 ? n2_sm_info_ext1_local_nonprim : NULL, n2_sm_info_type_ext1 ? n2_sm_info_type_ext1Variable : 0, sm_context_ref ? ogs_strdup(sm_context_ref->valuestring) : NULL, + sm_context_smf_id ? ogs_strdup(sm_context_smf_id->valuestring) : NULL, + sm_context_smf_set_id ? ogs_strdup(sm_context_smf_set_id->valuestring) : NULL, + sm_context_smf_service_set_id ? ogs_strdup(sm_context_smf_service_set_id->valuestring) : NULL, + sm_context_smf_binding ? sm_context_smf_bindingVariable : 0, up_cnx_state ? up_cnx_stateVariable : 0, small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, apn_rate_status ? apn_rate_status_local_nonprim : NULL, diff --git a/lib/sbi/openapi/model/sm_context_create_data.h b/lib/sbi/openapi/model/sm_context_create_data.h index 5a2abaf28..b90468af0 100644 --- a/lib/sbi/openapi/model/sm_context_create_data.h +++ b/lib/sbi/openapi/model/sm_context_create_data.h @@ -27,6 +27,7 @@ #include "rat_type.h" #include "ref_to_binary_data.h" #include "request_type.h" +#include "sbi_binding_level.h" #include "small_data_rate_status.h" #include "snssai.h" #include "tngf_info.h" @@ -48,6 +49,7 @@ typedef struct OpenAPI_sm_context_create_data_s { char *gpsi; int pdu_session_id; char *dnn; + char *selected_dnn; struct OpenAPI_snssai_s *s_nssai; struct OpenAPI_snssai_s *hplmn_snssai; char *serving_nf_id; @@ -65,9 +67,13 @@ typedef struct OpenAPI_sm_context_create_data_s { struct OpenAPI_user_location_s *add_ue_location; char *sm_context_status_uri; char *h_smf_uri; + char *h_smf_id; char *smf_uri; + char *smf_id; OpenAPI_list_t *additional_hsmf_uri; + OpenAPI_list_t *additional_hsmf_id; OpenAPI_list_t *additional_smf_uri; + OpenAPI_list_t *additional_smf_id; int old_pdu_session_id; OpenAPI_list_t *pdu_sessions_activate_list; char *ue_eps_pdn_connection; @@ -84,6 +90,7 @@ typedef struct OpenAPI_sm_context_create_data_s { char *routing_indicator; OpenAPI_eps_interworking_indication_e eps_interworking_ind; int indirect_forwarding_flag; + int direct_forwarding_flag; struct OpenAPI_ng_ran_target_id_s *target_id; char *eps_bearer_ctx_status; int cp_ciot_enabled; @@ -96,6 +103,10 @@ typedef struct OpenAPI_sm_context_create_data_s { struct OpenAPI_ref_to_binary_data_s *n2_sm_info_ext1; OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1; char *sm_context_ref; + char *sm_context_smf_id; + char *sm_context_smf_set_id; + char *sm_context_smf_service_set_id; + OpenAPI_sbi_binding_level_e sm_context_smf_binding; OpenAPI_up_cnx_state_e up_cnx_state; struct OpenAPI_small_data_rate_status_s *small_data_rate_status; struct OpenAPI_apn_rate_status_s *apn_rate_status; @@ -117,6 +128,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( char *gpsi, int pdu_session_id, char *dnn, + char *selected_dnn, OpenAPI_snssai_t *s_nssai, OpenAPI_snssai_t *hplmn_snssai, char *serving_nf_id, @@ -134,9 +146,13 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_user_location_t *add_ue_location, char *sm_context_status_uri, char *h_smf_uri, + char *h_smf_id, char *smf_uri, + char *smf_id, OpenAPI_list_t *additional_hsmf_uri, + OpenAPI_list_t *additional_hsmf_id, OpenAPI_list_t *additional_smf_uri, + OpenAPI_list_t *additional_smf_id, int old_pdu_session_id, OpenAPI_list_t *pdu_sessions_activate_list, char *ue_eps_pdn_connection, @@ -153,6 +169,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( char *routing_indicator, OpenAPI_eps_interworking_indication_e eps_interworking_ind, int indirect_forwarding_flag, + int direct_forwarding_flag, OpenAPI_ng_ran_target_id_t *target_id, char *eps_bearer_ctx_status, int cp_ciot_enabled, @@ -165,6 +182,10 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, char *sm_context_ref, + char *sm_context_smf_id, + char *sm_context_smf_set_id, + char *sm_context_smf_service_set_id, + OpenAPI_sbi_binding_level_e sm_context_smf_binding, OpenAPI_up_cnx_state_e up_cnx_state, OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, diff --git a/lib/sbi/openapi/model/sm_context_create_error.c b/lib/sbi/openapi/model/sm_context_create_error.c index a35550d48..2d5199619 100644 --- a/lib/sbi/openapi/model/sm_context_create_error.c +++ b/lib/sbi/openapi/model/sm_context_create_error.c @@ -5,8 +5,10 @@ #include "sm_context_create_error.h" OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_create( - OpenAPI_problem_details_t *error, + OpenAPI_ext_problem_details_t *error, OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, char *recovery_time ) { @@ -16,6 +18,8 @@ OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_create( } sm_context_create_error_local_var->error = error; sm_context_create_error_local_var->n1_sm_msg = n1_sm_msg; + sm_context_create_error_local_var->n2_sm_info = n2_sm_info; + sm_context_create_error_local_var->n2_sm_info_type = n2_sm_info_type; sm_context_create_error_local_var->recovery_time = recovery_time; return sm_context_create_error_local_var; @@ -27,8 +31,9 @@ void OpenAPI_sm_context_create_error_free(OpenAPI_sm_context_create_error_t *sm_ return; } OpenAPI_lnode_t *node; - OpenAPI_problem_details_free(sm_context_create_error->error); + OpenAPI_ext_problem_details_free(sm_context_create_error->error); OpenAPI_ref_to_binary_data_free(sm_context_create_error->n1_sm_msg); + OpenAPI_ref_to_binary_data_free(sm_context_create_error->n2_sm_info); ogs_free(sm_context_create_error->recovery_time); ogs_free(sm_context_create_error); } @@ -47,7 +52,7 @@ cJSON *OpenAPI_sm_context_create_error_convertToJSON(OpenAPI_sm_context_create_e ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [error]"); goto end; } - cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(sm_context_create_error->error); + cJSON *error_local_JSON = OpenAPI_ext_problem_details_convertToJSON(sm_context_create_error->error); if (error_local_JSON == NULL) { ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [error]"); goto end; @@ -71,6 +76,26 @@ cJSON *OpenAPI_sm_context_create_error_convertToJSON(OpenAPI_sm_context_create_e } } + if (sm_context_create_error->n2_sm_info) { + cJSON *n2_sm_info_local_JSON = OpenAPI_ref_to_binary_data_convertToJSON(sm_context_create_error->n2_sm_info); + if (n2_sm_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [n2_sm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2SmInfo", n2_sm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [n2_sm_info]"); + goto end; + } + } + + if (sm_context_create_error->n2_sm_info_type) { + if (cJSON_AddStringToObject(item, "n2SmInfoType", OpenAPI_n2_sm_info_type_ToString(sm_context_create_error->n2_sm_info_type)) == NULL) { + ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [n2_sm_info_type]"); + goto end; + } + } + if (sm_context_create_error->recovery_time) { if (cJSON_AddStringToObject(item, "recoveryTime", sm_context_create_error->recovery_time) == NULL) { ogs_error("OpenAPI_sm_context_create_error_convertToJSON() failed [recovery_time]"); @@ -91,9 +116,9 @@ OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_parseFromJSON goto end; } - OpenAPI_problem_details_t *error_local_nonprim = NULL; + OpenAPI_ext_problem_details_t *error_local_nonprim = NULL; - error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + error_local_nonprim = OpenAPI_ext_problem_details_parseFromJSON(error); cJSON *n1_sm_msg = cJSON_GetObjectItemCaseSensitive(sm_context_create_errorJSON, "n1SmMsg"); @@ -102,6 +127,24 @@ OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_parseFromJSON n1_sm_msg_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_msg); } + cJSON *n2_sm_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_errorJSON, "n2SmInfo"); + + OpenAPI_ref_to_binary_data_t *n2_sm_info_local_nonprim = NULL; + if (n2_sm_info) { + n2_sm_info_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n2_sm_info); + } + + cJSON *n2_sm_info_type = cJSON_GetObjectItemCaseSensitive(sm_context_create_errorJSON, "n2SmInfoType"); + + OpenAPI_n2_sm_info_type_e n2_sm_info_typeVariable; + if (n2_sm_info_type) { + if (!cJSON_IsString(n2_sm_info_type)) { + ogs_error("OpenAPI_sm_context_create_error_parseFromJSON() failed [n2_sm_info_type]"); + goto end; + } + n2_sm_info_typeVariable = OpenAPI_n2_sm_info_type_FromString(n2_sm_info_type->valuestring); + } + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(sm_context_create_errorJSON, "recoveryTime"); if (recovery_time) { @@ -114,6 +157,8 @@ OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_parseFromJSON sm_context_create_error_local_var = OpenAPI_sm_context_create_error_create ( error_local_nonprim, n1_sm_msg ? n1_sm_msg_local_nonprim : NULL, + n2_sm_info ? n2_sm_info_local_nonprim : NULL, + n2_sm_info_type ? n2_sm_info_typeVariable : 0, recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL ); diff --git a/lib/sbi/openapi/model/sm_context_create_error.h b/lib/sbi/openapi/model/sm_context_create_error.h index 37cb47ab0..594154333 100644 --- a/lib/sbi/openapi/model/sm_context_create_error.h +++ b/lib/sbi/openapi/model/sm_context_create_error.h @@ -12,7 +12,8 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "problem_details.h" +#include "ext_problem_details.h" +#include "n2_sm_info_type.h" #include "ref_to_binary_data.h" #ifdef __cplusplus @@ -21,14 +22,18 @@ extern "C" { typedef struct OpenAPI_sm_context_create_error_s OpenAPI_sm_context_create_error_t; typedef struct OpenAPI_sm_context_create_error_s { - struct OpenAPI_problem_details_s *error; + struct OpenAPI_ext_problem_details_s *error; struct OpenAPI_ref_to_binary_data_s *n1_sm_msg; + struct OpenAPI_ref_to_binary_data_s *n2_sm_info; + OpenAPI_n2_sm_info_type_e n2_sm_info_type; char *recovery_time; } OpenAPI_sm_context_create_error_t; OpenAPI_sm_context_create_error_t *OpenAPI_sm_context_create_error_create( - OpenAPI_problem_details_t *error, + OpenAPI_ext_problem_details_t *error, OpenAPI_ref_to_binary_data_t *n1_sm_msg, + OpenAPI_ref_to_binary_data_t *n2_sm_info, + OpenAPI_n2_sm_info_type_e n2_sm_info_type, char *recovery_time ); void OpenAPI_sm_context_create_error_free(OpenAPI_sm_context_create_error_t *sm_context_create_error); diff --git a/lib/sbi/openapi/model/sm_context_created_data.c b/lib/sbi/openapi/model/sm_context_created_data.c index a69ab174e..7bf5c2f1c 100644 --- a/lib/sbi/openapi/model/sm_context_created_data.c +++ b/lib/sbi/openapi/model/sm_context_created_data.c @@ -17,7 +17,9 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( char *gpsi, char *smf_service_instance_id, char *recovery_time, - char *supported_features + char *supported_features, + char *selected_smf_id, + char *selected_old_smf_id ) { OpenAPI_sm_context_created_data_t *sm_context_created_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_created_data_t)); @@ -37,6 +39,8 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( sm_context_created_data_local_var->smf_service_instance_id = smf_service_instance_id; sm_context_created_data_local_var->recovery_time = recovery_time; sm_context_created_data_local_var->supported_features = supported_features; + sm_context_created_data_local_var->selected_smf_id = selected_smf_id; + sm_context_created_data_local_var->selected_old_smf_id = selected_old_smf_id; return sm_context_created_data_local_var; } @@ -59,6 +63,8 @@ void OpenAPI_sm_context_created_data_free(OpenAPI_sm_context_created_data_t *sm_ ogs_free(sm_context_created_data->smf_service_instance_id); ogs_free(sm_context_created_data->recovery_time); ogs_free(sm_context_created_data->supported_features); + ogs_free(sm_context_created_data->selected_smf_id); + ogs_free(sm_context_created_data->selected_old_smf_id); ogs_free(sm_context_created_data); } @@ -188,6 +194,20 @@ cJSON *OpenAPI_sm_context_created_data_convertToJSON(OpenAPI_sm_context_created_ } } + if (sm_context_created_data->selected_smf_id) { + if (cJSON_AddStringToObject(item, "selectedSmfId", sm_context_created_data->selected_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [selected_smf_id]"); + goto end; + } + } + + if (sm_context_created_data->selected_old_smf_id) { + if (cJSON_AddStringToObject(item, "selectedOldSmfId", sm_context_created_data->selected_old_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [selected_old_smf_id]"); + goto end; + } + } + end: return item; } @@ -328,6 +348,24 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON } } + cJSON *selected_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "selectedSmfId"); + + if (selected_smf_id) { + if (!cJSON_IsString(selected_smf_id)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [selected_smf_id]"); + goto end; + } + } + + cJSON *selected_old_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "selectedOldSmfId"); + + if (selected_old_smf_id) { + if (!cJSON_IsString(selected_old_smf_id)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [selected_old_smf_id]"); + goto end; + } + } + sm_context_created_data_local_var = OpenAPI_sm_context_created_data_create ( h_smf_uri ? ogs_strdup(h_smf_uri->valuestring) : NULL, smf_uri ? ogs_strdup(smf_uri->valuestring) : NULL, @@ -341,7 +379,9 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON gpsi ? ogs_strdup(gpsi->valuestring) : NULL, smf_service_instance_id ? ogs_strdup(smf_service_instance_id->valuestring) : NULL, recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, - supported_features ? ogs_strdup(supported_features->valuestring) : NULL + supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + selected_smf_id ? ogs_strdup(selected_smf_id->valuestring) : NULL, + selected_old_smf_id ? ogs_strdup(selected_old_smf_id->valuestring) : NULL ); return sm_context_created_data_local_var; diff --git a/lib/sbi/openapi/model/sm_context_created_data.h b/lib/sbi/openapi/model/sm_context_created_data.h index 8910085c3..b4a6cc1f8 100644 --- a/lib/sbi/openapi/model/sm_context_created_data.h +++ b/lib/sbi/openapi/model/sm_context_created_data.h @@ -38,6 +38,8 @@ typedef struct OpenAPI_sm_context_created_data_s { char *smf_service_instance_id; char *recovery_time; char *supported_features; + char *selected_smf_id; + char *selected_old_smf_id; } OpenAPI_sm_context_created_data_t; OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( @@ -53,7 +55,9 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( char *gpsi, char *smf_service_instance_id, char *recovery_time, - char *supported_features + char *supported_features, + char *selected_smf_id, + char *selected_old_smf_id ); void OpenAPI_sm_context_created_data_free(OpenAPI_sm_context_created_data_t *sm_context_created_data); OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON(cJSON *sm_context_created_dataJSON); diff --git a/lib/sbi/openapi/model/sm_context_status_notification.c b/lib/sbi/openapi/model/sm_context_status_notification.c index 75545748e..e354b4772 100644 --- a/lib/sbi/openapi/model/sm_context_status_notification.c +++ b/lib/sbi/openapi/model/sm_context_status_notification.c @@ -9,6 +9,7 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, int ddn_failure_status, + OpenAPI_list_t *notify_correlation_ids_forddn_failure, char *new_smf_id, char *new_smf_set_id, char *old_smf_id, @@ -23,6 +24,7 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification sm_context_status_notification_local_var->small_data_rate_status = small_data_rate_status; sm_context_status_notification_local_var->apn_rate_status = apn_rate_status; sm_context_status_notification_local_var->ddn_failure_status = ddn_failure_status; + sm_context_status_notification_local_var->notify_correlation_ids_forddn_failure = notify_correlation_ids_forddn_failure; sm_context_status_notification_local_var->new_smf_id = new_smf_id; sm_context_status_notification_local_var->new_smf_set_id = new_smf_set_id; sm_context_status_notification_local_var->old_smf_id = old_smf_id; @@ -40,6 +42,10 @@ void OpenAPI_sm_context_status_notification_free(OpenAPI_sm_context_status_notif OpenAPI_status_info_free(sm_context_status_notification->status_info); OpenAPI_small_data_rate_status_free(sm_context_status_notification->small_data_rate_status); OpenAPI_apn_rate_status_free(sm_context_status_notification->apn_rate_status); + OpenAPI_list_for_each(sm_context_status_notification->notify_correlation_ids_forddn_failure, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_status_notification->notify_correlation_ids_forddn_failure); ogs_free(sm_context_status_notification->new_smf_id); ogs_free(sm_context_status_notification->new_smf_set_id); ogs_free(sm_context_status_notification->old_smf_id); @@ -105,6 +111,22 @@ cJSON *OpenAPI_sm_context_status_notification_convertToJSON(OpenAPI_sm_context_s } } + if (sm_context_status_notification->notify_correlation_ids_forddn_failure) { + cJSON *notify_correlation_ids_forddn_failure = cJSON_AddArrayToObject(item, "notifyCorrelationIdsForddnFailure"); + if (notify_correlation_ids_forddn_failure == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [notify_correlation_ids_forddn_failure]"); + goto end; + } + + OpenAPI_lnode_t *notify_correlation_ids_forddn_failure_node; + OpenAPI_list_for_each(sm_context_status_notification->notify_correlation_ids_forddn_failure, notify_correlation_ids_forddn_failure_node) { + if (cJSON_AddStringToObject(notify_correlation_ids_forddn_failure, "", (char*)notify_correlation_ids_forddn_failure_node->data) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [notify_correlation_ids_forddn_failure]"); + goto end; + } + } + } + if (sm_context_status_notification->new_smf_id) { if (cJSON_AddStringToObject(item, "newSmfId", sm_context_status_notification->new_smf_id) == NULL) { ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [new_smf_id]"); @@ -173,6 +195,26 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification } } + cJSON *notify_correlation_ids_forddn_failure = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "notifyCorrelationIdsForddnFailure"); + + OpenAPI_list_t *notify_correlation_ids_forddn_failureList; + if (notify_correlation_ids_forddn_failure) { + cJSON *notify_correlation_ids_forddn_failure_local; + if (!cJSON_IsArray(notify_correlation_ids_forddn_failure)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [notify_correlation_ids_forddn_failure]"); + goto end; + } + notify_correlation_ids_forddn_failureList = OpenAPI_list_create(); + + cJSON_ArrayForEach(notify_correlation_ids_forddn_failure_local, notify_correlation_ids_forddn_failure) { + if (!cJSON_IsString(notify_correlation_ids_forddn_failure_local)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [notify_correlation_ids_forddn_failure]"); + goto end; + } + OpenAPI_list_add(notify_correlation_ids_forddn_failureList, ogs_strdup(notify_correlation_ids_forddn_failure_local->valuestring)); + } + } + cJSON *new_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "newSmfId"); if (new_smf_id) { @@ -214,6 +256,7 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, apn_rate_status ? apn_rate_status_local_nonprim : NULL, ddn_failure_status ? ddn_failure_status->valueint : 0, + notify_correlation_ids_forddn_failure ? notify_correlation_ids_forddn_failureList : NULL, new_smf_id ? ogs_strdup(new_smf_id->valuestring) : NULL, new_smf_set_id ? ogs_strdup(new_smf_set_id->valuestring) : NULL, old_smf_id ? ogs_strdup(old_smf_id->valuestring) : NULL, diff --git a/lib/sbi/openapi/model/sm_context_status_notification.h b/lib/sbi/openapi/model/sm_context_status_notification.h index e925a23b1..ef05a8ca3 100644 --- a/lib/sbi/openapi/model/sm_context_status_notification.h +++ b/lib/sbi/openapi/model/sm_context_status_notification.h @@ -26,6 +26,7 @@ typedef struct OpenAPI_sm_context_status_notification_s { struct OpenAPI_small_data_rate_status_s *small_data_rate_status; struct OpenAPI_apn_rate_status_s *apn_rate_status; int ddn_failure_status; + OpenAPI_list_t *notify_correlation_ids_forddn_failure; char *new_smf_id; char *new_smf_set_id; char *old_smf_id; @@ -37,6 +38,7 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, int ddn_failure_status, + OpenAPI_list_t *notify_correlation_ids_forddn_failure, char *new_smf_id, char *new_smf_set_id, char *old_smf_id, diff --git a/lib/sbi/openapi/model/sm_context_update_data.c b/lib/sbi/openapi/model/sm_context_update_data.c index b451a1940..72177696d 100644 --- a/lib/sbi/openapi/model/sm_context_update_data.c +++ b/lib/sbi/openapi/model/sm_context_update_data.c @@ -12,6 +12,7 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( OpenAPI_list_t *backup_amf_info, OpenAPI_access_type_e an_type, OpenAPI_access_type_e additional_an_type, + OpenAPI_access_type_e an_type_to_reactivate, OpenAPI_rat_type_e rat_type, OpenAPI_presence_state_e presence_in_ladn, OpenAPI_user_location_t *ue_location, @@ -48,7 +49,6 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( int ma_request_ind, OpenAPI_exemption_ind_t *exemption_ind, char *supported_features, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, int extended_nas_sm_timer_ind, char forwarding_f_teid, @@ -67,6 +67,7 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( sm_context_update_data_local_var->backup_amf_info = backup_amf_info; sm_context_update_data_local_var->an_type = an_type; sm_context_update_data_local_var->additional_an_type = additional_an_type; + sm_context_update_data_local_var->an_type_to_reactivate = an_type_to_reactivate; sm_context_update_data_local_var->rat_type = rat_type; sm_context_update_data_local_var->presence_in_ladn = presence_in_ladn; sm_context_update_data_local_var->ue_location = ue_location; @@ -103,7 +104,6 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( sm_context_update_data_local_var->ma_request_ind = ma_request_ind; sm_context_update_data_local_var->exemption_ind = exemption_ind; sm_context_update_data_local_var->supported_features = supported_features; - sm_context_update_data_local_var->mo_exp_data_ind = mo_exp_data_ind; sm_context_update_data_local_var->mo_exp_data_counter = mo_exp_data_counter; sm_context_update_data_local_var->extended_nas_sm_timer_ind = extended_nas_sm_timer_ind; sm_context_update_data_local_var->forwarding_f_teid = forwarding_f_teid; @@ -158,7 +158,6 @@ void OpenAPI_sm_context_update_data_free(OpenAPI_sm_context_update_data_t *sm_co OpenAPI_ref_to_binary_data_free(sm_context_update_data->n2_sm_info_ext1); OpenAPI_exemption_ind_free(sm_context_update_data->exemption_ind); ogs_free(sm_context_update_data->supported_features); - OpenAPI_mo_exception_data_flag_free(sm_context_update_data->mo_exp_data_ind); OpenAPI_mo_exp_data_counter_free(sm_context_update_data->mo_exp_data_counter); OpenAPI_list_for_each(sm_context_update_data->forwarding_bearer_contexts, node) { ogs_free(node->data); @@ -252,6 +251,13 @@ cJSON *OpenAPI_sm_context_update_data_convertToJSON(OpenAPI_sm_context_update_da } } + if (sm_context_update_data->an_type_to_reactivate) { + if (cJSON_AddStringToObject(item, "anTypeToReactivate", OpenAPI_access_type_ToString(sm_context_update_data->an_type_to_reactivate)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [an_type_to_reactivate]"); + goto end; + } + } + if (sm_context_update_data->rat_type) { if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(sm_context_update_data->rat_type)) == NULL) { ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [rat_type]"); @@ -614,19 +620,6 @@ cJSON *OpenAPI_sm_context_update_data_convertToJSON(OpenAPI_sm_context_update_da } } - if (sm_context_update_data->mo_exp_data_ind) { - cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(sm_context_update_data->mo_exp_data_ind); - if (mo_exp_data_ind_local_JSON == NULL) { - ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - } - if (sm_context_update_data->mo_exp_data_counter) { cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(sm_context_update_data->mo_exp_data_counter); if (mo_exp_data_counter_local_JSON == NULL) { @@ -767,6 +760,17 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c additional_an_typeVariable = OpenAPI_access_type_FromString(additional_an_type->valuestring); } + cJSON *an_type_to_reactivate = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "anTypeToReactivate"); + + OpenAPI_access_type_e an_type_to_reactivateVariable; + if (an_type_to_reactivate) { + if (!cJSON_IsString(an_type_to_reactivate)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [an_type_to_reactivate]"); + goto end; + } + an_type_to_reactivateVariable = OpenAPI_access_type_FromString(an_type_to_reactivate->valuestring); + } + cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "ratType"); OpenAPI_rat_type_e rat_typeVariable; @@ -1137,13 +1141,6 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c } } - cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "moExpDataInd"); - - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; - if (mo_exp_data_ind) { - mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); - } - cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "moExpDataCounter"); OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; @@ -1204,6 +1201,7 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c backup_amf_info ? backup_amf_infoList : NULL, an_type ? an_typeVariable : 0, additional_an_type ? additional_an_typeVariable : 0, + an_type_to_reactivate ? an_type_to_reactivateVariable : 0, rat_type ? rat_typeVariable : 0, presence_in_ladn ? presence_in_ladnVariable : 0, ue_location ? ue_location_local_nonprim : NULL, @@ -1240,7 +1238,6 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c ma_request_ind ? ma_request_ind->valueint : 0, exemption_ind ? exemption_ind_local_nonprim : NULL, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, - mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, extended_nas_sm_timer_ind ? extended_nas_sm_timer_ind->valueint : 0, forwarding_f_teid ? forwarding_f_teid->valueint : 0, diff --git a/lib/sbi/openapi/model/sm_context_update_data.h b/lib/sbi/openapi/model/sm_context_update_data.h index d89e32ce5..60ae5ccae 100644 --- a/lib/sbi/openapi/model/sm_context_update_data.h +++ b/lib/sbi/openapi/model/sm_context_update_data.h @@ -22,7 +22,6 @@ #include "ho_state.h" #include "indirect_data_forwarding_tunnel_info.h" #include "ma_release_indication.h" -#include "mo_exception_data_flag.h" #include "mo_exp_data_counter.h" #include "n2_sm_info_type.h" #include "ng_ap_cause.h" @@ -50,6 +49,7 @@ typedef struct OpenAPI_sm_context_update_data_s { OpenAPI_list_t *backup_amf_info; OpenAPI_access_type_e an_type; OpenAPI_access_type_e additional_an_type; + OpenAPI_access_type_e an_type_to_reactivate; OpenAPI_rat_type_e rat_type; OpenAPI_presence_state_e presence_in_ladn; struct OpenAPI_user_location_s *ue_location; @@ -86,7 +86,6 @@ typedef struct OpenAPI_sm_context_update_data_s { int ma_request_ind; struct OpenAPI_exemption_ind_s *exemption_ind; char *supported_features; - struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; int extended_nas_sm_timer_ind; char forwarding_f_teid; @@ -102,6 +101,7 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( OpenAPI_list_t *backup_amf_info, OpenAPI_access_type_e an_type, OpenAPI_access_type_e additional_an_type, + OpenAPI_access_type_e an_type_to_reactivate, OpenAPI_rat_type_e rat_type, OpenAPI_presence_state_e presence_in_ladn, OpenAPI_user_location_t *ue_location, @@ -138,7 +138,6 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( int ma_request_ind, OpenAPI_exemption_ind_t *exemption_ind, char *supported_features, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, int extended_nas_sm_timer_ind, char forwarding_f_teid, diff --git a/lib/sbi/openapi/model/sm_context_update_error.c b/lib/sbi/openapi/model/sm_context_update_error.c index 365f11275..026471dd0 100644 --- a/lib/sbi/openapi/model/sm_context_update_error.c +++ b/lib/sbi/openapi/model/sm_context_update_error.c @@ -5,7 +5,7 @@ #include "sm_context_update_error.h" OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_create( - OpenAPI_problem_details_t *error, + OpenAPI_ext_problem_details_t *error, OpenAPI_ref_to_binary_data_t *n1_sm_msg, OpenAPI_ref_to_binary_data_t *n2_sm_info, OpenAPI_n2_sm_info_type_e n2_sm_info_type, @@ -33,7 +33,7 @@ void OpenAPI_sm_context_update_error_free(OpenAPI_sm_context_update_error_t *sm_ return; } OpenAPI_lnode_t *node; - OpenAPI_problem_details_free(sm_context_update_error->error); + OpenAPI_ext_problem_details_free(sm_context_update_error->error); OpenAPI_ref_to_binary_data_free(sm_context_update_error->n1_sm_msg); OpenAPI_ref_to_binary_data_free(sm_context_update_error->n2_sm_info); ogs_free(sm_context_update_error->recovery_time); @@ -54,7 +54,7 @@ cJSON *OpenAPI_sm_context_update_error_convertToJSON(OpenAPI_sm_context_update_e ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [error]"); goto end; } - cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(sm_context_update_error->error); + cJSON *error_local_JSON = OpenAPI_ext_problem_details_convertToJSON(sm_context_update_error->error); if (error_local_JSON == NULL) { ogs_error("OpenAPI_sm_context_update_error_convertToJSON() failed [error]"); goto end; @@ -125,9 +125,9 @@ OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_parseFromJSON goto end; } - OpenAPI_problem_details_t *error_local_nonprim = NULL; + OpenAPI_ext_problem_details_t *error_local_nonprim = NULL; - error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + error_local_nonprim = OpenAPI_ext_problem_details_parseFromJSON(error); cJSON *n1_sm_msg = cJSON_GetObjectItemCaseSensitive(sm_context_update_errorJSON, "n1SmMsg"); diff --git a/lib/sbi/openapi/model/sm_context_update_error.h b/lib/sbi/openapi/model/sm_context_update_error.h index 2fcc91ae5..e77681ff1 100644 --- a/lib/sbi/openapi/model/sm_context_update_error.h +++ b/lib/sbi/openapi/model/sm_context_update_error.h @@ -12,8 +12,8 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ext_problem_details.h" #include "n2_sm_info_type.h" -#include "problem_details.h" #include "ref_to_binary_data.h" #include "up_cnx_state.h" @@ -23,7 +23,7 @@ extern "C" { typedef struct OpenAPI_sm_context_update_error_s OpenAPI_sm_context_update_error_t; typedef struct OpenAPI_sm_context_update_error_s { - struct OpenAPI_problem_details_s *error; + struct OpenAPI_ext_problem_details_s *error; struct OpenAPI_ref_to_binary_data_s *n1_sm_msg; struct OpenAPI_ref_to_binary_data_s *n2_sm_info; OpenAPI_n2_sm_info_type_e n2_sm_info_type; @@ -32,7 +32,7 @@ typedef struct OpenAPI_sm_context_update_error_s { } OpenAPI_sm_context_update_error_t; OpenAPI_sm_context_update_error_t *OpenAPI_sm_context_update_error_create( - OpenAPI_problem_details_t *error, + OpenAPI_ext_problem_details_t *error, OpenAPI_ref_to_binary_data_t *n1_sm_msg, OpenAPI_ref_to_binary_data_t *n2_sm_info, OpenAPI_n2_sm_info_type_e n2_sm_info_type, diff --git a/lib/sbi/openapi/model/sm_context_updated_data.c b/lib/sbi/openapi/model/sm_context_updated_data.c index b6d2f620f..c10a1a184 100644 --- a/lib/sbi/openapi/model/sm_context_updated_data.c +++ b/lib/sbi/openapi/model/sm_context_updated_data.c @@ -21,7 +21,9 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( int ma_accepted_ind, char *supported_features, char forwarding_f_teid, - OpenAPI_list_t *forwarding_bearer_contexts + OpenAPI_list_t *forwarding_bearer_contexts, + char *selected_smf_id, + char *selected_old_smf_id ) { OpenAPI_sm_context_updated_data_t *sm_context_updated_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_context_updated_data_t)); @@ -45,6 +47,8 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( sm_context_updated_data_local_var->supported_features = supported_features; sm_context_updated_data_local_var->forwarding_f_teid = forwarding_f_teid; sm_context_updated_data_local_var->forwarding_bearer_contexts = forwarding_bearer_contexts; + sm_context_updated_data_local_var->selected_smf_id = selected_smf_id; + sm_context_updated_data_local_var->selected_old_smf_id = selected_old_smf_id; return sm_context_updated_data_local_var; } @@ -86,6 +90,8 @@ void OpenAPI_sm_context_updated_data_free(OpenAPI_sm_context_updated_data_t *sm_ ogs_free(node->data); } OpenAPI_list_free(sm_context_updated_data->forwarding_bearer_contexts); + ogs_free(sm_context_updated_data->selected_smf_id); + ogs_free(sm_context_updated_data->selected_old_smf_id); ogs_free(sm_context_updated_data); } @@ -309,6 +315,20 @@ cJSON *OpenAPI_sm_context_updated_data_convertToJSON(OpenAPI_sm_context_updated_ } } + if (sm_context_updated_data->selected_smf_id) { + if (cJSON_AddStringToObject(item, "selectedSmfId", sm_context_updated_data->selected_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [selected_smf_id]"); + goto end; + } + } + + if (sm_context_updated_data->selected_old_smf_id) { + if (cJSON_AddStringToObject(item, "selectedOldSmfId", sm_context_updated_data->selected_old_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [selected_old_smf_id]"); + goto end; + } + } + end: return item; } @@ -562,6 +582,24 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON } } + cJSON *selected_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "selectedSmfId"); + + if (selected_smf_id) { + if (!cJSON_IsString(selected_smf_id)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [selected_smf_id]"); + goto end; + } + } + + cJSON *selected_old_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "selectedOldSmfId"); + + if (selected_old_smf_id) { + if (!cJSON_IsString(selected_old_smf_id)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [selected_old_smf_id]"); + goto end; + } + } + sm_context_updated_data_local_var = OpenAPI_sm_context_updated_data_create ( up_cnx_state ? up_cnx_stateVariable : 0, ho_state ? ho_stateVariable : 0, @@ -579,7 +617,9 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON ma_accepted_ind ? ma_accepted_ind->valueint : 0, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, forwarding_f_teid ? forwarding_f_teid->valueint : 0, - forwarding_bearer_contexts ? forwarding_bearer_contextsList : NULL + forwarding_bearer_contexts ? forwarding_bearer_contextsList : NULL, + selected_smf_id ? ogs_strdup(selected_smf_id->valuestring) : NULL, + selected_old_smf_id ? ogs_strdup(selected_old_smf_id->valuestring) : NULL ); return sm_context_updated_data_local_var; diff --git a/lib/sbi/openapi/model/sm_context_updated_data.h b/lib/sbi/openapi/model/sm_context_updated_data.h index 55656a39a..ab65f90bf 100644 --- a/lib/sbi/openapi/model/sm_context_updated_data.h +++ b/lib/sbi/openapi/model/sm_context_updated_data.h @@ -43,6 +43,8 @@ typedef struct OpenAPI_sm_context_updated_data_s { char *supported_features; char forwarding_f_teid; OpenAPI_list_t *forwarding_bearer_contexts; + char *selected_smf_id; + char *selected_old_smf_id; } OpenAPI_sm_context_updated_data_t; OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( @@ -62,7 +64,9 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( int ma_accepted_ind, char *supported_features, char forwarding_f_teid, - OpenAPI_list_t *forwarding_bearer_contexts + OpenAPI_list_t *forwarding_bearer_contexts, + char *selected_smf_id, + char *selected_old_smf_id ); void OpenAPI_sm_context_updated_data_free(OpenAPI_sm_context_updated_data_t *sm_context_updated_data); OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON(cJSON *sm_context_updated_dataJSON); diff --git a/lib/sbi/openapi/model/smf_info.c b/lib/sbi/openapi/model/smf_info.c index c56f2d7c6..dffc6d0fe 100644 --- a/lib/sbi/openapi/model/smf_info.c +++ b/lib/sbi/openapi/model/smf_info.c @@ -10,7 +10,8 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_create( OpenAPI_list_t *tai_range_list, char *pgw_fqdn, OpenAPI_list_t *access_type, - int priority + int priority, + int vsmf_support_ind ) { OpenAPI_smf_info_t *smf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_smf_info_t)); @@ -23,6 +24,7 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_create( smf_info_local_var->pgw_fqdn = pgw_fqdn; smf_info_local_var->access_type = access_type; smf_info_local_var->priority = priority; + smf_info_local_var->vsmf_support_ind = vsmf_support_ind; return smf_info_local_var; } @@ -151,6 +153,13 @@ cJSON *OpenAPI_smf_info_convertToJSON(OpenAPI_smf_info_t *smf_info) } } + if (smf_info->vsmf_support_ind) { + if (cJSON_AddBoolToObject(item, "vsmfSupportInd", smf_info->vsmf_support_ind) == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [vsmf_support_ind]"); + goto end; + } + } + end: return item; } @@ -270,13 +279,23 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON) } } + cJSON *vsmf_support_ind = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "vsmfSupportInd"); + + if (vsmf_support_ind) { + if (!cJSON_IsBool(vsmf_support_ind)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [vsmf_support_ind]"); + goto end; + } + } + smf_info_local_var = OpenAPI_smf_info_create ( s_nssai_smf_info_listList, tai_list ? tai_listList : NULL, tai_range_list ? tai_range_listList : NULL, pgw_fqdn ? ogs_strdup(pgw_fqdn->valuestring) : NULL, access_type ? access_typeList : NULL, - priority ? priority->valuedouble : 0 + priority ? priority->valuedouble : 0, + vsmf_support_ind ? vsmf_support_ind->valueint : 0 ); return smf_info_local_var; diff --git a/lib/sbi/openapi/model/smf_info.h b/lib/sbi/openapi/model/smf_info.h index bb87b649c..e83e8866d 100644 --- a/lib/sbi/openapi/model/smf_info.h +++ b/lib/sbi/openapi/model/smf_info.h @@ -29,6 +29,7 @@ typedef struct OpenAPI_smf_info_s { char *pgw_fqdn; OpenAPI_list_t *access_type; int priority; + int vsmf_support_ind; } OpenAPI_smf_info_t; OpenAPI_smf_info_t *OpenAPI_smf_info_create( @@ -37,7 +38,8 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_create( OpenAPI_list_t *tai_range_list, char *pgw_fqdn, OpenAPI_list_t *access_type, - int priority + int priority, + int vsmf_support_ind ); void OpenAPI_smf_info_free(OpenAPI_smf_info_t *smf_info); OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON); diff --git a/lib/sbi/openapi/model/smf_registration.c b/lib/sbi/openapi/model/smf_registration.c index a63ba54b5..3c4a59a50 100644 --- a/lib/sbi/openapi/model/smf_registration.c +++ b/lib/sbi/openapi/model/smf_registration.c @@ -18,7 +18,8 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( int epdg_ind, char *dereg_callback_uri, OpenAPI_registration_reason_t *registration_reason, - char *registration_time + char *registration_time, + OpenAPI_context_info_t *context_info ) { OpenAPI_smf_registration_t *smf_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_smf_registration_t)); @@ -39,6 +40,7 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( smf_registration_local_var->dereg_callback_uri = dereg_callback_uri; smf_registration_local_var->registration_reason = registration_reason; smf_registration_local_var->registration_time = registration_time; + smf_registration_local_var->context_info = context_info; return smf_registration_local_var; } @@ -60,6 +62,7 @@ void OpenAPI_smf_registration_free(OpenAPI_smf_registration_t *smf_registration) ogs_free(smf_registration->dereg_callback_uri); OpenAPI_registration_reason_free(smf_registration->registration_reason); ogs_free(smf_registration->registration_time); + OpenAPI_context_info_free(smf_registration->context_info); ogs_free(smf_registration); } @@ -197,6 +200,19 @@ cJSON *OpenAPI_smf_registration_convertToJSON(OpenAPI_smf_registration_t *smf_re } } + if (smf_registration->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(smf_registration->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [context_info]"); + goto end; + } + } + end: return item; } @@ -336,6 +352,13 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_re } } + cJSON *context_info = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "contextInfo"); + + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + smf_registration_local_var = OpenAPI_smf_registration_create ( ogs_strdup(smf_instance_id->valuestring), smf_set_id ? ogs_strdup(smf_set_id->valuestring) : NULL, @@ -350,7 +373,8 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_re epdg_ind ? epdg_ind->valueint : 0, dereg_callback_uri ? ogs_strdup(dereg_callback_uri->valuestring) : NULL, registration_reason ? registration_reason_local_nonprim : NULL, - registration_time ? ogs_strdup(registration_time->valuestring) : NULL + registration_time ? ogs_strdup(registration_time->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL ); return smf_registration_local_var; diff --git a/lib/sbi/openapi/model/smf_registration.h b/lib/sbi/openapi/model/smf_registration.h index a4e8a2686..4769b4dc9 100644 --- a/lib/sbi/openapi/model/smf_registration.h +++ b/lib/sbi/openapi/model/smf_registration.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "context_info.h" #include "plmn_id.h" #include "registration_reason.h" #include "snssai.h" @@ -36,6 +37,7 @@ typedef struct OpenAPI_smf_registration_s { char *dereg_callback_uri; struct OpenAPI_registration_reason_s *registration_reason; char *registration_time; + struct OpenAPI_context_info_s *context_info; } OpenAPI_smf_registration_t; OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( @@ -52,7 +54,8 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( int epdg_ind, char *dereg_callback_uri, OpenAPI_registration_reason_t *registration_reason, - char *registration_time + char *registration_time, + OpenAPI_context_info_t *context_info ); void OpenAPI_smf_registration_free(OpenAPI_smf_registration_t *smf_registration); OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_registrationJSON); diff --git a/lib/sbi/openapi/model/smsc_data.c b/lib/sbi/openapi/model/smsc_data.c new file mode 100644 index 000000000..10f8c5fb0 --- /dev/null +++ b/lib/sbi/openapi/model/smsc_data.c @@ -0,0 +1,129 @@ + +#include +#include +#include +#include "smsc_data.h" + +OpenAPI_smsc_data_t *OpenAPI_smsc_data_create( + char *smsc_map_address, + OpenAPI_network_node_diameter_address_t *smsc_diameter_address + ) +{ + OpenAPI_smsc_data_t *smsc_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_smsc_data_t)); + if (!smsc_data_local_var) { + return NULL; + } + smsc_data_local_var->smsc_map_address = smsc_map_address; + smsc_data_local_var->smsc_diameter_address = smsc_diameter_address; + + return smsc_data_local_var; +} + +void OpenAPI_smsc_data_free(OpenAPI_smsc_data_t *smsc_data) +{ + if (NULL == smsc_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(smsc_data->smsc_map_address); + OpenAPI_network_node_diameter_address_free(smsc_data->smsc_diameter_address); + ogs_free(smsc_data); +} + +cJSON *OpenAPI_smsc_data_convertToJSON(OpenAPI_smsc_data_t *smsc_data) +{ + cJSON *item = NULL; + + if (smsc_data == NULL) { + ogs_error("OpenAPI_smsc_data_convertToJSON() failed [SmscData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (smsc_data->smsc_map_address) { + if (cJSON_AddStringToObject(item, "smscMapAddress", smsc_data->smsc_map_address) == NULL) { + ogs_error("OpenAPI_smsc_data_convertToJSON() failed [smsc_map_address]"); + goto end; + } + } + + if (smsc_data->smsc_diameter_address) { + cJSON *smsc_diameter_address_local_JSON = OpenAPI_network_node_diameter_address_convertToJSON(smsc_data->smsc_diameter_address); + if (smsc_diameter_address_local_JSON == NULL) { + ogs_error("OpenAPI_smsc_data_convertToJSON() failed [smsc_diameter_address]"); + goto end; + } + cJSON_AddItemToObject(item, "smscDiameterAddress", smsc_diameter_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smsc_data_convertToJSON() failed [smsc_diameter_address]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_smsc_data_t *OpenAPI_smsc_data_parseFromJSON(cJSON *smsc_dataJSON) +{ + OpenAPI_smsc_data_t *smsc_data_local_var = NULL; + cJSON *smsc_map_address = cJSON_GetObjectItemCaseSensitive(smsc_dataJSON, "smscMapAddress"); + + if (smsc_map_address) { + if (!cJSON_IsString(smsc_map_address)) { + ogs_error("OpenAPI_smsc_data_parseFromJSON() failed [smsc_map_address]"); + goto end; + } + } + + cJSON *smsc_diameter_address = cJSON_GetObjectItemCaseSensitive(smsc_dataJSON, "smscDiameterAddress"); + + OpenAPI_network_node_diameter_address_t *smsc_diameter_address_local_nonprim = NULL; + if (smsc_diameter_address) { + smsc_diameter_address_local_nonprim = OpenAPI_network_node_diameter_address_parseFromJSON(smsc_diameter_address); + } + + smsc_data_local_var = OpenAPI_smsc_data_create ( + smsc_map_address ? ogs_strdup(smsc_map_address->valuestring) : NULL, + smsc_diameter_address ? smsc_diameter_address_local_nonprim : NULL + ); + + return smsc_data_local_var; +end: + return NULL; +} + +OpenAPI_smsc_data_t *OpenAPI_smsc_data_copy(OpenAPI_smsc_data_t *dst, OpenAPI_smsc_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smsc_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smsc_data_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_smsc_data_free(dst); + dst = OpenAPI_smsc_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smsc_data.h b/lib/sbi/openapi/model/smsc_data.h new file mode 100644 index 000000000..d8d4370d4 --- /dev/null +++ b/lib/sbi/openapi/model/smsc_data.h @@ -0,0 +1,41 @@ +/* + * smsc_data.h + * + * + */ + +#ifndef _OpenAPI_smsc_data_H_ +#define _OpenAPI_smsc_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_node_diameter_address.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_smsc_data_s OpenAPI_smsc_data_t; +typedef struct OpenAPI_smsc_data_s { + char *smsc_map_address; + struct OpenAPI_network_node_diameter_address_s *smsc_diameter_address; +} OpenAPI_smsc_data_t; + +OpenAPI_smsc_data_t *OpenAPI_smsc_data_create( + char *smsc_map_address, + OpenAPI_network_node_diameter_address_t *smsc_diameter_address + ); +void OpenAPI_smsc_data_free(OpenAPI_smsc_data_t *smsc_data); +OpenAPI_smsc_data_t *OpenAPI_smsc_data_parseFromJSON(cJSON *smsc_dataJSON); +cJSON *OpenAPI_smsc_data_convertToJSON(OpenAPI_smsc_data_t *smsc_data); +OpenAPI_smsc_data_t *OpenAPI_smsc_data_copy(OpenAPI_smsc_data_t *dst, OpenAPI_smsc_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smsc_data_H_ */ + diff --git a/lib/sbi/openapi/model/smsf_registration.c b/lib/sbi/openapi/model/smsf_registration.c index 52bcd686e..f6f1c0bd7 100644 --- a/lib/sbi/openapi/model/smsf_registration.c +++ b/lib/sbi/openapi/model/smsf_registration.c @@ -11,7 +11,8 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( OpenAPI_plmn_id_t *plmn_id, char *smsf_map_address, OpenAPI_network_node_diameter_address_t *smsf_diameter_address, - char *registration_time + char *registration_time, + OpenAPI_context_info_t *context_info ) { OpenAPI_smsf_registration_t *smsf_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_smsf_registration_t)); @@ -25,6 +26,7 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( smsf_registration_local_var->smsf_map_address = smsf_map_address; smsf_registration_local_var->smsf_diameter_address = smsf_diameter_address; smsf_registration_local_var->registration_time = registration_time; + smsf_registration_local_var->context_info = context_info; return smsf_registration_local_var; } @@ -42,6 +44,7 @@ void OpenAPI_smsf_registration_free(OpenAPI_smsf_registration_t *smsf_registrati ogs_free(smsf_registration->smsf_map_address); OpenAPI_network_node_diameter_address_free(smsf_registration->smsf_diameter_address); ogs_free(smsf_registration->registration_time); + OpenAPI_context_info_free(smsf_registration->context_info); ogs_free(smsf_registration); } @@ -120,6 +123,19 @@ cJSON *OpenAPI_smsf_registration_convertToJSON(OpenAPI_smsf_registration_t *smsf } } + if (smsf_registration->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(smsf_registration->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [context_info]"); + goto end; + } + } + end: return item; } @@ -192,6 +208,13 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf } } + cJSON *context_info = cJSON_GetObjectItemCaseSensitive(smsf_registrationJSON, "contextInfo"); + + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + smsf_registration_local_var = OpenAPI_smsf_registration_create ( ogs_strdup(smsf_instance_id->valuestring), smsf_set_id ? ogs_strdup(smsf_set_id->valuestring) : NULL, @@ -199,7 +222,8 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf plmn_id_local_nonprim, smsf_map_address ? ogs_strdup(smsf_map_address->valuestring) : NULL, smsf_diameter_address ? smsf_diameter_address_local_nonprim : NULL, - registration_time ? ogs_strdup(registration_time->valuestring) : NULL + registration_time ? ogs_strdup(registration_time->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL ); return smsf_registration_local_var; diff --git a/lib/sbi/openapi/model/smsf_registration.h b/lib/sbi/openapi/model/smsf_registration.h index 95764e807..19dadfa44 100644 --- a/lib/sbi/openapi/model/smsf_registration.h +++ b/lib/sbi/openapi/model/smsf_registration.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "context_info.h" #include "network_node_diameter_address.h" #include "plmn_id.h" @@ -28,6 +29,7 @@ typedef struct OpenAPI_smsf_registration_s { char *smsf_map_address; struct OpenAPI_network_node_diameter_address_s *smsf_diameter_address; char *registration_time; + struct OpenAPI_context_info_s *context_info; } OpenAPI_smsf_registration_t; OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( @@ -37,7 +39,8 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( OpenAPI_plmn_id_t *plmn_id, char *smsf_map_address, OpenAPI_network_node_diameter_address_t *smsf_diameter_address, - char *registration_time + char *registration_time, + OpenAPI_context_info_t *context_info ); void OpenAPI_smsf_registration_free(OpenAPI_smsf_registration_t *smsf_registration); OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf_registrationJSON); diff --git a/lib/sbi/openapi/model/snssai_extension.c b/lib/sbi/openapi/model/snssai_extension.c new file mode 100644 index 000000000..c9b046105 --- /dev/null +++ b/lib/sbi/openapi/model/snssai_extension.c @@ -0,0 +1,154 @@ + +#include +#include +#include +#include "snssai_extension.h" + +OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_create( + OpenAPI_list_t *sd_ranges, + int wildcard_sd + ) +{ + OpenAPI_snssai_extension_t *snssai_extension_local_var = OpenAPI_malloc(sizeof(OpenAPI_snssai_extension_t)); + if (!snssai_extension_local_var) { + return NULL; + } + snssai_extension_local_var->sd_ranges = sd_ranges; + snssai_extension_local_var->wildcard_sd = wildcard_sd; + + return snssai_extension_local_var; +} + +void OpenAPI_snssai_extension_free(OpenAPI_snssai_extension_t *snssai_extension) +{ + if (NULL == snssai_extension) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(snssai_extension->sd_ranges, node) { + OpenAPI_sd_range_free(node->data); + } + OpenAPI_list_free(snssai_extension->sd_ranges); + ogs_free(snssai_extension); +} + +cJSON *OpenAPI_snssai_extension_convertToJSON(OpenAPI_snssai_extension_t *snssai_extension) +{ + cJSON *item = NULL; + + if (snssai_extension == NULL) { + ogs_error("OpenAPI_snssai_extension_convertToJSON() failed [SnssaiExtension]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (snssai_extension->sd_ranges) { + cJSON *sd_rangesList = cJSON_AddArrayToObject(item, "sdRanges"); + if (sd_rangesList == NULL) { + ogs_error("OpenAPI_snssai_extension_convertToJSON() failed [sd_ranges]"); + goto end; + } + + OpenAPI_lnode_t *sd_ranges_node; + if (snssai_extension->sd_ranges) { + OpenAPI_list_for_each(snssai_extension->sd_ranges, sd_ranges_node) { + cJSON *itemLocal = OpenAPI_sd_range_convertToJSON(sd_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_snssai_extension_convertToJSON() failed [sd_ranges]"); + goto end; + } + cJSON_AddItemToArray(sd_rangesList, itemLocal); + } + } + } + + if (snssai_extension->wildcard_sd) { + if (cJSON_AddBoolToObject(item, "wildcardSd", snssai_extension->wildcard_sd) == NULL) { + ogs_error("OpenAPI_snssai_extension_convertToJSON() failed [wildcard_sd]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_parseFromJSON(cJSON *snssai_extensionJSON) +{ + OpenAPI_snssai_extension_t *snssai_extension_local_var = NULL; + cJSON *sd_ranges = cJSON_GetObjectItemCaseSensitive(snssai_extensionJSON, "sdRanges"); + + OpenAPI_list_t *sd_rangesList; + if (sd_ranges) { + cJSON *sd_ranges_local_nonprimitive; + if (!cJSON_IsArray(sd_ranges)) { + ogs_error("OpenAPI_snssai_extension_parseFromJSON() failed [sd_ranges]"); + goto end; + } + + sd_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(sd_ranges_local_nonprimitive, sd_ranges ) { + if (!cJSON_IsObject(sd_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_snssai_extension_parseFromJSON() failed [sd_ranges]"); + goto end; + } + OpenAPI_sd_range_t *sd_rangesItem = OpenAPI_sd_range_parseFromJSON(sd_ranges_local_nonprimitive); + + OpenAPI_list_add(sd_rangesList, sd_rangesItem); + } + } + + cJSON *wildcard_sd = cJSON_GetObjectItemCaseSensitive(snssai_extensionJSON, "wildcardSd"); + + if (wildcard_sd) { + if (!cJSON_IsBool(wildcard_sd)) { + ogs_error("OpenAPI_snssai_extension_parseFromJSON() failed [wildcard_sd]"); + goto end; + } + } + + snssai_extension_local_var = OpenAPI_snssai_extension_create ( + sd_ranges ? sd_rangesList : NULL, + wildcard_sd ? wildcard_sd->valueint : 0 + ); + + return snssai_extension_local_var; +end: + return NULL; +} + +OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_copy(OpenAPI_snssai_extension_t *dst, OpenAPI_snssai_extension_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_extension_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_extension_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_snssai_extension_free(dst); + dst = OpenAPI_snssai_extension_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_extension.h b/lib/sbi/openapi/model/snssai_extension.h new file mode 100644 index 000000000..c107dfee9 --- /dev/null +++ b/lib/sbi/openapi/model/snssai_extension.h @@ -0,0 +1,41 @@ +/* + * snssai_extension.h + * + * Extensions to the Snssai data type + */ + +#ifndef _OpenAPI_snssai_extension_H_ +#define _OpenAPI_snssai_extension_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "sd_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_extension_s OpenAPI_snssai_extension_t; +typedef struct OpenAPI_snssai_extension_s { + OpenAPI_list_t *sd_ranges; + int wildcard_sd; +} OpenAPI_snssai_extension_t; + +OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_create( + OpenAPI_list_t *sd_ranges, + int wildcard_sd + ); +void OpenAPI_snssai_extension_free(OpenAPI_snssai_extension_t *snssai_extension); +OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_parseFromJSON(cJSON *snssai_extensionJSON); +cJSON *OpenAPI_snssai_extension_convertToJSON(OpenAPI_snssai_extension_t *snssai_extension); +OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_copy(OpenAPI_snssai_extension_t *dst, OpenAPI_snssai_extension_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_extension_H_ */ + diff --git a/lib/sbi/openapi/model/subscribed_snssai.c b/lib/sbi/openapi/model/subscribed_snssai.c new file mode 100644 index 000000000..7b2dec2e1 --- /dev/null +++ b/lib/sbi/openapi/model/subscribed_snssai.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "subscribed_snssai.h" + +OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_create( + OpenAPI_snssai_t *subscribed_snssai, + int default_indication + ) +{ + OpenAPI_subscribed_snssai_t *subscribed_snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_subscribed_snssai_t)); + if (!subscribed_snssai_local_var) { + return NULL; + } + subscribed_snssai_local_var->subscribed_snssai = subscribed_snssai; + subscribed_snssai_local_var->default_indication = default_indication; + + return subscribed_snssai_local_var; +} + +void OpenAPI_subscribed_snssai_free(OpenAPI_subscribed_snssai_t *subscribed_snssai) +{ + if (NULL == subscribed_snssai) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(subscribed_snssai->subscribed_snssai); + ogs_free(subscribed_snssai); +} + +cJSON *OpenAPI_subscribed_snssai_convertToJSON(OpenAPI_subscribed_snssai_t *subscribed_snssai) +{ + cJSON *item = NULL; + + if (subscribed_snssai == NULL) { + ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [SubscribedSnssai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!subscribed_snssai->subscribed_snssai) { + ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [subscribed_snssai]"); + goto end; + } + cJSON *subscribed_snssai_local_JSON = OpenAPI_snssai_convertToJSON(subscribed_snssai->subscribed_snssai); + if (subscribed_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [subscribed_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "subscribedSnssai", subscribed_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [subscribed_snssai]"); + goto end; + } + + if (subscribed_snssai->default_indication) { + if (cJSON_AddBoolToObject(item, "defaultIndication", subscribed_snssai->default_indication) == NULL) { + ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [default_indication]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_parseFromJSON(cJSON *subscribed_snssaiJSON) +{ + OpenAPI_subscribed_snssai_t *subscribed_snssai_local_var = NULL; + cJSON *subscribed_snssai = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "subscribedSnssai"); + if (!subscribed_snssai) { + ogs_error("OpenAPI_subscribed_snssai_parseFromJSON() failed [subscribed_snssai]"); + goto end; + } + + OpenAPI_snssai_t *subscribed_snssai_local_nonprim = NULL; + + subscribed_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(subscribed_snssai); + + cJSON *default_indication = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "defaultIndication"); + + if (default_indication) { + if (!cJSON_IsBool(default_indication)) { + ogs_error("OpenAPI_subscribed_snssai_parseFromJSON() failed [default_indication]"); + goto end; + } + } + + subscribed_snssai_local_var = OpenAPI_subscribed_snssai_create ( + subscribed_snssai_local_nonprim, + default_indication ? default_indication->valueint : 0 + ); + + return subscribed_snssai_local_var; +end: + return NULL; +} + +OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_copy(OpenAPI_subscribed_snssai_t *dst, OpenAPI_subscribed_snssai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscribed_snssai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscribed_snssai_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_subscribed_snssai_free(dst); + dst = OpenAPI_subscribed_snssai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscribed_snssai.h b/lib/sbi/openapi/model/subscribed_snssai.h new file mode 100644 index 000000000..c38bc3c7e --- /dev/null +++ b/lib/sbi/openapi/model/subscribed_snssai.h @@ -0,0 +1,41 @@ +/* + * subscribed_snssai.h + * + * + */ + +#ifndef _OpenAPI_subscribed_snssai_H_ +#define _OpenAPI_subscribed_snssai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_subscribed_snssai_s OpenAPI_subscribed_snssai_t; +typedef struct OpenAPI_subscribed_snssai_s { + struct OpenAPI_snssai_s *subscribed_snssai; + int default_indication; +} OpenAPI_subscribed_snssai_t; + +OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_create( + OpenAPI_snssai_t *subscribed_snssai, + int default_indication + ); +void OpenAPI_subscribed_snssai_free(OpenAPI_subscribed_snssai_t *subscribed_snssai); +OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_parseFromJSON(cJSON *subscribed_snssaiJSON); +cJSON *OpenAPI_subscribed_snssai_convertToJSON(OpenAPI_subscribed_snssai_t *subscribed_snssai); +OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_copy(OpenAPI_subscribed_snssai_t *dst, OpenAPI_subscribed_snssai_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_subscribed_snssai_H_ */ + diff --git a/lib/sbi/openapi/model/subscription_data.c b/lib/sbi/openapi/model/subscription_data.c index 936671639..fc2122852 100644 --- a/lib/sbi/openapi/model/subscription_data.c +++ b/lib/sbi/openapi/model/subscription_data.c @@ -17,7 +17,10 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( OpenAPI_nf_type_e req_nf_type, char *req_nf_fqdn, OpenAPI_list_t *req_snssais, - OpenAPI_list_t *req_plmn_list + OpenAPI_list_t *req_per_plmn_snssais, + OpenAPI_list_t *req_plmn_list, + OpenAPI_list_t *req_snpn_list, + OpenAPI_list_t *serving_scope ) { OpenAPI_subscription_data_t *subscription_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_subscription_data_t)); @@ -36,7 +39,10 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( subscription_data_local_var->req_nf_type = req_nf_type; subscription_data_local_var->req_nf_fqdn = req_nf_fqdn; subscription_data_local_var->req_snssais = req_snssais; + subscription_data_local_var->req_per_plmn_snssais = req_per_plmn_snssais; subscription_data_local_var->req_plmn_list = req_plmn_list; + subscription_data_local_var->req_snpn_list = req_snpn_list; + subscription_data_local_var->serving_scope = serving_scope; return subscription_data_local_var; } @@ -61,10 +67,22 @@ void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_da OpenAPI_snssai_free(node->data); } OpenAPI_list_free(subscription_data->req_snssais); + OpenAPI_list_for_each(subscription_data->req_per_plmn_snssais, node) { + OpenAPI_plmn_snssai_free(node->data); + } + OpenAPI_list_free(subscription_data->req_per_plmn_snssais); OpenAPI_list_for_each(subscription_data->req_plmn_list, node) { OpenAPI_plmn_id_free(node->data); } OpenAPI_list_free(subscription_data->req_plmn_list); + OpenAPI_list_for_each(subscription_data->req_snpn_list, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(subscription_data->req_snpn_list); + OpenAPI_list_for_each(subscription_data->serving_scope, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscription_data->serving_scope); ogs_free(subscription_data); } @@ -203,6 +221,26 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs } } + if (subscription_data->req_per_plmn_snssais) { + cJSON *req_per_plmn_snssaisList = cJSON_AddArrayToObject(item, "reqPerPlmnSnssais"); + if (req_per_plmn_snssaisList == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_per_plmn_snssais]"); + goto end; + } + + OpenAPI_lnode_t *req_per_plmn_snssais_node; + if (subscription_data->req_per_plmn_snssais) { + OpenAPI_list_for_each(subscription_data->req_per_plmn_snssais, req_per_plmn_snssais_node) { + cJSON *itemLocal = OpenAPI_plmn_snssai_convertToJSON(req_per_plmn_snssais_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_per_plmn_snssais]"); + goto end; + } + cJSON_AddItemToArray(req_per_plmn_snssaisList, itemLocal); + } + } + } + if (subscription_data->req_plmn_list) { cJSON *req_plmn_listList = cJSON_AddArrayToObject(item, "reqPlmnList"); if (req_plmn_listList == NULL) { @@ -223,6 +261,42 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs } } + if (subscription_data->req_snpn_list) { + cJSON *req_snpn_listList = cJSON_AddArrayToObject(item, "reqSnpnList"); + if (req_snpn_listList == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snpn_list]"); + goto end; + } + + OpenAPI_lnode_t *req_snpn_list_node; + if (subscription_data->req_snpn_list) { + OpenAPI_list_for_each(subscription_data->req_snpn_list, req_snpn_list_node) { + cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(req_snpn_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snpn_list]"); + goto end; + } + cJSON_AddItemToArray(req_snpn_listList, itemLocal); + } + } + } + + if (subscription_data->serving_scope) { + cJSON *serving_scope = cJSON_AddArrayToObject(item, "servingScope"); + if (serving_scope == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [serving_scope]"); + goto end; + } + + OpenAPI_lnode_t *serving_scope_node; + OpenAPI_list_for_each(subscription_data->serving_scope, serving_scope_node) { + if (cJSON_AddStringToObject(serving_scope, "", (char*)serving_scope_node->data) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [serving_scope]"); + goto end; + } + } + } + end: return item; } @@ -364,6 +438,29 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs } } + cJSON *req_per_plmn_snssais = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqPerPlmnSnssais"); + + OpenAPI_list_t *req_per_plmn_snssaisList; + if (req_per_plmn_snssais) { + cJSON *req_per_plmn_snssais_local_nonprimitive; + if (!cJSON_IsArray(req_per_plmn_snssais)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_per_plmn_snssais]"); + goto end; + } + + req_per_plmn_snssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(req_per_plmn_snssais_local_nonprimitive, req_per_plmn_snssais ) { + if (!cJSON_IsObject(req_per_plmn_snssais_local_nonprimitive)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_per_plmn_snssais]"); + goto end; + } + OpenAPI_plmn_snssai_t *req_per_plmn_snssaisItem = OpenAPI_plmn_snssai_parseFromJSON(req_per_plmn_snssais_local_nonprimitive); + + OpenAPI_list_add(req_per_plmn_snssaisList, req_per_plmn_snssaisItem); + } + } + cJSON *req_plmn_list = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqPlmnList"); OpenAPI_list_t *req_plmn_listList; @@ -387,6 +484,49 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs } } + cJSON *req_snpn_list = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqSnpnList"); + + OpenAPI_list_t *req_snpn_listList; + if (req_snpn_list) { + cJSON *req_snpn_list_local_nonprimitive; + if (!cJSON_IsArray(req_snpn_list)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snpn_list]"); + goto end; + } + + req_snpn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(req_snpn_list_local_nonprimitive, req_snpn_list ) { + if (!cJSON_IsObject(req_snpn_list_local_nonprimitive)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snpn_list]"); + goto end; + } + OpenAPI_plmn_id_nid_t *req_snpn_listItem = OpenAPI_plmn_id_nid_parseFromJSON(req_snpn_list_local_nonprimitive); + + OpenAPI_list_add(req_snpn_listList, req_snpn_listItem); + } + } + + cJSON *serving_scope = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "servingScope"); + + OpenAPI_list_t *serving_scopeList; + if (serving_scope) { + cJSON *serving_scope_local; + if (!cJSON_IsArray(serving_scope)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [serving_scope]"); + goto end; + } + serving_scopeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_scope_local, serving_scope) { + if (!cJSON_IsString(serving_scope_local)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [serving_scope]"); + goto end; + } + OpenAPI_list_add(serving_scopeList, ogs_strdup(serving_scope_local->valuestring)); + } + } + subscription_data_local_var = OpenAPI_subscription_data_create ( ogs_strdup(nf_status_notification_uri->valuestring), req_nf_instance_id ? ogs_strdup(req_nf_instance_id->valuestring) : NULL, @@ -400,7 +540,10 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs req_nf_type ? req_nf_typeVariable : 0, req_nf_fqdn ? ogs_strdup(req_nf_fqdn->valuestring) : NULL, req_snssais ? req_snssaisList : NULL, - req_plmn_list ? req_plmn_listList : NULL + req_per_plmn_snssais ? req_per_plmn_snssaisList : NULL, + req_plmn_list ? req_plmn_listList : NULL, + req_snpn_list ? req_snpn_listList : NULL, + serving_scope ? serving_scopeList : NULL ); return subscription_data_local_var; diff --git a/lib/sbi/openapi/model/subscription_data.h b/lib/sbi/openapi/model/subscription_data.h index f70a4cdb5..1f721ea61 100644 --- a/lib/sbi/openapi/model/subscription_data.h +++ b/lib/sbi/openapi/model/subscription_data.h @@ -16,6 +16,8 @@ #include "notif_condition.h" #include "notification_event_type.h" #include "plmn_id.h" +#include "plmn_id_nid.h" +#include "plmn_snssai.h" #include "snssai.h" #include "subscription_data_subscr_cond.h" @@ -37,7 +39,10 @@ typedef struct OpenAPI_subscription_data_s { OpenAPI_nf_type_e req_nf_type; char *req_nf_fqdn; OpenAPI_list_t *req_snssais; + OpenAPI_list_t *req_per_plmn_snssais; OpenAPI_list_t *req_plmn_list; + OpenAPI_list_t *req_snpn_list; + OpenAPI_list_t *serving_scope; } OpenAPI_subscription_data_t; OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( @@ -53,7 +58,10 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( OpenAPI_nf_type_e req_nf_type, char *req_nf_fqdn, OpenAPI_list_t *req_snssais, - OpenAPI_list_t *req_plmn_list + OpenAPI_list_t *req_per_plmn_snssais, + OpenAPI_list_t *req_plmn_list, + OpenAPI_list_t *req_snpn_list, + OpenAPI_list_t *serving_scope ); void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_data); OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subscription_dataJSON); diff --git a/lib/sbi/openapi/model/subscription_data_sets.c b/lib/sbi/openapi/model/subscription_data_sets.c index d794b49b6..7adb6b08a 100644 --- a/lib/sbi/openapi/model/subscription_data_sets.c +++ b/lib/sbi/openapi/model/subscription_data_sets.c @@ -7,6 +7,7 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( OpenAPI_access_and_mobility_subscription_data_t *am_data, OpenAPI_smf_selection_subscription_data_t *smf_sel_data, + OpenAPI_ue_context_in_amf_data_t *uec_amf_data, OpenAPI_ue_context_in_smf_data_t *uec_smf_data, OpenAPI_ue_context_in_smsf_data_t *uec_smsf_data, OpenAPI_sms_subscription_data_t *sms_subs_data, @@ -14,7 +15,9 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, - OpenAPI_lcs_mo_data_t *lcs_mo_data + OpenAPI_lcs_mo_data_t *lcs_mo_data, + OpenAPI_v2x_subscription_data_t *v2x_data, + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data ) { OpenAPI_subscription_data_sets_t *subscription_data_sets_local_var = OpenAPI_malloc(sizeof(OpenAPI_subscription_data_sets_t)); @@ -23,6 +26,7 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( } subscription_data_sets_local_var->am_data = am_data; subscription_data_sets_local_var->smf_sel_data = smf_sel_data; + subscription_data_sets_local_var->uec_amf_data = uec_amf_data; subscription_data_sets_local_var->uec_smf_data = uec_smf_data; subscription_data_sets_local_var->uec_smsf_data = uec_smsf_data; subscription_data_sets_local_var->sms_subs_data = sms_subs_data; @@ -31,6 +35,8 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( subscription_data_sets_local_var->sms_mng_data = sms_mng_data; subscription_data_sets_local_var->lcs_privacy_data = lcs_privacy_data; subscription_data_sets_local_var->lcs_mo_data = lcs_mo_data; + subscription_data_sets_local_var->v2x_data = v2x_data; + subscription_data_sets_local_var->lcs_broadcast_assistance_types_data = lcs_broadcast_assistance_types_data; return subscription_data_sets_local_var; } @@ -43,6 +49,7 @@ void OpenAPI_subscription_data_sets_free(OpenAPI_subscription_data_sets_t *subsc OpenAPI_lnode_t *node; OpenAPI_access_and_mobility_subscription_data_free(subscription_data_sets->am_data); OpenAPI_smf_selection_subscription_data_free(subscription_data_sets->smf_sel_data); + OpenAPI_ue_context_in_amf_data_free(subscription_data_sets->uec_amf_data); OpenAPI_ue_context_in_smf_data_free(subscription_data_sets->uec_smf_data); OpenAPI_ue_context_in_smsf_data_free(subscription_data_sets->uec_smsf_data); OpenAPI_sms_subscription_data_free(subscription_data_sets->sms_subs_data); @@ -54,6 +61,8 @@ void OpenAPI_subscription_data_sets_free(OpenAPI_subscription_data_sets_t *subsc OpenAPI_sms_management_subscription_data_free(subscription_data_sets->sms_mng_data); OpenAPI_lcs_privacy_data_free(subscription_data_sets->lcs_privacy_data); OpenAPI_lcs_mo_data_free(subscription_data_sets->lcs_mo_data); + OpenAPI_v2x_subscription_data_free(subscription_data_sets->v2x_data); + OpenAPI_lcs_broadcast_assistance_types_data_free(subscription_data_sets->lcs_broadcast_assistance_types_data); ogs_free(subscription_data_sets); } @@ -93,6 +102,19 @@ cJSON *OpenAPI_subscription_data_sets_convertToJSON(OpenAPI_subscription_data_se } } + if (subscription_data_sets->uec_amf_data) { + cJSON *uec_amf_data_local_JSON = OpenAPI_ue_context_in_amf_data_convertToJSON(subscription_data_sets->uec_amf_data); + if (uec_amf_data_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [uec_amf_data]"); + goto end; + } + cJSON_AddItemToObject(item, "uecAmfData", uec_amf_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [uec_amf_data]"); + goto end; + } + } + if (subscription_data_sets->uec_smf_data) { cJSON *uec_smf_data_local_JSON = OpenAPI_ue_context_in_smf_data_convertToJSON(subscription_data_sets->uec_smf_data); if (uec_smf_data_local_JSON == NULL) { @@ -204,6 +226,32 @@ cJSON *OpenAPI_subscription_data_sets_convertToJSON(OpenAPI_subscription_data_se } } + if (subscription_data_sets->v2x_data) { + cJSON *v2x_data_local_JSON = OpenAPI_v2x_subscription_data_convertToJSON(subscription_data_sets->v2x_data); + if (v2x_data_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [v2x_data]"); + goto end; + } + cJSON_AddItemToObject(item, "v2xData", v2x_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [v2x_data]"); + goto end; + } + } + + if (subscription_data_sets->lcs_broadcast_assistance_types_data) { + cJSON *lcs_broadcast_assistance_types_data_local_JSON = OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(subscription_data_sets->lcs_broadcast_assistance_types_data); + if (lcs_broadcast_assistance_types_data_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [lcs_broadcast_assistance_types_data]"); + goto end; + } + cJSON_AddItemToObject(item, "lcsBroadcastAssistanceTypesData", lcs_broadcast_assistance_types_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [lcs_broadcast_assistance_types_data]"); + goto end; + } + } + end: return item; } @@ -225,6 +273,13 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c smf_sel_data_local_nonprim = OpenAPI_smf_selection_subscription_data_parseFromJSON(smf_sel_data); } + cJSON *uec_amf_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "uecAmfData"); + + OpenAPI_ue_context_in_amf_data_t *uec_amf_data_local_nonprim = NULL; + if (uec_amf_data) { + uec_amf_data_local_nonprim = OpenAPI_ue_context_in_amf_data_parseFromJSON(uec_amf_data); + } + cJSON *uec_smf_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "uecSmfData"); OpenAPI_ue_context_in_smf_data_t *uec_smf_data_local_nonprim = NULL; @@ -297,9 +352,24 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c lcs_mo_data_local_nonprim = OpenAPI_lcs_mo_data_parseFromJSON(lcs_mo_data); } + cJSON *v2x_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "v2xData"); + + OpenAPI_v2x_subscription_data_t *v2x_data_local_nonprim = NULL; + if (v2x_data) { + v2x_data_local_nonprim = OpenAPI_v2x_subscription_data_parseFromJSON(v2x_data); + } + + cJSON *lcs_broadcast_assistance_types_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "lcsBroadcastAssistanceTypesData"); + + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data_local_nonprim = NULL; + if (lcs_broadcast_assistance_types_data) { + lcs_broadcast_assistance_types_data_local_nonprim = OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(lcs_broadcast_assistance_types_data); + } + subscription_data_sets_local_var = OpenAPI_subscription_data_sets_create ( am_data ? am_data_local_nonprim : NULL, smf_sel_data ? smf_sel_data_local_nonprim : NULL, + uec_amf_data ? uec_amf_data_local_nonprim : NULL, uec_smf_data ? uec_smf_data_local_nonprim : NULL, uec_smsf_data ? uec_smsf_data_local_nonprim : NULL, sms_subs_data ? sms_subs_data_local_nonprim : NULL, @@ -307,7 +377,9 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c trace_data ? trace_data_local_nonprim : NULL, sms_mng_data ? sms_mng_data_local_nonprim : NULL, lcs_privacy_data ? lcs_privacy_data_local_nonprim : NULL, - lcs_mo_data ? lcs_mo_data_local_nonprim : NULL + lcs_mo_data ? lcs_mo_data_local_nonprim : NULL, + v2x_data ? v2x_data_local_nonprim : NULL, + lcs_broadcast_assistance_types_data ? lcs_broadcast_assistance_types_data_local_nonprim : NULL ); return subscription_data_sets_local_var; diff --git a/lib/sbi/openapi/model/subscription_data_sets.h b/lib/sbi/openapi/model/subscription_data_sets.h index 82df1d1d9..687900b0b 100644 --- a/lib/sbi/openapi/model/subscription_data_sets.h +++ b/lib/sbi/openapi/model/subscription_data_sets.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "access_and_mobility_subscription_data.h" +#include "lcs_broadcast_assistance_types_data.h" #include "lcs_mo_data.h" #include "lcs_privacy_data.h" #include "session_management_subscription_data.h" @@ -20,8 +21,10 @@ #include "sms_management_subscription_data.h" #include "sms_subscription_data.h" #include "trace_data.h" +#include "ue_context_in_amf_data.h" #include "ue_context_in_smf_data.h" #include "ue_context_in_smsf_data.h" +#include "v2x_subscription_data.h" #ifdef __cplusplus extern "C" { @@ -31,6 +34,7 @@ typedef struct OpenAPI_subscription_data_sets_s OpenAPI_subscription_data_sets_t typedef struct OpenAPI_subscription_data_sets_s { struct OpenAPI_access_and_mobility_subscription_data_s *am_data; struct OpenAPI_smf_selection_subscription_data_s *smf_sel_data; + struct OpenAPI_ue_context_in_amf_data_s *uec_amf_data; struct OpenAPI_ue_context_in_smf_data_s *uec_smf_data; struct OpenAPI_ue_context_in_smsf_data_s *uec_smsf_data; struct OpenAPI_sms_subscription_data_s *sms_subs_data; @@ -39,11 +43,14 @@ typedef struct OpenAPI_subscription_data_sets_s { struct OpenAPI_sms_management_subscription_data_s *sms_mng_data; struct OpenAPI_lcs_privacy_data_s *lcs_privacy_data; struct OpenAPI_lcs_mo_data_s *lcs_mo_data; + struct OpenAPI_v2x_subscription_data_s *v2x_data; + struct OpenAPI_lcs_broadcast_assistance_types_data_s *lcs_broadcast_assistance_types_data; } OpenAPI_subscription_data_sets_t; OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( OpenAPI_access_and_mobility_subscription_data_t *am_data, OpenAPI_smf_selection_subscription_data_t *smf_sel_data, + OpenAPI_ue_context_in_amf_data_t *uec_amf_data, OpenAPI_ue_context_in_smf_data_t *uec_smf_data, OpenAPI_ue_context_in_smsf_data_t *uec_smsf_data, OpenAPI_sms_subscription_data_t *sms_subs_data, @@ -51,7 +58,9 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, - OpenAPI_lcs_mo_data_t *lcs_mo_data + OpenAPI_lcs_mo_data_t *lcs_mo_data, + OpenAPI_v2x_subscription_data_t *v2x_data, + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data ); void OpenAPI_subscription_data_sets_free(OpenAPI_subscription_data_sets_t *subscription_data_sets); OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(cJSON *subscription_data_setsJSON); diff --git a/lib/sbi/openapi/model/tac_info.c b/lib/sbi/openapi/model/tac_info.c new file mode 100644 index 000000000..41c344e03 --- /dev/null +++ b/lib/sbi/openapi/model/tac_info.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "tac_info.h" + +OpenAPI_tac_info_t *OpenAPI_tac_info_create( + OpenAPI_list_t *tac_list + ) +{ + OpenAPI_tac_info_t *tac_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_tac_info_t)); + if (!tac_info_local_var) { + return NULL; + } + tac_info_local_var->tac_list = tac_list; + + return tac_info_local_var; +} + +void OpenAPI_tac_info_free(OpenAPI_tac_info_t *tac_info) +{ + if (NULL == tac_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(tac_info->tac_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(tac_info->tac_list); + ogs_free(tac_info); +} + +cJSON *OpenAPI_tac_info_convertToJSON(OpenAPI_tac_info_t *tac_info) +{ + cJSON *item = NULL; + + if (tac_info == NULL) { + ogs_error("OpenAPI_tac_info_convertToJSON() failed [TacInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!tac_info->tac_list) { + ogs_error("OpenAPI_tac_info_convertToJSON() failed [tac_list]"); + goto end; + } + cJSON *tac_list = cJSON_AddArrayToObject(item, "tacList"); + if (tac_list == NULL) { + ogs_error("OpenAPI_tac_info_convertToJSON() failed [tac_list]"); + goto end; + } + + OpenAPI_lnode_t *tac_list_node; + OpenAPI_list_for_each(tac_info->tac_list, tac_list_node) { + if (cJSON_AddStringToObject(tac_list, "", (char*)tac_list_node->data) == NULL) { + ogs_error("OpenAPI_tac_info_convertToJSON() failed [tac_list]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_tac_info_t *OpenAPI_tac_info_parseFromJSON(cJSON *tac_infoJSON) +{ + OpenAPI_tac_info_t *tac_info_local_var = NULL; + cJSON *tac_list = cJSON_GetObjectItemCaseSensitive(tac_infoJSON, "tacList"); + if (!tac_list) { + ogs_error("OpenAPI_tac_info_parseFromJSON() failed [tac_list]"); + goto end; + } + + OpenAPI_list_t *tac_listList; + + cJSON *tac_list_local; + if (!cJSON_IsArray(tac_list)) { + ogs_error("OpenAPI_tac_info_parseFromJSON() failed [tac_list]"); + goto end; + } + tac_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tac_list_local, tac_list) { + if (!cJSON_IsString(tac_list_local)) { + ogs_error("OpenAPI_tac_info_parseFromJSON() failed [tac_list]"); + goto end; + } + OpenAPI_list_add(tac_listList, ogs_strdup(tac_list_local->valuestring)); + } + + tac_info_local_var = OpenAPI_tac_info_create ( + tac_listList + ); + + return tac_info_local_var; +end: + return NULL; +} + +OpenAPI_tac_info_t *OpenAPI_tac_info_copy(OpenAPI_tac_info_t *dst, OpenAPI_tac_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tac_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tac_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_tac_info_free(dst); + dst = OpenAPI_tac_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tac_info.h b/lib/sbi/openapi/model/tac_info.h new file mode 100644 index 000000000..c8ca87aa1 --- /dev/null +++ b/lib/sbi/openapi/model/tac_info.h @@ -0,0 +1,38 @@ +/* + * tac_info.h + * + * + */ + +#ifndef _OpenAPI_tac_info_H_ +#define _OpenAPI_tac_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tac_info_s OpenAPI_tac_info_t; +typedef struct OpenAPI_tac_info_s { + OpenAPI_list_t *tac_list; +} OpenAPI_tac_info_t; + +OpenAPI_tac_info_t *OpenAPI_tac_info_create( + OpenAPI_list_t *tac_list + ); +void OpenAPI_tac_info_free(OpenAPI_tac_info_t *tac_info); +OpenAPI_tac_info_t *OpenAPI_tac_info_parseFromJSON(cJSON *tac_infoJSON); +cJSON *OpenAPI_tac_info_convertToJSON(OpenAPI_tac_info_t *tac_info); +OpenAPI_tac_info_t *OpenAPI_tac_info_copy(OpenAPI_tac_info_t *dst, OpenAPI_tac_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tac_info_H_ */ + diff --git a/lib/sbi/openapi/model/tmbr.c b/lib/sbi/openapi/model/tmbr.c deleted file mode 100644 index d17414060..000000000 --- a/lib/sbi/openapi/model/tmbr.c +++ /dev/null @@ -1,135 +0,0 @@ - -#include -#include -#include -#include "tmbr.h" - -OpenAPI_tmbr_t *OpenAPI_tmbr_create( - char *uplink, - char *downlink - ) -{ - OpenAPI_tmbr_t *tmbr_local_var = OpenAPI_malloc(sizeof(OpenAPI_tmbr_t)); - if (!tmbr_local_var) { - return NULL; - } - tmbr_local_var->uplink = uplink; - tmbr_local_var->downlink = downlink; - - return tmbr_local_var; -} - -void OpenAPI_tmbr_free(OpenAPI_tmbr_t *tmbr) -{ - if (NULL == tmbr) { - return; - } - OpenAPI_lnode_t *node; - ogs_free(tmbr->uplink); - ogs_free(tmbr->downlink); - ogs_free(tmbr); -} - -cJSON *OpenAPI_tmbr_convertToJSON(OpenAPI_tmbr_t *tmbr) -{ - cJSON *item = NULL; - - if (tmbr == NULL) { - ogs_error("OpenAPI_tmbr_convertToJSON() failed [Tmbr]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!tmbr->uplink) { - ogs_error("OpenAPI_tmbr_convertToJSON() failed [uplink]"); - goto end; - } - if (cJSON_AddStringToObject(item, "uplink", tmbr->uplink) == NULL) { - ogs_error("OpenAPI_tmbr_convertToJSON() failed [uplink]"); - goto end; - } - - if (!tmbr->downlink) { - ogs_error("OpenAPI_tmbr_convertToJSON() failed [downlink]"); - goto end; - } - if (cJSON_AddStringToObject(item, "downlink", tmbr->downlink) == NULL) { - ogs_error("OpenAPI_tmbr_convertToJSON() failed [downlink]"); - goto end; - } - -end: - return item; -} - -OpenAPI_tmbr_t *OpenAPI_tmbr_parseFromJSON(cJSON *tmbrJSON) -{ - OpenAPI_tmbr_t *tmbr_local_var = NULL; - cJSON *uplink = cJSON_GetObjectItemCaseSensitive(tmbrJSON, "uplink"); - if (!uplink) { - ogs_error("OpenAPI_tmbr_parseFromJSON() failed [uplink]"); - goto end; - } - - - if (!cJSON_IsString(uplink)) { - ogs_error("OpenAPI_tmbr_parseFromJSON() failed [uplink]"); - goto end; - } - - cJSON *downlink = cJSON_GetObjectItemCaseSensitive(tmbrJSON, "downlink"); - if (!downlink) { - ogs_error("OpenAPI_tmbr_parseFromJSON() failed [downlink]"); - goto end; - } - - - if (!cJSON_IsString(downlink)) { - ogs_error("OpenAPI_tmbr_parseFromJSON() failed [downlink]"); - goto end; - } - - tmbr_local_var = OpenAPI_tmbr_create ( - ogs_strdup(uplink->valuestring), - ogs_strdup(downlink->valuestring) - ); - - return tmbr_local_var; -end: - return NULL; -} - -OpenAPI_tmbr_t *OpenAPI_tmbr_copy(OpenAPI_tmbr_t *dst, OpenAPI_tmbr_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_tmbr_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_tmbr_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_tmbr_free(dst); - dst = OpenAPI_tmbr_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/tmbr.h b/lib/sbi/openapi/model/tmbr.h deleted file mode 100644 index 65bc1b901..000000000 --- a/lib/sbi/openapi/model/tmbr.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * tmbr.h - * - * - */ - -#ifndef _OpenAPI_tmbr_H_ -#define _OpenAPI_tmbr_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_tmbr_s OpenAPI_tmbr_t; -typedef struct OpenAPI_tmbr_s { - char *uplink; - char *downlink; -} OpenAPI_tmbr_t; - -OpenAPI_tmbr_t *OpenAPI_tmbr_create( - char *uplink, - char *downlink - ); -void OpenAPI_tmbr_free(OpenAPI_tmbr_t *tmbr); -OpenAPI_tmbr_t *OpenAPI_tmbr_parseFromJSON(cJSON *tmbrJSON); -cJSON *OpenAPI_tmbr_convertToJSON(OpenAPI_tmbr_t *tmbr); -OpenAPI_tmbr_t *OpenAPI_tmbr_copy(OpenAPI_tmbr_t *dst, OpenAPI_tmbr_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_tmbr_H_ */ - diff --git a/lib/sbi/openapi/model/tnap_id.c b/lib/sbi/openapi/model/tnap_id.c new file mode 100644 index 000000000..0a7a75921 --- /dev/null +++ b/lib/sbi/openapi/model/tnap_id.c @@ -0,0 +1,144 @@ + +#include +#include +#include +#include "tnap_id.h" + +OpenAPI_tnap_id_t *OpenAPI_tnap_id_create( + char *ss_id, + char *bss_id, + char civic_address + ) +{ + OpenAPI_tnap_id_t *tnap_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_tnap_id_t)); + if (!tnap_id_local_var) { + return NULL; + } + tnap_id_local_var->ss_id = ss_id; + tnap_id_local_var->bss_id = bss_id; + tnap_id_local_var->civic_address = civic_address; + + return tnap_id_local_var; +} + +void OpenAPI_tnap_id_free(OpenAPI_tnap_id_t *tnap_id) +{ + if (NULL == tnap_id) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(tnap_id->ss_id); + ogs_free(tnap_id->bss_id); + ogs_free(tnap_id); +} + +cJSON *OpenAPI_tnap_id_convertToJSON(OpenAPI_tnap_id_t *tnap_id) +{ + cJSON *item = NULL; + + if (tnap_id == NULL) { + ogs_error("OpenAPI_tnap_id_convertToJSON() failed [TnapId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (tnap_id->ss_id) { + if (cJSON_AddStringToObject(item, "ssId", tnap_id->ss_id) == NULL) { + ogs_error("OpenAPI_tnap_id_convertToJSON() failed [ss_id]"); + goto end; + } + } + + if (tnap_id->bss_id) { + if (cJSON_AddStringToObject(item, "bssId", tnap_id->bss_id) == NULL) { + ogs_error("OpenAPI_tnap_id_convertToJSON() failed [bss_id]"); + goto end; + } + } + + if (tnap_id->civic_address) { + if (cJSON_AddNumberToObject(item, "civicAddress", tnap_id->civic_address) == NULL) { + ogs_error("OpenAPI_tnap_id_convertToJSON() failed [civic_address]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_tnap_id_t *OpenAPI_tnap_id_parseFromJSON(cJSON *tnap_idJSON) +{ + OpenAPI_tnap_id_t *tnap_id_local_var = NULL; + cJSON *ss_id = cJSON_GetObjectItemCaseSensitive(tnap_idJSON, "ssId"); + + if (ss_id) { + if (!cJSON_IsString(ss_id)) { + ogs_error("OpenAPI_tnap_id_parseFromJSON() failed [ss_id]"); + goto end; + } + } + + cJSON *bss_id = cJSON_GetObjectItemCaseSensitive(tnap_idJSON, "bssId"); + + if (bss_id) { + if (!cJSON_IsString(bss_id)) { + ogs_error("OpenAPI_tnap_id_parseFromJSON() failed [bss_id]"); + goto end; + } + } + + cJSON *civic_address = cJSON_GetObjectItemCaseSensitive(tnap_idJSON, "civicAddress"); + + if (civic_address) { + if (!cJSON_IsNumber(civic_address)) { + ogs_error("OpenAPI_tnap_id_parseFromJSON() failed [civic_address]"); + goto end; + } + } + + tnap_id_local_var = OpenAPI_tnap_id_create ( + ss_id ? ogs_strdup(ss_id->valuestring) : NULL, + bss_id ? ogs_strdup(bss_id->valuestring) : NULL, + civic_address ? civic_address->valueint : 0 + ); + + return tnap_id_local_var; +end: + return NULL; +} + +OpenAPI_tnap_id_t *OpenAPI_tnap_id_copy(OpenAPI_tnap_id_t *dst, OpenAPI_tnap_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tnap_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tnap_id_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_tnap_id_free(dst); + dst = OpenAPI_tnap_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tnap_id.h b/lib/sbi/openapi/model/tnap_id.h new file mode 100644 index 000000000..a38cc9047 --- /dev/null +++ b/lib/sbi/openapi/model/tnap_id.h @@ -0,0 +1,42 @@ +/* + * tnap_id.h + * + * + */ + +#ifndef _OpenAPI_tnap_id_H_ +#define _OpenAPI_tnap_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tnap_id_s OpenAPI_tnap_id_t; +typedef struct OpenAPI_tnap_id_s { + char *ss_id; + char *bss_id; + char civic_address; +} OpenAPI_tnap_id_t; + +OpenAPI_tnap_id_t *OpenAPI_tnap_id_create( + char *ss_id, + char *bss_id, + char civic_address + ); +void OpenAPI_tnap_id_free(OpenAPI_tnap_id_t *tnap_id); +OpenAPI_tnap_id_t *OpenAPI_tnap_id_parseFromJSON(cJSON *tnap_idJSON); +cJSON *OpenAPI_tnap_id_convertToJSON(OpenAPI_tnap_id_t *tnap_id); +OpenAPI_tnap_id_t *OpenAPI_tnap_id_copy(OpenAPI_tnap_id_t *dst, OpenAPI_tnap_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tnap_id_H_ */ + diff --git a/lib/sbi/openapi/model/trace_data.c b/lib/sbi/openapi/model/trace_data.c index bce0f908c..c757b1e5c 100644 --- a/lib/sbi/openapi/model/trace_data.c +++ b/lib/sbi/openapi/model/trace_data.c @@ -6,7 +6,7 @@ OpenAPI_trace_data_t *OpenAPI_trace_data_create( char *trace_ref, - OpenAPI_trace_depth_t *trace_depth, + OpenAPI_trace_depth_e trace_depth, char *ne_type_list, char *event_list, char *collection_entity_ipv4_addr, @@ -36,7 +36,6 @@ void OpenAPI_trace_data_free(OpenAPI_trace_data_t *trace_data) } OpenAPI_lnode_t *node; ogs_free(trace_data->trace_ref); - OpenAPI_trace_depth_free(trace_data->trace_depth); ogs_free(trace_data->ne_type_list); ogs_free(trace_data->event_list); ogs_free(trace_data->collection_entity_ipv4_addr); @@ -68,13 +67,7 @@ cJSON *OpenAPI_trace_data_convertToJSON(OpenAPI_trace_data_t *trace_data) ogs_error("OpenAPI_trace_data_convertToJSON() failed [trace_depth]"); goto end; } - cJSON *trace_depth_local_JSON = OpenAPI_trace_depth_convertToJSON(trace_data->trace_depth); - if (trace_depth_local_JSON == NULL) { - ogs_error("OpenAPI_trace_data_convertToJSON() failed [trace_depth]"); - goto end; - } - cJSON_AddItemToObject(item, "traceDepth", trace_depth_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "traceDepth", OpenAPI_trace_depth_ToString(trace_data->trace_depth)) == NULL) { ogs_error("OpenAPI_trace_data_convertToJSON() failed [trace_depth]"); goto end; } @@ -143,9 +136,13 @@ OpenAPI_trace_data_t *OpenAPI_trace_data_parseFromJSON(cJSON *trace_dataJSON) goto end; } - OpenAPI_trace_depth_t *trace_depth_local_nonprim = NULL; + OpenAPI_trace_depth_e trace_depthVariable; - trace_depth_local_nonprim = OpenAPI_trace_depth_parseFromJSON(trace_depth); + if (!cJSON_IsString(trace_depth)) { + ogs_error("OpenAPI_trace_data_parseFromJSON() failed [trace_depth]"); + goto end; + } + trace_depthVariable = OpenAPI_trace_depth_FromString(trace_depth->valuestring); cJSON *ne_type_list = cJSON_GetObjectItemCaseSensitive(trace_dataJSON, "neTypeList"); if (!ne_type_list) { @@ -200,7 +197,7 @@ OpenAPI_trace_data_t *OpenAPI_trace_data_parseFromJSON(cJSON *trace_dataJSON) trace_data_local_var = OpenAPI_trace_data_create ( ogs_strdup(trace_ref->valuestring), - trace_depth_local_nonprim, + trace_depthVariable, ogs_strdup(ne_type_list->valuestring), ogs_strdup(event_list->valuestring), collection_entity_ipv4_addr ? ogs_strdup(collection_entity_ipv4_addr->valuestring) : NULL, diff --git a/lib/sbi/openapi/model/trace_data.h b/lib/sbi/openapi/model/trace_data.h index c9d1c35d0..163b2b0bd 100644 --- a/lib/sbi/openapi/model/trace_data.h +++ b/lib/sbi/openapi/model/trace_data.h @@ -21,7 +21,7 @@ extern "C" { typedef struct OpenAPI_trace_data_s OpenAPI_trace_data_t; typedef struct OpenAPI_trace_data_s { char *trace_ref; - struct OpenAPI_trace_depth_s *trace_depth; + OpenAPI_trace_depth_e trace_depth; char *ne_type_list; char *event_list; char *collection_entity_ipv4_addr; @@ -31,7 +31,7 @@ typedef struct OpenAPI_trace_data_s { OpenAPI_trace_data_t *OpenAPI_trace_data_create( char *trace_ref, - OpenAPI_trace_depth_t *trace_depth, + OpenAPI_trace_depth_e trace_depth, char *ne_type_list, char *event_list, char *collection_entity_ipv4_addr, diff --git a/lib/sbi/openapi/model/trace_depth.c b/lib/sbi/openapi/model/trace_depth.c index e0d78de12..7eb0d39d0 100644 --- a/lib/sbi/openapi/model/trace_depth.c +++ b/lib/sbi/openapi/model/trace_depth.c @@ -4,82 +4,27 @@ #include #include "trace_depth.h" -OpenAPI_trace_depth_t *OpenAPI_trace_depth_create( - ) +char* OpenAPI_trace_depth_ToString(OpenAPI_trace_depth_e trace_depth) { - OpenAPI_trace_depth_t *trace_depth_local_var = OpenAPI_malloc(sizeof(OpenAPI_trace_depth_t)); - if (!trace_depth_local_var) { - return NULL; - } - - return trace_depth_local_var; + const char *trace_depthArray[] = { "NULL", "MINIMUM", "MEDIUM", "MAXIMUM", "MINIMUM_WO_VENDOR_EXTENSION", "MEDIUM_WO_VENDOR_EXTENSION", "MAXIMUM_WO_VENDOR_EXTENSION" }; + size_t sizeofArray = sizeof(trace_depthArray) / sizeof(trace_depthArray[0]); + if (trace_depth < sizeofArray) + return (char *)trace_depthArray[trace_depth]; + else + return (char *)"Unknown"; } -void OpenAPI_trace_depth_free(OpenAPI_trace_depth_t *trace_depth) +OpenAPI_trace_depth_e OpenAPI_trace_depth_FromString(char* trace_depth) { - if (NULL == trace_depth) { - return; + int stringToReturn = 0; + const char *trace_depthArray[] = { "NULL", "MINIMUM", "MEDIUM", "MAXIMUM", "MINIMUM_WO_VENDOR_EXTENSION", "MEDIUM_WO_VENDOR_EXTENSION", "MAXIMUM_WO_VENDOR_EXTENSION" }; + size_t sizeofArray = sizeof(trace_depthArray) / sizeof(trace_depthArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(trace_depth, trace_depthArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(trace_depth); -} - -cJSON *OpenAPI_trace_depth_convertToJSON(OpenAPI_trace_depth_t *trace_depth) -{ - cJSON *item = NULL; - - if (trace_depth == NULL) { - ogs_error("OpenAPI_trace_depth_convertToJSON() failed [TraceDepth]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_trace_depth_t *OpenAPI_trace_depth_parseFromJSON(cJSON *trace_depthJSON) -{ - OpenAPI_trace_depth_t *trace_depth_local_var = NULL; - trace_depth_local_var = OpenAPI_trace_depth_create ( - ); - - return trace_depth_local_var; -end: - return NULL; -} - -OpenAPI_trace_depth_t *OpenAPI_trace_depth_copy(OpenAPI_trace_depth_t *dst, OpenAPI_trace_depth_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_trace_depth_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_trace_depth_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_trace_depth_free(dst); - dst = OpenAPI_trace_depth_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/trace_depth.h b/lib/sbi/openapi/model/trace_depth.h index 23d5c687f..fb6ad40ec 100644 --- a/lib/sbi/openapi/model/trace_depth.h +++ b/lib/sbi/openapi/model/trace_depth.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_trace_depth_s OpenAPI_trace_depth_t; -typedef struct OpenAPI_trace_depth_s { -} OpenAPI_trace_depth_t; +typedef enum { OpenAPI_trace_depth_NULL = 0, OpenAPI_trace_depth_MINIMUM, OpenAPI_trace_depth_MEDIUM, OpenAPI_trace_depth_MAXIMUM, OpenAPI_trace_depth_MINIMUM_WO_VENDOR_EXTENSION, OpenAPI_trace_depth_MEDIUM_WO_VENDOR_EXTENSION, OpenAPI_trace_depth_MAXIMUM_WO_VENDOR_EXTENSION } OpenAPI_trace_depth_e; -OpenAPI_trace_depth_t *OpenAPI_trace_depth_create( - ); -void OpenAPI_trace_depth_free(OpenAPI_trace_depth_t *trace_depth); -OpenAPI_trace_depth_t *OpenAPI_trace_depth_parseFromJSON(cJSON *trace_depthJSON); -cJSON *OpenAPI_trace_depth_convertToJSON(OpenAPI_trace_depth_t *trace_depth); -OpenAPI_trace_depth_t *OpenAPI_trace_depth_copy(OpenAPI_trace_depth_t *dst, OpenAPI_trace_depth_t *src); +char* OpenAPI_trace_depth_ToString(OpenAPI_trace_depth_e trace_depth); + +OpenAPI_trace_depth_e OpenAPI_trace_depth_FromString(char* trace_depth); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/transfer_mo_data_req_data.c b/lib/sbi/openapi/model/transfer_mo_data_req_data.c index ecd814fa9..56d15271f 100644 --- a/lib/sbi/openapi/model/transfer_mo_data_req_data.c +++ b/lib/sbi/openapi/model/transfer_mo_data_req_data.c @@ -6,7 +6,6 @@ OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_create( OpenAPI_ref_to_binary_data_t *mo_data, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, OpenAPI_user_location_t *ue_location ) @@ -16,7 +15,6 @@ OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_create( return NULL; } transfer_mo_data_req_data_local_var->mo_data = mo_data; - transfer_mo_data_req_data_local_var->mo_exp_data_ind = mo_exp_data_ind; transfer_mo_data_req_data_local_var->mo_exp_data_counter = mo_exp_data_counter; transfer_mo_data_req_data_local_var->ue_location = ue_location; @@ -30,7 +28,6 @@ void OpenAPI_transfer_mo_data_req_data_free(OpenAPI_transfer_mo_data_req_data_t } OpenAPI_lnode_t *node; OpenAPI_ref_to_binary_data_free(transfer_mo_data_req_data->mo_data); - OpenAPI_mo_exception_data_flag_free(transfer_mo_data_req_data->mo_exp_data_ind); OpenAPI_mo_exp_data_counter_free(transfer_mo_data_req_data->mo_exp_data_counter); OpenAPI_user_location_free(transfer_mo_data_req_data->ue_location); ogs_free(transfer_mo_data_req_data); @@ -61,19 +58,6 @@ cJSON *OpenAPI_transfer_mo_data_req_data_convertToJSON(OpenAPI_transfer_mo_data_ goto end; } - if (transfer_mo_data_req_data->mo_exp_data_ind) { - cJSON *mo_exp_data_ind_local_JSON = OpenAPI_mo_exception_data_flag_convertToJSON(transfer_mo_data_req_data->mo_exp_data_ind); - if (mo_exp_data_ind_local_JSON == NULL) { - ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - cJSON_AddItemToObject(item, "moExpDataInd", mo_exp_data_ind_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_transfer_mo_data_req_data_convertToJSON() failed [mo_exp_data_ind]"); - goto end; - } - } - if (transfer_mo_data_req_data->mo_exp_data_counter) { cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(transfer_mo_data_req_data->mo_exp_data_counter); if (mo_exp_data_counter_local_JSON == NULL) { @@ -117,13 +101,6 @@ OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_parseFrom mo_data_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(mo_data); - cJSON *mo_exp_data_ind = cJSON_GetObjectItemCaseSensitive(transfer_mo_data_req_dataJSON, "moExpDataInd"); - - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind_local_nonprim = NULL; - if (mo_exp_data_ind) { - mo_exp_data_ind_local_nonprim = OpenAPI_mo_exception_data_flag_parseFromJSON(mo_exp_data_ind); - } - cJSON *mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(transfer_mo_data_req_dataJSON, "moExpDataCounter"); OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; @@ -140,7 +117,6 @@ OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_parseFrom transfer_mo_data_req_data_local_var = OpenAPI_transfer_mo_data_req_data_create ( mo_data_local_nonprim, - mo_exp_data_ind ? mo_exp_data_ind_local_nonprim : NULL, mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, ue_location ? ue_location_local_nonprim : NULL ); diff --git a/lib/sbi/openapi/model/transfer_mo_data_req_data.h b/lib/sbi/openapi/model/transfer_mo_data_req_data.h index 0d9d08053..67de12069 100644 --- a/lib/sbi/openapi/model/transfer_mo_data_req_data.h +++ b/lib/sbi/openapi/model/transfer_mo_data_req_data.h @@ -12,7 +12,6 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "mo_exception_data_flag.h" #include "mo_exp_data_counter.h" #include "ref_to_binary_data.h" #include "user_location.h" @@ -24,14 +23,12 @@ extern "C" { typedef struct OpenAPI_transfer_mo_data_req_data_s OpenAPI_transfer_mo_data_req_data_t; typedef struct OpenAPI_transfer_mo_data_req_data_s { struct OpenAPI_ref_to_binary_data_s *mo_data; - struct OpenAPI_mo_exception_data_flag_s *mo_exp_data_ind; struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; struct OpenAPI_user_location_s *ue_location; } OpenAPI_transfer_mo_data_req_data_t; OpenAPI_transfer_mo_data_req_data_t *OpenAPI_transfer_mo_data_req_data_create( OpenAPI_ref_to_binary_data_t *mo_data, - OpenAPI_mo_exception_data_flag_t *mo_exp_data_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, OpenAPI_user_location_t *ue_location ); diff --git a/lib/sbi/openapi/model/transfer_mt_data_error.c b/lib/sbi/openapi/model/transfer_mt_data_error.c index 79f8f1d32..05f9c3606 100644 --- a/lib/sbi/openapi/model/transfer_mt_data_error.c +++ b/lib/sbi/openapi/model/transfer_mt_data_error.c @@ -13,6 +13,7 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( char *cause, OpenAPI_list_t *invalid_params, char *supported_features, + char *target_scp, int max_waiting_time ) { @@ -28,6 +29,7 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( transfer_mt_data_error_local_var->cause = cause; transfer_mt_data_error_local_var->invalid_params = invalid_params; transfer_mt_data_error_local_var->supported_features = supported_features; + transfer_mt_data_error_local_var->target_scp = target_scp; transfer_mt_data_error_local_var->max_waiting_time = max_waiting_time; return transfer_mt_data_error_local_var; @@ -49,6 +51,7 @@ void OpenAPI_transfer_mt_data_error_free(OpenAPI_transfer_mt_data_error_t *trans } OpenAPI_list_free(transfer_mt_data_error->invalid_params); ogs_free(transfer_mt_data_error->supported_features); + ogs_free(transfer_mt_data_error->target_scp); ogs_free(transfer_mt_data_error); } @@ -131,6 +134,13 @@ cJSON *OpenAPI_transfer_mt_data_error_convertToJSON(OpenAPI_transfer_mt_data_err } } + if (transfer_mt_data_error->target_scp) { + if (cJSON_AddStringToObject(item, "targetScp", transfer_mt_data_error->target_scp) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [target_scp]"); + goto end; + } + } + if (transfer_mt_data_error->max_waiting_time) { if (cJSON_AddNumberToObject(item, "maxWaitingTime", transfer_mt_data_error->max_waiting_time) == NULL) { ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [max_waiting_time]"); @@ -231,6 +241,15 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_parseFromJSON(c } } + cJSON *target_scp = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "targetScp"); + + if (target_scp) { + if (!cJSON_IsString(target_scp)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [target_scp]"); + goto end; + } + } + cJSON *max_waiting_time = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "maxWaitingTime"); if (max_waiting_time) { @@ -249,6 +268,7 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_parseFromJSON(c cause ? ogs_strdup(cause->valuestring) : NULL, invalid_params ? invalid_paramsList : NULL, supported_features ? ogs_strdup(supported_features->valuestring) : NULL, + target_scp ? ogs_strdup(target_scp->valuestring) : NULL, max_waiting_time ? max_waiting_time->valuedouble : 0 ); diff --git a/lib/sbi/openapi/model/transfer_mt_data_error.h b/lib/sbi/openapi/model/transfer_mt_data_error.h index 251f24174..ad7ff320d 100644 --- a/lib/sbi/openapi/model/transfer_mt_data_error.h +++ b/lib/sbi/openapi/model/transfer_mt_data_error.h @@ -30,6 +30,7 @@ typedef struct OpenAPI_transfer_mt_data_error_s { char *cause; OpenAPI_list_t *invalid_params; char *supported_features; + char *target_scp; int max_waiting_time; } OpenAPI_transfer_mt_data_error_t; @@ -42,6 +43,7 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( char *cause, OpenAPI_list_t *invalid_params, char *supported_features, + char *target_scp, int max_waiting_time ); void OpenAPI_transfer_mt_data_error_free(OpenAPI_transfer_mt_data_error_t *transfer_mt_data_error); diff --git a/lib/sbi/openapi/model/transport_protocol.c b/lib/sbi/openapi/model/transport_protocol.c index bd61f83fe..89ac22f10 100644 --- a/lib/sbi/openapi/model/transport_protocol.c +++ b/lib/sbi/openapi/model/transport_protocol.c @@ -4,82 +4,27 @@ #include #include "transport_protocol.h" -OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_create( - ) +char* OpenAPI_transport_protocol_ToString(OpenAPI_transport_protocol_e transport_protocol) { - OpenAPI_transport_protocol_t *transport_protocol_local_var = OpenAPI_malloc(sizeof(OpenAPI_transport_protocol_t)); - if (!transport_protocol_local_var) { - return NULL; - } - - return transport_protocol_local_var; + const char *transport_protocolArray[] = { "NULL", "TCP" }; + size_t sizeofArray = sizeof(transport_protocolArray) / sizeof(transport_protocolArray[0]); + if (transport_protocol < sizeofArray) + return (char *)transport_protocolArray[transport_protocol]; + else + return (char *)"Unknown"; } -void OpenAPI_transport_protocol_free(OpenAPI_transport_protocol_t *transport_protocol) +OpenAPI_transport_protocol_e OpenAPI_transport_protocol_FromString(char* transport_protocol) { - if (NULL == transport_protocol) { - return; + int stringToReturn = 0; + const char *transport_protocolArray[] = { "NULL", "TCP" }; + size_t sizeofArray = sizeof(transport_protocolArray) / sizeof(transport_protocolArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(transport_protocol, transport_protocolArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(transport_protocol); -} - -cJSON *OpenAPI_transport_protocol_convertToJSON(OpenAPI_transport_protocol_t *transport_protocol) -{ - cJSON *item = NULL; - - if (transport_protocol == NULL) { - ogs_error("OpenAPI_transport_protocol_convertToJSON() failed [TransportProtocol]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_parseFromJSON(cJSON *transport_protocolJSON) -{ - OpenAPI_transport_protocol_t *transport_protocol_local_var = NULL; - transport_protocol_local_var = OpenAPI_transport_protocol_create ( - ); - - return transport_protocol_local_var; -end: - return NULL; -} - -OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_copy(OpenAPI_transport_protocol_t *dst, OpenAPI_transport_protocol_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_transport_protocol_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_transport_protocol_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_transport_protocol_free(dst); - dst = OpenAPI_transport_protocol_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/transport_protocol.h b/lib/sbi/openapi/model/transport_protocol.h index 32be818b1..bdf488550 100644 --- a/lib/sbi/openapi/model/transport_protocol.h +++ b/lib/sbi/openapi/model/transport_protocol.h @@ -1,7 +1,7 @@ /* * transport_protocol.h * - * Types of transport protocol used in a given IP endpoint of an NF Service Instance + * */ #ifndef _OpenAPI_transport_protocol_H_ @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_transport_protocol_s OpenAPI_transport_protocol_t; -typedef struct OpenAPI_transport_protocol_s { -} OpenAPI_transport_protocol_t; +typedef enum { OpenAPI_transport_protocol_NULL = 0, OpenAPI_transport_protocol_TCP } OpenAPI_transport_protocol_e; -OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_create( - ); -void OpenAPI_transport_protocol_free(OpenAPI_transport_protocol_t *transport_protocol); -OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_parseFromJSON(cJSON *transport_protocolJSON); -cJSON *OpenAPI_transport_protocol_convertToJSON(OpenAPI_transport_protocol_t *transport_protocol); -OpenAPI_transport_protocol_t *OpenAPI_transport_protocol_copy(OpenAPI_transport_protocol_t *dst, OpenAPI_transport_protocol_t *src); +char* OpenAPI_transport_protocol_ToString(OpenAPI_transport_protocol_e transport_protocol); + +OpenAPI_transport_protocol_e OpenAPI_transport_protocol_FromString(char* transport_protocol); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/trigger.c b/lib/sbi/openapi/model/trigger.c index 868e1b398..3c385a07d 100644 --- a/lib/sbi/openapi/model/trigger.c +++ b/lib/sbi/openapi/model/trigger.c @@ -9,7 +9,7 @@ OpenAPI_trigger_t *OpenAPI_trigger_create( OpenAPI_trigger_category_t *trigger_category, int time_limit, int volume_limit, - long volume_limit64, + int volume_limit64, int max_number_ofccc ) { diff --git a/lib/sbi/openapi/model/trigger.h b/lib/sbi/openapi/model/trigger.h index 302be983c..f85f8efe0 100644 --- a/lib/sbi/openapi/model/trigger.h +++ b/lib/sbi/openapi/model/trigger.h @@ -25,7 +25,7 @@ typedef struct OpenAPI_trigger_s { struct OpenAPI_trigger_category_s *trigger_category; int time_limit; int volume_limit; - long volume_limit64; + int volume_limit64; int max_number_ofccc; } OpenAPI_trigger_t; @@ -34,7 +34,7 @@ OpenAPI_trigger_t *OpenAPI_trigger_create( OpenAPI_trigger_category_t *trigger_category, int time_limit, int volume_limit, - long volume_limit64, + int volume_limit64, int max_number_ofccc ); void OpenAPI_trigger_free(OpenAPI_trigger_t *trigger); diff --git a/lib/sbi/openapi/model/twap_id.c b/lib/sbi/openapi/model/twap_id.c new file mode 100644 index 000000000..a5eda323e --- /dev/null +++ b/lib/sbi/openapi/model/twap_id.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "twap_id.h" + +OpenAPI_twap_id_t *OpenAPI_twap_id_create( + char *ss_id, + char *bss_id, + char civic_address + ) +{ + OpenAPI_twap_id_t *twap_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_twap_id_t)); + if (!twap_id_local_var) { + return NULL; + } + twap_id_local_var->ss_id = ss_id; + twap_id_local_var->bss_id = bss_id; + twap_id_local_var->civic_address = civic_address; + + return twap_id_local_var; +} + +void OpenAPI_twap_id_free(OpenAPI_twap_id_t *twap_id) +{ + if (NULL == twap_id) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(twap_id->ss_id); + ogs_free(twap_id->bss_id); + ogs_free(twap_id); +} + +cJSON *OpenAPI_twap_id_convertToJSON(OpenAPI_twap_id_t *twap_id) +{ + cJSON *item = NULL; + + if (twap_id == NULL) { + ogs_error("OpenAPI_twap_id_convertToJSON() failed [TwapId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!twap_id->ss_id) { + ogs_error("OpenAPI_twap_id_convertToJSON() failed [ss_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "ssId", twap_id->ss_id) == NULL) { + ogs_error("OpenAPI_twap_id_convertToJSON() failed [ss_id]"); + goto end; + } + + if (twap_id->bss_id) { + if (cJSON_AddStringToObject(item, "bssId", twap_id->bss_id) == NULL) { + ogs_error("OpenAPI_twap_id_convertToJSON() failed [bss_id]"); + goto end; + } + } + + if (twap_id->civic_address) { + if (cJSON_AddNumberToObject(item, "civicAddress", twap_id->civic_address) == NULL) { + ogs_error("OpenAPI_twap_id_convertToJSON() failed [civic_address]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_twap_id_t *OpenAPI_twap_id_parseFromJSON(cJSON *twap_idJSON) +{ + OpenAPI_twap_id_t *twap_id_local_var = NULL; + cJSON *ss_id = cJSON_GetObjectItemCaseSensitive(twap_idJSON, "ssId"); + if (!ss_id) { + ogs_error("OpenAPI_twap_id_parseFromJSON() failed [ss_id]"); + goto end; + } + + + if (!cJSON_IsString(ss_id)) { + ogs_error("OpenAPI_twap_id_parseFromJSON() failed [ss_id]"); + goto end; + } + + cJSON *bss_id = cJSON_GetObjectItemCaseSensitive(twap_idJSON, "bssId"); + + if (bss_id) { + if (!cJSON_IsString(bss_id)) { + ogs_error("OpenAPI_twap_id_parseFromJSON() failed [bss_id]"); + goto end; + } + } + + cJSON *civic_address = cJSON_GetObjectItemCaseSensitive(twap_idJSON, "civicAddress"); + + if (civic_address) { + if (!cJSON_IsNumber(civic_address)) { + ogs_error("OpenAPI_twap_id_parseFromJSON() failed [civic_address]"); + goto end; + } + } + + twap_id_local_var = OpenAPI_twap_id_create ( + ogs_strdup(ss_id->valuestring), + bss_id ? ogs_strdup(bss_id->valuestring) : NULL, + civic_address ? civic_address->valueint : 0 + ); + + return twap_id_local_var; +end: + return NULL; +} + +OpenAPI_twap_id_t *OpenAPI_twap_id_copy(OpenAPI_twap_id_t *dst, OpenAPI_twap_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_twap_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_twap_id_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_twap_id_free(dst); + dst = OpenAPI_twap_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/twap_id.h b/lib/sbi/openapi/model/twap_id.h new file mode 100644 index 000000000..3914080b5 --- /dev/null +++ b/lib/sbi/openapi/model/twap_id.h @@ -0,0 +1,42 @@ +/* + * twap_id.h + * + * + */ + +#ifndef _OpenAPI_twap_id_H_ +#define _OpenAPI_twap_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_twap_id_s OpenAPI_twap_id_t; +typedef struct OpenAPI_twap_id_s { + char *ss_id; + char *bss_id; + char civic_address; +} OpenAPI_twap_id_t; + +OpenAPI_twap_id_t *OpenAPI_twap_id_create( + char *ss_id, + char *bss_id, + char civic_address + ); +void OpenAPI_twap_id_free(OpenAPI_twap_id_t *twap_id); +OpenAPI_twap_id_t *OpenAPI_twap_id_parseFromJSON(cJSON *twap_idJSON); +cJSON *OpenAPI_twap_id_convertToJSON(OpenAPI_twap_id_t *twap_id); +OpenAPI_twap_id_t *OpenAPI_twap_id_copy(OpenAPI_twap_id_t *dst, OpenAPI_twap_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_twap_id_H_ */ + diff --git a/lib/sbi/openapi/model/twif_info.h b/lib/sbi/openapi/model/twif_info.h index 882827b5b..7ab714e04 100644 --- a/lib/sbi/openapi/model/twif_info.h +++ b/lib/sbi/openapi/model/twif_info.h @@ -1,7 +1,7 @@ /* * twif_info.h * - * + * Addressing information (IP addresses, FQDN) of the TWIF */ #ifndef _OpenAPI_twif_info_H_ diff --git a/lib/sbi/openapi/model/udsf_info.c b/lib/sbi/openapi/model/udsf_info.c index 92a9acfb5..8b56a8f56 100644 --- a/lib/sbi/openapi/model/udsf_info.c +++ b/lib/sbi/openapi/model/udsf_info.c @@ -6,7 +6,8 @@ OpenAPI_udsf_info_t *OpenAPI_udsf_info_create( char *group_id, - OpenAPI_list_t *supi_ranges + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t* storage_id_ranges ) { OpenAPI_udsf_info_t *udsf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_udsf_info_t)); @@ -15,6 +16,7 @@ OpenAPI_udsf_info_t *OpenAPI_udsf_info_create( } udsf_info_local_var->group_id = group_id; udsf_info_local_var->supi_ranges = supi_ranges; + udsf_info_local_var->storage_id_ranges = storage_id_ranges; return udsf_info_local_var; } @@ -30,6 +32,12 @@ void OpenAPI_udsf_info_free(OpenAPI_udsf_info_t *udsf_info) OpenAPI_supi_range_free(node->data); } OpenAPI_list_free(udsf_info->supi_ranges); + OpenAPI_list_for_each(udsf_info->storage_id_ranges, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(udsf_info->storage_id_ranges); ogs_free(udsf_info); } @@ -70,6 +78,21 @@ cJSON *OpenAPI_udsf_info_convertToJSON(OpenAPI_udsf_info_t *udsf_info) } } + if (udsf_info->storage_id_ranges) { + cJSON *storage_id_ranges = cJSON_AddObjectToObject(item, "storageIdRanges"); + if (storage_id_ranges == NULL) { + ogs_error("OpenAPI_udsf_info_convertToJSON() failed [storage_id_ranges]"); + goto end; + } + cJSON *localMapObject = storage_id_ranges; + OpenAPI_lnode_t *storage_id_ranges_node; + if (udsf_info->storage_id_ranges) { + OpenAPI_list_for_each(udsf_info->storage_id_ranges, storage_id_ranges_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)storage_id_ranges_node->data; + } + } + } + end: return item; } @@ -109,9 +132,27 @@ OpenAPI_udsf_info_t *OpenAPI_udsf_info_parseFromJSON(cJSON *udsf_infoJSON) } } + cJSON *storage_id_ranges = cJSON_GetObjectItemCaseSensitive(udsf_infoJSON, "storageIdRanges"); + + OpenAPI_list_t *storage_id_rangesList; + if (storage_id_ranges) { + cJSON *storage_id_ranges_local_map; + if (!cJSON_IsObject(storage_id_ranges)) { + ogs_error("OpenAPI_udsf_info_parseFromJSON() failed [storage_id_ranges]"); + goto end; + } + storage_id_rangesList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(storage_id_ranges_local_map, storage_id_ranges) { + cJSON *localMapObject = storage_id_ranges_local_map; + OpenAPI_list_add(storage_id_rangesList, localMapKeyPair); + } + } + udsf_info_local_var = OpenAPI_udsf_info_create ( group_id ? ogs_strdup(group_id->valuestring) : NULL, - supi_ranges ? supi_rangesList : NULL + supi_ranges ? supi_rangesList : NULL, + storage_id_ranges ? storage_id_rangesList : NULL ); return udsf_info_local_var; diff --git a/lib/sbi/openapi/model/udsf_info.h b/lib/sbi/openapi/model/udsf_info.h index 6e2d33a2b..86df3e4a4 100644 --- a/lib/sbi/openapi/model/udsf_info.h +++ b/lib/sbi/openapi/model/udsf_info.h @@ -1,7 +1,7 @@ /* * udsf_info.h * - * + * Information related to UDSF */ #ifndef _OpenAPI_udsf_info_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "identity_range.h" #include "supi_range.h" #ifdef __cplusplus @@ -22,11 +23,13 @@ typedef struct OpenAPI_udsf_info_s OpenAPI_udsf_info_t; typedef struct OpenAPI_udsf_info_s { char *group_id; OpenAPI_list_t *supi_ranges; + OpenAPI_list_t* storage_id_ranges; } OpenAPI_udsf_info_t; OpenAPI_udsf_info_t *OpenAPI_udsf_info_create( char *group_id, - OpenAPI_list_t *supi_ranges + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t* storage_id_ranges ); void OpenAPI_udsf_info_free(OpenAPI_udsf_info_t *udsf_info); OpenAPI_udsf_info_t *OpenAPI_udsf_info_parseFromJSON(cJSON *udsf_infoJSON); diff --git a/lib/sbi/openapi/model/ue_auth.c b/lib/sbi/openapi/model/ue_auth.c index f0bfdb64a..3df4b04d1 100644 --- a/lib/sbi/openapi/model/ue_auth.c +++ b/lib/sbi/openapi/model/ue_auth.c @@ -4,82 +4,27 @@ #include #include "ue_auth.h" -OpenAPI_ue_auth_t *OpenAPI_ue_auth_create( - ) +char* OpenAPI_ue_auth_ToString(OpenAPI_ue_auth_e ue_auth) { - OpenAPI_ue_auth_t *ue_auth_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_auth_t)); - if (!ue_auth_local_var) { - return NULL; - } - - return ue_auth_local_var; + const char *ue_authArray[] = { "NULL", "AUTHORIZED", "NOT_AUTHORIZED" }; + size_t sizeofArray = sizeof(ue_authArray) / sizeof(ue_authArray[0]); + if (ue_auth < sizeofArray) + return (char *)ue_authArray[ue_auth]; + else + return (char *)"Unknown"; } -void OpenAPI_ue_auth_free(OpenAPI_ue_auth_t *ue_auth) +OpenAPI_ue_auth_e OpenAPI_ue_auth_FromString(char* ue_auth) { - if (NULL == ue_auth) { - return; + int stringToReturn = 0; + const char *ue_authArray[] = { "NULL", "AUTHORIZED", "NOT_AUTHORIZED" }; + size_t sizeofArray = sizeof(ue_authArray) / sizeof(ue_authArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ue_auth, ue_authArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(ue_auth); -} - -cJSON *OpenAPI_ue_auth_convertToJSON(OpenAPI_ue_auth_t *ue_auth) -{ - cJSON *item = NULL; - - if (ue_auth == NULL) { - ogs_error("OpenAPI_ue_auth_convertToJSON() failed [UeAuth]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_ue_auth_t *OpenAPI_ue_auth_parseFromJSON(cJSON *ue_authJSON) -{ - OpenAPI_ue_auth_t *ue_auth_local_var = NULL; - ue_auth_local_var = OpenAPI_ue_auth_create ( - ); - - return ue_auth_local_var; -end: - return NULL; -} - -OpenAPI_ue_auth_t *OpenAPI_ue_auth_copy(OpenAPI_ue_auth_t *dst, OpenAPI_ue_auth_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_ue_auth_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_ue_auth_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_ue_auth_free(dst); - dst = OpenAPI_ue_auth_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/ue_auth.h b/lib/sbi/openapi/model/ue_auth.h index d680d4ba2..ba1edebd8 100644 --- a/lib/sbi/openapi/model/ue_auth.h +++ b/lib/sbi/openapi/model/ue_auth.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_ue_auth_s OpenAPI_ue_auth_t; -typedef struct OpenAPI_ue_auth_s { -} OpenAPI_ue_auth_t; +typedef enum { OpenAPI_ue_auth_NULL = 0, OpenAPI_ue_auth_AUTHORIZED, OpenAPI_ue_auth_NOT_AUTHORIZED } OpenAPI_ue_auth_e; -OpenAPI_ue_auth_t *OpenAPI_ue_auth_create( - ); -void OpenAPI_ue_auth_free(OpenAPI_ue_auth_t *ue_auth); -OpenAPI_ue_auth_t *OpenAPI_ue_auth_parseFromJSON(cJSON *ue_authJSON); -cJSON *OpenAPI_ue_auth_convertToJSON(OpenAPI_ue_auth_t *ue_auth); -OpenAPI_ue_auth_t *OpenAPI_ue_auth_copy(OpenAPI_ue_auth_t *dst, OpenAPI_ue_auth_t *src); +char* OpenAPI_ue_auth_ToString(OpenAPI_ue_auth_e ue_auth); + +OpenAPI_ue_auth_e OpenAPI_ue_auth_FromString(char* ue_auth); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/ue_context_in_amf_data.c b/lib/sbi/openapi/model/ue_context_in_amf_data.c new file mode 100644 index 000000000..6d9826520 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_in_amf_data.c @@ -0,0 +1,109 @@ + +#include +#include +#include +#include "ue_context_in_amf_data.h" + +OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_create( + OpenAPI_eps_interworking_info_t *eps_interworking_info + ) +{ + OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_ue_context_in_amf_data_t)); + if (!ue_context_in_amf_data_local_var) { + return NULL; + } + ue_context_in_amf_data_local_var->eps_interworking_info = eps_interworking_info; + + return ue_context_in_amf_data_local_var; +} + +void OpenAPI_ue_context_in_amf_data_free(OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data) +{ + if (NULL == ue_context_in_amf_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_eps_interworking_info_free(ue_context_in_amf_data->eps_interworking_info); + ogs_free(ue_context_in_amf_data); +} + +cJSON *OpenAPI_ue_context_in_amf_data_convertToJSON(OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data) +{ + cJSON *item = NULL; + + if (ue_context_in_amf_data == NULL) { + ogs_error("OpenAPI_ue_context_in_amf_data_convertToJSON() failed [UeContextInAmfData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_context_in_amf_data->eps_interworking_info) { + cJSON *eps_interworking_info_local_JSON = OpenAPI_eps_interworking_info_convertToJSON(ue_context_in_amf_data->eps_interworking_info); + if (eps_interworking_info_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_in_amf_data_convertToJSON() failed [eps_interworking_info]"); + goto end; + } + cJSON_AddItemToObject(item, "epsInterworkingInfo", eps_interworking_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_in_amf_data_convertToJSON() failed [eps_interworking_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_parseFromJSON(cJSON *ue_context_in_amf_dataJSON) +{ + OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data_local_var = NULL; + cJSON *eps_interworking_info = cJSON_GetObjectItemCaseSensitive(ue_context_in_amf_dataJSON, "epsInterworkingInfo"); + + OpenAPI_eps_interworking_info_t *eps_interworking_info_local_nonprim = NULL; + if (eps_interworking_info) { + eps_interworking_info_local_nonprim = OpenAPI_eps_interworking_info_parseFromJSON(eps_interworking_info); + } + + ue_context_in_amf_data_local_var = OpenAPI_ue_context_in_amf_data_create ( + eps_interworking_info ? eps_interworking_info_local_nonprim : NULL + ); + + return ue_context_in_amf_data_local_var; +end: + return NULL; +} + +OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_copy(OpenAPI_ue_context_in_amf_data_t *dst, OpenAPI_ue_context_in_amf_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_in_amf_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_in_amf_data_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_ue_context_in_amf_data_free(dst); + dst = OpenAPI_ue_context_in_amf_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_in_amf_data.h b/lib/sbi/openapi/model/ue_context_in_amf_data.h new file mode 100644 index 000000000..1e16a15b0 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_in_amf_data.h @@ -0,0 +1,39 @@ +/* + * ue_context_in_amf_data.h + * + * + */ + +#ifndef _OpenAPI_ue_context_in_amf_data_H_ +#define _OpenAPI_ue_context_in_amf_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "eps_interworking_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_in_amf_data_s OpenAPI_ue_context_in_amf_data_t; +typedef struct OpenAPI_ue_context_in_amf_data_s { + struct OpenAPI_eps_interworking_info_s *eps_interworking_info; +} OpenAPI_ue_context_in_amf_data_t; + +OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_create( + OpenAPI_eps_interworking_info_t *eps_interworking_info + ); +void OpenAPI_ue_context_in_amf_data_free(OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data); +OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_parseFromJSON(cJSON *ue_context_in_amf_dataJSON); +cJSON *OpenAPI_ue_context_in_amf_data_convertToJSON(OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data); +OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_copy(OpenAPI_ue_context_in_amf_data_t *dst, OpenAPI_ue_context_in_amf_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_in_amf_data_H_ */ + diff --git a/lib/sbi/openapi/model/unrelated_class.c b/lib/sbi/openapi/model/unrelated_class.c index edf5bea89..d83557671 100644 --- a/lib/sbi/openapi/model/unrelated_class.c +++ b/lib/sbi/openapi/model/unrelated_class.c @@ -5,7 +5,7 @@ #include "unrelated_class.h" OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_create( - OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class, + OpenAPI_default_unrelated_class_t *default_unrelated_class, OpenAPI_external_unrelated_class_t *external_unrelated_class, OpenAPI_list_t *service_type_unrelated_classes ) @@ -14,7 +14,7 @@ OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_create( if (!unrelated_class_local_var) { return NULL; } - unrelated_class_local_var->non_external_unrelated_class = non_external_unrelated_class; + unrelated_class_local_var->default_unrelated_class = default_unrelated_class; unrelated_class_local_var->external_unrelated_class = external_unrelated_class; unrelated_class_local_var->service_type_unrelated_classes = service_type_unrelated_classes; @@ -27,7 +27,7 @@ void OpenAPI_unrelated_class_free(OpenAPI_unrelated_class_t *unrelated_class) return; } OpenAPI_lnode_t *node; - OpenAPI_non_external_unrelated_class_free(unrelated_class->non_external_unrelated_class); + OpenAPI_default_unrelated_class_free(unrelated_class->default_unrelated_class); OpenAPI_external_unrelated_class_free(unrelated_class->external_unrelated_class); OpenAPI_list_for_each(unrelated_class->service_type_unrelated_classes, node) { OpenAPI_service_type_unrelated_class_free(node->data); @@ -46,18 +46,18 @@ cJSON *OpenAPI_unrelated_class_convertToJSON(OpenAPI_unrelated_class_t *unrelate } item = cJSON_CreateObject(); - if (!unrelated_class->non_external_unrelated_class) { - ogs_error("OpenAPI_unrelated_class_convertToJSON() failed [non_external_unrelated_class]"); + if (!unrelated_class->default_unrelated_class) { + ogs_error("OpenAPI_unrelated_class_convertToJSON() failed [default_unrelated_class]"); goto end; } - cJSON *non_external_unrelated_class_local_JSON = OpenAPI_non_external_unrelated_class_convertToJSON(unrelated_class->non_external_unrelated_class); - if (non_external_unrelated_class_local_JSON == NULL) { - ogs_error("OpenAPI_unrelated_class_convertToJSON() failed [non_external_unrelated_class]"); + cJSON *default_unrelated_class_local_JSON = OpenAPI_default_unrelated_class_convertToJSON(unrelated_class->default_unrelated_class); + if (default_unrelated_class_local_JSON == NULL) { + ogs_error("OpenAPI_unrelated_class_convertToJSON() failed [default_unrelated_class]"); goto end; } - cJSON_AddItemToObject(item, "nonExternalUnrelatedClass", non_external_unrelated_class_local_JSON); + cJSON_AddItemToObject(item, "defaultUnrelatedClass", default_unrelated_class_local_JSON); if (item->child == NULL) { - ogs_error("OpenAPI_unrelated_class_convertToJSON() failed [non_external_unrelated_class]"); + ogs_error("OpenAPI_unrelated_class_convertToJSON() failed [default_unrelated_class]"); goto end; } @@ -101,15 +101,15 @@ end: OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_parseFromJSON(cJSON *unrelated_classJSON) { OpenAPI_unrelated_class_t *unrelated_class_local_var = NULL; - cJSON *non_external_unrelated_class = cJSON_GetObjectItemCaseSensitive(unrelated_classJSON, "nonExternalUnrelatedClass"); - if (!non_external_unrelated_class) { - ogs_error("OpenAPI_unrelated_class_parseFromJSON() failed [non_external_unrelated_class]"); + cJSON *default_unrelated_class = cJSON_GetObjectItemCaseSensitive(unrelated_classJSON, "defaultUnrelatedClass"); + if (!default_unrelated_class) { + ogs_error("OpenAPI_unrelated_class_parseFromJSON() failed [default_unrelated_class]"); goto end; } - OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class_local_nonprim = NULL; + OpenAPI_default_unrelated_class_t *default_unrelated_class_local_nonprim = NULL; - non_external_unrelated_class_local_nonprim = OpenAPI_non_external_unrelated_class_parseFromJSON(non_external_unrelated_class); + default_unrelated_class_local_nonprim = OpenAPI_default_unrelated_class_parseFromJSON(default_unrelated_class); cJSON *external_unrelated_class = cJSON_GetObjectItemCaseSensitive(unrelated_classJSON, "externalUnrelatedClass"); @@ -142,7 +142,7 @@ OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_parseFromJSON(cJSON *unrelate } unrelated_class_local_var = OpenAPI_unrelated_class_create ( - non_external_unrelated_class_local_nonprim, + default_unrelated_class_local_nonprim, external_unrelated_class ? external_unrelated_class_local_nonprim : NULL, service_type_unrelated_classes ? service_type_unrelated_classesList : NULL ); diff --git a/lib/sbi/openapi/model/unrelated_class.h b/lib/sbi/openapi/model/unrelated_class.h index 1679b7bf4..921b58b4b 100644 --- a/lib/sbi/openapi/model/unrelated_class.h +++ b/lib/sbi/openapi/model/unrelated_class.h @@ -12,8 +12,8 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "default_unrelated_class.h" #include "external_unrelated_class.h" -#include "non_external_unrelated_class.h" #include "service_type_unrelated_class.h" #ifdef __cplusplus @@ -22,13 +22,13 @@ extern "C" { typedef struct OpenAPI_unrelated_class_s OpenAPI_unrelated_class_t; typedef struct OpenAPI_unrelated_class_s { - struct OpenAPI_non_external_unrelated_class_s *non_external_unrelated_class; + struct OpenAPI_default_unrelated_class_s *default_unrelated_class; struct OpenAPI_external_unrelated_class_s *external_unrelated_class; OpenAPI_list_t *service_type_unrelated_classes; } OpenAPI_unrelated_class_t; OpenAPI_unrelated_class_t *OpenAPI_unrelated_class_create( - OpenAPI_non_external_unrelated_class_t *non_external_unrelated_class, + OpenAPI_default_unrelated_class_t *default_unrelated_class, OpenAPI_external_unrelated_class_t *external_unrelated_class, OpenAPI_list_t *service_type_unrelated_classes ); diff --git a/lib/sbi/openapi/model/up_confidentiality.c b/lib/sbi/openapi/model/up_confidentiality.c index f1afddd47..1e736b87d 100644 --- a/lib/sbi/openapi/model/up_confidentiality.c +++ b/lib/sbi/openapi/model/up_confidentiality.c @@ -4,82 +4,27 @@ #include #include "up_confidentiality.h" -OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_create( - ) +char* OpenAPI_up_confidentiality_ToString(OpenAPI_up_confidentiality_e up_confidentiality) { - OpenAPI_up_confidentiality_t *up_confidentiality_local_var = OpenAPI_malloc(sizeof(OpenAPI_up_confidentiality_t)); - if (!up_confidentiality_local_var) { - return NULL; - } - - return up_confidentiality_local_var; + const char *up_confidentialityArray[] = { "NULL", "REQUIRED", "PREFERRED", "NOT_NEEDED" }; + size_t sizeofArray = sizeof(up_confidentialityArray) / sizeof(up_confidentialityArray[0]); + if (up_confidentiality < sizeofArray) + return (char *)up_confidentialityArray[up_confidentiality]; + else + return (char *)"Unknown"; } -void OpenAPI_up_confidentiality_free(OpenAPI_up_confidentiality_t *up_confidentiality) +OpenAPI_up_confidentiality_e OpenAPI_up_confidentiality_FromString(char* up_confidentiality) { - if (NULL == up_confidentiality) { - return; + int stringToReturn = 0; + const char *up_confidentialityArray[] = { "NULL", "REQUIRED", "PREFERRED", "NOT_NEEDED" }; + size_t sizeofArray = sizeof(up_confidentialityArray) / sizeof(up_confidentialityArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(up_confidentiality, up_confidentialityArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(up_confidentiality); -} - -cJSON *OpenAPI_up_confidentiality_convertToJSON(OpenAPI_up_confidentiality_t *up_confidentiality) -{ - cJSON *item = NULL; - - if (up_confidentiality == NULL) { - ogs_error("OpenAPI_up_confidentiality_convertToJSON() failed [UpConfidentiality]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_parseFromJSON(cJSON *up_confidentialityJSON) -{ - OpenAPI_up_confidentiality_t *up_confidentiality_local_var = NULL; - up_confidentiality_local_var = OpenAPI_up_confidentiality_create ( - ); - - return up_confidentiality_local_var; -end: - return NULL; -} - -OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_copy(OpenAPI_up_confidentiality_t *dst, OpenAPI_up_confidentiality_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_up_confidentiality_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_up_confidentiality_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_up_confidentiality_free(dst); - dst = OpenAPI_up_confidentiality_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/up_confidentiality.h b/lib/sbi/openapi/model/up_confidentiality.h index f89079cfa..31ce6f194 100644 --- a/lib/sbi/openapi/model/up_confidentiality.h +++ b/lib/sbi/openapi/model/up_confidentiality.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_up_confidentiality_s OpenAPI_up_confidentiality_t; -typedef struct OpenAPI_up_confidentiality_s { -} OpenAPI_up_confidentiality_t; +typedef enum { OpenAPI_up_confidentiality_NULL = 0, OpenAPI_up_confidentiality_REQUIRED, OpenAPI_up_confidentiality_PREFERRED, OpenAPI_up_confidentiality_NOT_NEEDED } OpenAPI_up_confidentiality_e; -OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_create( - ); -void OpenAPI_up_confidentiality_free(OpenAPI_up_confidentiality_t *up_confidentiality); -OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_parseFromJSON(cJSON *up_confidentialityJSON); -cJSON *OpenAPI_up_confidentiality_convertToJSON(OpenAPI_up_confidentiality_t *up_confidentiality); -OpenAPI_up_confidentiality_t *OpenAPI_up_confidentiality_copy(OpenAPI_up_confidentiality_t *dst, OpenAPI_up_confidentiality_t *src); +char* OpenAPI_up_confidentiality_ToString(OpenAPI_up_confidentiality_e up_confidentiality); + +OpenAPI_up_confidentiality_e OpenAPI_up_confidentiality_FromString(char* up_confidentiality); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/up_integrity.c b/lib/sbi/openapi/model/up_integrity.c index a15de0427..11bad5edb 100644 --- a/lib/sbi/openapi/model/up_integrity.c +++ b/lib/sbi/openapi/model/up_integrity.c @@ -4,82 +4,27 @@ #include #include "up_integrity.h" -OpenAPI_up_integrity_t *OpenAPI_up_integrity_create( - ) +char* OpenAPI_up_integrity_ToString(OpenAPI_up_integrity_e up_integrity) { - OpenAPI_up_integrity_t *up_integrity_local_var = OpenAPI_malloc(sizeof(OpenAPI_up_integrity_t)); - if (!up_integrity_local_var) { - return NULL; - } - - return up_integrity_local_var; + const char *up_integrityArray[] = { "NULL", "REQUIRED", "PREFERRED", "NOT_NEEDED" }; + size_t sizeofArray = sizeof(up_integrityArray) / sizeof(up_integrityArray[0]); + if (up_integrity < sizeofArray) + return (char *)up_integrityArray[up_integrity]; + else + return (char *)"Unknown"; } -void OpenAPI_up_integrity_free(OpenAPI_up_integrity_t *up_integrity) +OpenAPI_up_integrity_e OpenAPI_up_integrity_FromString(char* up_integrity) { - if (NULL == up_integrity) { - return; + int stringToReturn = 0; + const char *up_integrityArray[] = { "NULL", "REQUIRED", "PREFERRED", "NOT_NEEDED" }; + size_t sizeofArray = sizeof(up_integrityArray) / sizeof(up_integrityArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(up_integrity, up_integrityArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - OpenAPI_lnode_t *node; - ogs_free(up_integrity); -} - -cJSON *OpenAPI_up_integrity_convertToJSON(OpenAPI_up_integrity_t *up_integrity) -{ - cJSON *item = NULL; - - if (up_integrity == NULL) { - ogs_error("OpenAPI_up_integrity_convertToJSON() failed [UpIntegrity]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_up_integrity_t *OpenAPI_up_integrity_parseFromJSON(cJSON *up_integrityJSON) -{ - OpenAPI_up_integrity_t *up_integrity_local_var = NULL; - up_integrity_local_var = OpenAPI_up_integrity_create ( - ); - - return up_integrity_local_var; -end: - return NULL; -} - -OpenAPI_up_integrity_t *OpenAPI_up_integrity_copy(OpenAPI_up_integrity_t *dst, OpenAPI_up_integrity_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_up_integrity_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_up_integrity_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_up_integrity_free(dst); - dst = OpenAPI_up_integrity_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/up_integrity.h b/lib/sbi/openapi/model/up_integrity.h index 2d3f2dc7f..99958b817 100644 --- a/lib/sbi/openapi/model/up_integrity.h +++ b/lib/sbi/openapi/model/up_integrity.h @@ -17,16 +17,11 @@ extern "C" { #endif -typedef struct OpenAPI_up_integrity_s OpenAPI_up_integrity_t; -typedef struct OpenAPI_up_integrity_s { -} OpenAPI_up_integrity_t; +typedef enum { OpenAPI_up_integrity_NULL = 0, OpenAPI_up_integrity_REQUIRED, OpenAPI_up_integrity_PREFERRED, OpenAPI_up_integrity_NOT_NEEDED } OpenAPI_up_integrity_e; -OpenAPI_up_integrity_t *OpenAPI_up_integrity_create( - ); -void OpenAPI_up_integrity_free(OpenAPI_up_integrity_t *up_integrity); -OpenAPI_up_integrity_t *OpenAPI_up_integrity_parseFromJSON(cJSON *up_integrityJSON); -cJSON *OpenAPI_up_integrity_convertToJSON(OpenAPI_up_integrity_t *up_integrity); -OpenAPI_up_integrity_t *OpenAPI_up_integrity_copy(OpenAPI_up_integrity_t *dst, OpenAPI_up_integrity_t *src); +char* OpenAPI_up_integrity_ToString(OpenAPI_up_integrity_e up_integrity); + +OpenAPI_up_integrity_e OpenAPI_up_integrity_FromString(char* up_integrity); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/up_security.c b/lib/sbi/openapi/model/up_security.c index ac91ebaad..2f1dbe646 100644 --- a/lib/sbi/openapi/model/up_security.c +++ b/lib/sbi/openapi/model/up_security.c @@ -5,8 +5,8 @@ #include "up_security.h" OpenAPI_up_security_t *OpenAPI_up_security_create( - OpenAPI_up_integrity_t *up_integr, - OpenAPI_up_confidentiality_t *up_confid + OpenAPI_up_integrity_e up_integr, + OpenAPI_up_confidentiality_e up_confid ) { OpenAPI_up_security_t *up_security_local_var = OpenAPI_malloc(sizeof(OpenAPI_up_security_t)); @@ -25,8 +25,6 @@ void OpenAPI_up_security_free(OpenAPI_up_security_t *up_security) return; } OpenAPI_lnode_t *node; - OpenAPI_up_integrity_free(up_security->up_integr); - OpenAPI_up_confidentiality_free(up_security->up_confid); ogs_free(up_security); } @@ -44,13 +42,7 @@ cJSON *OpenAPI_up_security_convertToJSON(OpenAPI_up_security_t *up_security) ogs_error("OpenAPI_up_security_convertToJSON() failed [up_integr]"); goto end; } - cJSON *up_integr_local_JSON = OpenAPI_up_integrity_convertToJSON(up_security->up_integr); - if (up_integr_local_JSON == NULL) { - ogs_error("OpenAPI_up_security_convertToJSON() failed [up_integr]"); - goto end; - } - cJSON_AddItemToObject(item, "upIntegr", up_integr_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "upIntegr", OpenAPI_up_integrity_ToString(up_security->up_integr)) == NULL) { ogs_error("OpenAPI_up_security_convertToJSON() failed [up_integr]"); goto end; } @@ -59,13 +51,7 @@ cJSON *OpenAPI_up_security_convertToJSON(OpenAPI_up_security_t *up_security) ogs_error("OpenAPI_up_security_convertToJSON() failed [up_confid]"); goto end; } - cJSON *up_confid_local_JSON = OpenAPI_up_confidentiality_convertToJSON(up_security->up_confid); - if (up_confid_local_JSON == NULL) { - ogs_error("OpenAPI_up_security_convertToJSON() failed [up_confid]"); - goto end; - } - cJSON_AddItemToObject(item, "upConfid", up_confid_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "upConfid", OpenAPI_up_confidentiality_ToString(up_security->up_confid)) == NULL) { ogs_error("OpenAPI_up_security_convertToJSON() failed [up_confid]"); goto end; } @@ -83,9 +69,13 @@ OpenAPI_up_security_t *OpenAPI_up_security_parseFromJSON(cJSON *up_securityJSON) goto end; } - OpenAPI_up_integrity_t *up_integr_local_nonprim = NULL; + OpenAPI_up_integrity_e up_integrVariable; - up_integr_local_nonprim = OpenAPI_up_integrity_parseFromJSON(up_integr); + if (!cJSON_IsString(up_integr)) { + ogs_error("OpenAPI_up_security_parseFromJSON() failed [up_integr]"); + goto end; + } + up_integrVariable = OpenAPI_up_integrity_FromString(up_integr->valuestring); cJSON *up_confid = cJSON_GetObjectItemCaseSensitive(up_securityJSON, "upConfid"); if (!up_confid) { @@ -93,13 +83,17 @@ OpenAPI_up_security_t *OpenAPI_up_security_parseFromJSON(cJSON *up_securityJSON) goto end; } - OpenAPI_up_confidentiality_t *up_confid_local_nonprim = NULL; + OpenAPI_up_confidentiality_e up_confidVariable; - up_confid_local_nonprim = OpenAPI_up_confidentiality_parseFromJSON(up_confid); + if (!cJSON_IsString(up_confid)) { + ogs_error("OpenAPI_up_security_parseFromJSON() failed [up_confid]"); + goto end; + } + up_confidVariable = OpenAPI_up_confidentiality_FromString(up_confid->valuestring); up_security_local_var = OpenAPI_up_security_create ( - up_integr_local_nonprim, - up_confid_local_nonprim + up_integrVariable, + up_confidVariable ); return up_security_local_var; diff --git a/lib/sbi/openapi/model/up_security.h b/lib/sbi/openapi/model/up_security.h index 655ca0da8..fb55601f1 100644 --- a/lib/sbi/openapi/model/up_security.h +++ b/lib/sbi/openapi/model/up_security.h @@ -21,13 +21,13 @@ extern "C" { typedef struct OpenAPI_up_security_s OpenAPI_up_security_t; typedef struct OpenAPI_up_security_s { - struct OpenAPI_up_integrity_s *up_integr; - struct OpenAPI_up_confidentiality_s *up_confid; + OpenAPI_up_integrity_e up_integr; + OpenAPI_up_confidentiality_e up_confid; } OpenAPI_up_security_t; OpenAPI_up_security_t *OpenAPI_up_security_create( - OpenAPI_up_integrity_t *up_integr, - OpenAPI_up_confidentiality_t *up_confid + OpenAPI_up_integrity_e up_integr, + OpenAPI_up_confidentiality_e up_confid ); void OpenAPI_up_security_free(OpenAPI_up_security_t *up_security); OpenAPI_up_security_t *OpenAPI_up_security_parseFromJSON(cJSON *up_securityJSON); diff --git a/lib/sbi/openapi/model/up_security_info.c b/lib/sbi/openapi/model/up_security_info.c new file mode 100644 index 000000000..00b9ef0f6 --- /dev/null +++ b/lib/sbi/openapi/model/up_security_info.c @@ -0,0 +1,180 @@ + +#include +#include +#include +#include "up_security_info.h" + +OpenAPI_up_security_info_t *OpenAPI_up_security_info_create( + OpenAPI_up_security_t *up_security, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, + OpenAPI_security_result_t *security_result + ) +{ + OpenAPI_up_security_info_t *up_security_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_up_security_info_t)); + if (!up_security_info_local_var) { + return NULL; + } + up_security_info_local_var->up_security = up_security; + up_security_info_local_var->max_integrity_protected_data_rate_ul = max_integrity_protected_data_rate_ul; + up_security_info_local_var->max_integrity_protected_data_rate_dl = max_integrity_protected_data_rate_dl; + up_security_info_local_var->security_result = security_result; + + return up_security_info_local_var; +} + +void OpenAPI_up_security_info_free(OpenAPI_up_security_info_t *up_security_info) +{ + if (NULL == up_security_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_up_security_free(up_security_info->up_security); + OpenAPI_security_result_free(up_security_info->security_result); + ogs_free(up_security_info); +} + +cJSON *OpenAPI_up_security_info_convertToJSON(OpenAPI_up_security_info_t *up_security_info) +{ + cJSON *item = NULL; + + if (up_security_info == NULL) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [UpSecurityInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!up_security_info->up_security) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [up_security]"); + goto end; + } + cJSON *up_security_local_JSON = OpenAPI_up_security_convertToJSON(up_security_info->up_security); + if (up_security_local_JSON == NULL) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [up_security]"); + goto end; + } + cJSON_AddItemToObject(item, "upSecurity", up_security_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [up_security]"); + goto end; + } + + if (up_security_info->max_integrity_protected_data_rate_ul) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateUl", OpenAPI_max_integrity_protected_data_rate_ToString(up_security_info->max_integrity_protected_data_rate_ul)) == NULL) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + } + + if (up_security_info->max_integrity_protected_data_rate_dl) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateDl", OpenAPI_max_integrity_protected_data_rate_ToString(up_security_info->max_integrity_protected_data_rate_dl)) == NULL) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + } + + if (up_security_info->security_result) { + cJSON *security_result_local_JSON = OpenAPI_security_result_convertToJSON(up_security_info->security_result); + if (security_result_local_JSON == NULL) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [security_result]"); + goto end; + } + cJSON_AddItemToObject(item, "securityResult", security_result_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_up_security_info_convertToJSON() failed [security_result]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_up_security_info_t *OpenAPI_up_security_info_parseFromJSON(cJSON *up_security_infoJSON) +{ + OpenAPI_up_security_info_t *up_security_info_local_var = NULL; + cJSON *up_security = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "upSecurity"); + if (!up_security) { + ogs_error("OpenAPI_up_security_info_parseFromJSON() failed [up_security]"); + goto end; + } + + OpenAPI_up_security_t *up_security_local_nonprim = NULL; + + up_security_local_nonprim = OpenAPI_up_security_parseFromJSON(up_security); + + cJSON *max_integrity_protected_data_rate_ul = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "maxIntegrityProtectedDataRateUl"); + + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ulVariable; + if (max_integrity_protected_data_rate_ul) { + if (!cJSON_IsString(max_integrity_protected_data_rate_ul)) { + ogs_error("OpenAPI_up_security_info_parseFromJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + max_integrity_protected_data_rate_ulVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_ul->valuestring); + } + + cJSON *max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "maxIntegrityProtectedDataRateDl"); + + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable; + if (max_integrity_protected_data_rate_dl) { + if (!cJSON_IsString(max_integrity_protected_data_rate_dl)) { + ogs_error("OpenAPI_up_security_info_parseFromJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + max_integrity_protected_data_rate_dlVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_dl->valuestring); + } + + cJSON *security_result = cJSON_GetObjectItemCaseSensitive(up_security_infoJSON, "securityResult"); + + OpenAPI_security_result_t *security_result_local_nonprim = NULL; + if (security_result) { + security_result_local_nonprim = OpenAPI_security_result_parseFromJSON(security_result); + } + + up_security_info_local_var = OpenAPI_up_security_info_create ( + up_security_local_nonprim, + max_integrity_protected_data_rate_ul ? max_integrity_protected_data_rate_ulVariable : 0, + max_integrity_protected_data_rate_dl ? max_integrity_protected_data_rate_dlVariable : 0, + security_result ? security_result_local_nonprim : NULL + ); + + return up_security_info_local_var; +end: + return NULL; +} + +OpenAPI_up_security_info_t *OpenAPI_up_security_info_copy(OpenAPI_up_security_info_t *dst, OpenAPI_up_security_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_up_security_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_up_security_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_up_security_info_free(dst); + dst = OpenAPI_up_security_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/up_security_info.h b/lib/sbi/openapi/model/up_security_info.h new file mode 100644 index 000000000..22b8421dd --- /dev/null +++ b/lib/sbi/openapi/model/up_security_info.h @@ -0,0 +1,47 @@ +/* + * up_security_info.h + * + * + */ + +#ifndef _OpenAPI_up_security_info_H_ +#define _OpenAPI_up_security_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "max_integrity_protected_data_rate.h" +#include "security_result.h" +#include "up_security.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_up_security_info_s OpenAPI_up_security_info_t; +typedef struct OpenAPI_up_security_info_s { + struct OpenAPI_up_security_s *up_security; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl; + struct OpenAPI_security_result_s *security_result; +} OpenAPI_up_security_info_t; + +OpenAPI_up_security_info_t *OpenAPI_up_security_info_create( + OpenAPI_up_security_t *up_security, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, + OpenAPI_security_result_t *security_result + ); +void OpenAPI_up_security_info_free(OpenAPI_up_security_info_t *up_security_info); +OpenAPI_up_security_info_t *OpenAPI_up_security_info_parseFromJSON(cJSON *up_security_infoJSON); +cJSON *OpenAPI_up_security_info_convertToJSON(OpenAPI_up_security_info_t *up_security_info); +OpenAPI_up_security_info_t *OpenAPI_up_security_info_copy(OpenAPI_up_security_info_t *dst, OpenAPI_up_security_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_up_security_info_H_ */ + diff --git a/lib/sbi/openapi/model/upf_cond.h b/lib/sbi/openapi/model/upf_cond.h index bf66fd8d6..b4600695e 100644 --- a/lib/sbi/openapi/model/upf_cond.h +++ b/lib/sbi/openapi/model/upf_cond.h @@ -1,7 +1,7 @@ /* * upf_cond.h * - * + * Subscription to a set of NF Instances (UPFs), able to serve a certain service area (i.e. SMF serving area or TAI list) */ #ifndef _OpenAPI_upf_cond_H_ diff --git a/lib/sbi/openapi/model/upf_info.c b/lib/sbi/openapi/model/upf_info.c index eeffd3a18..d5259bb91 100644 --- a/lib/sbi/openapi/model/upf_info.c +++ b/lib/sbi/openapi/model/upf_info.c @@ -17,7 +17,9 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( OpenAPI_tngf_info_t *tngf_info, OpenAPI_twif_info_t *twif_info, int priority, - int redundant_gtpu + int redundant_gtpu, + int ipups, + int data_forwarding ) { OpenAPI_upf_info_t *upf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_upf_info_t)); @@ -37,6 +39,8 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( upf_info_local_var->twif_info = twif_info; upf_info_local_var->priority = priority; upf_info_local_var->redundant_gtpu = redundant_gtpu; + upf_info_local_var->ipups = ipups; + upf_info_local_var->data_forwarding = data_forwarding; return upf_info_local_var; } @@ -254,6 +258,20 @@ cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) } } + if (upf_info->ipups) { + if (cJSON_AddBoolToObject(item, "ipups", upf_info->ipups) == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [ipups]"); + goto end; + } + } + + if (upf_info->data_forwarding) { + if (cJSON_AddBoolToObject(item, "dataForwarding", upf_info->data_forwarding) == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [data_forwarding]"); + goto end; + } + } + end: return item; } @@ -439,6 +457,24 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) } } + cJSON *ipups = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "ipups"); + + if (ipups) { + if (!cJSON_IsBool(ipups)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [ipups]"); + goto end; + } + } + + cJSON *data_forwarding = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "dataForwarding"); + + if (data_forwarding) { + if (!cJSON_IsBool(data_forwarding)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [data_forwarding]"); + goto end; + } + } + upf_info_local_var = OpenAPI_upf_info_create ( s_nssai_upf_info_listList, smf_serving_area ? smf_serving_areaList : NULL, @@ -452,7 +488,9 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) tngf_info ? tngf_info_local_nonprim : NULL, twif_info ? twif_info_local_nonprim : NULL, priority ? priority->valuedouble : 0, - redundant_gtpu ? redundant_gtpu->valueint : 0 + redundant_gtpu ? redundant_gtpu->valueint : 0, + ipups ? ipups->valueint : 0, + data_forwarding ? data_forwarding->valueint : 0 ); return upf_info_local_var; diff --git a/lib/sbi/openapi/model/upf_info.h b/lib/sbi/openapi/model/upf_info.h index c4d7bab1c..f39800a73 100644 --- a/lib/sbi/openapi/model/upf_info.h +++ b/lib/sbi/openapi/model/upf_info.h @@ -40,6 +40,8 @@ typedef struct OpenAPI_upf_info_s { struct OpenAPI_twif_info_s *twif_info; int priority; int redundant_gtpu; + int ipups; + int data_forwarding; } OpenAPI_upf_info_t; OpenAPI_upf_info_t *OpenAPI_upf_info_create( @@ -55,7 +57,9 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( OpenAPI_tngf_info_t *tngf_info, OpenAPI_twif_info_t *twif_info, int priority, - int redundant_gtpu + int redundant_gtpu, + int ipups, + int data_forwarding ); void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info); OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON); diff --git a/lib/sbi/openapi/model/v2x_subscription_data.c b/lib/sbi/openapi/model/v2x_subscription_data.c new file mode 100644 index 000000000..0dc906806 --- /dev/null +++ b/lib/sbi/openapi/model/v2x_subscription_data.c @@ -0,0 +1,173 @@ + +#include +#include +#include +#include "v2x_subscription_data.h" + +OpenAPI_v2x_subscription_data_t *OpenAPI_v2x_subscription_data_create( + 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_v2x_subscription_data_t *v2x_subscription_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_v2x_subscription_data_t)); + if (!v2x_subscription_data_local_var) { + return NULL; + } + v2x_subscription_data_local_var->nr_v2x_services_auth = nr_v2x_services_auth; + v2x_subscription_data_local_var->lte_v2x_services_auth = lte_v2x_services_auth; + v2x_subscription_data_local_var->nr_ue_pc5_ambr = nr_ue_pc5_ambr; + v2x_subscription_data_local_var->lte_pc5_ambr = lte_pc5_ambr; + + return v2x_subscription_data_local_var; +} + +void OpenAPI_v2x_subscription_data_free(OpenAPI_v2x_subscription_data_t *v2x_subscription_data) +{ + if (NULL == v2x_subscription_data) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_nr_v2x_auth_free(v2x_subscription_data->nr_v2x_services_auth); + OpenAPI_lte_v2x_auth_free(v2x_subscription_data->lte_v2x_services_auth); + ogs_free(v2x_subscription_data->nr_ue_pc5_ambr); + ogs_free(v2x_subscription_data->lte_pc5_ambr); + ogs_free(v2x_subscription_data); +} + +cJSON *OpenAPI_v2x_subscription_data_convertToJSON(OpenAPI_v2x_subscription_data_t *v2x_subscription_data) +{ + cJSON *item = NULL; + + if (v2x_subscription_data == NULL) { + ogs_error("OpenAPI_v2x_subscription_data_convertToJSON() failed [V2xSubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (v2x_subscription_data->nr_v2x_services_auth) { + cJSON *nr_v2x_services_auth_local_JSON = OpenAPI_nr_v2x_auth_convertToJSON(v2x_subscription_data->nr_v2x_services_auth); + if (nr_v2x_services_auth_local_JSON == NULL) { + ogs_error("OpenAPI_v2x_subscription_data_convertToJSON() failed [nr_v2x_services_auth]"); + goto end; + } + cJSON_AddItemToObject(item, "nrV2xServicesAuth", nr_v2x_services_auth_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_v2x_subscription_data_convertToJSON() failed [nr_v2x_services_auth]"); + goto end; + } + } + + if (v2x_subscription_data->lte_v2x_services_auth) { + cJSON *lte_v2x_services_auth_local_JSON = OpenAPI_lte_v2x_auth_convertToJSON(v2x_subscription_data->lte_v2x_services_auth); + if (lte_v2x_services_auth_local_JSON == NULL) { + ogs_error("OpenAPI_v2x_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_v2x_subscription_data_convertToJSON() failed [lte_v2x_services_auth]"); + goto end; + } + } + + if (v2x_subscription_data->nr_ue_pc5_ambr) { + if (cJSON_AddStringToObject(item, "nrUePc5Ambr", v2x_subscription_data->nr_ue_pc5_ambr) == NULL) { + ogs_error("OpenAPI_v2x_subscription_data_convertToJSON() failed [nr_ue_pc5_ambr]"); + goto end; + } + } + + if (v2x_subscription_data->lte_pc5_ambr) { + if (cJSON_AddStringToObject(item, "ltePc5Ambr", v2x_subscription_data->lte_pc5_ambr) == NULL) { + ogs_error("OpenAPI_v2x_subscription_data_convertToJSON() failed [lte_pc5_ambr]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_v2x_subscription_data_t *OpenAPI_v2x_subscription_data_parseFromJSON(cJSON *v2x_subscription_dataJSON) +{ + OpenAPI_v2x_subscription_data_t *v2x_subscription_data_local_var = NULL; + cJSON *nr_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(v2x_subscription_dataJSON, "nrV2xServicesAuth"); + + 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(v2x_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(v2x_subscription_dataJSON, "nrUePc5Ambr"); + + if (nr_ue_pc5_ambr) { + if (!cJSON_IsString(nr_ue_pc5_ambr)) { + ogs_error("OpenAPI_v2x_subscription_data_parseFromJSON() failed [nr_ue_pc5_ambr]"); + goto end; + } + } + + cJSON *lte_pc5_ambr = cJSON_GetObjectItemCaseSensitive(v2x_subscription_dataJSON, "ltePc5Ambr"); + + if (lte_pc5_ambr) { + if (!cJSON_IsString(lte_pc5_ambr)) { + ogs_error("OpenAPI_v2x_subscription_data_parseFromJSON() failed [lte_pc5_ambr]"); + goto end; + } + } + + v2x_subscription_data_local_var = OpenAPI_v2x_subscription_data_create ( + 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 + ); + + return v2x_subscription_data_local_var; +end: + return NULL; +} + +OpenAPI_v2x_subscription_data_t *OpenAPI_v2x_subscription_data_copy(OpenAPI_v2x_subscription_data_t *dst, OpenAPI_v2x_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_v2x_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_v2x_subscription_data_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_v2x_subscription_data_free(dst); + dst = OpenAPI_v2x_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/v2x_subscription_data.h b/lib/sbi/openapi/model/v2x_subscription_data.h new file mode 100644 index 000000000..a5b342eb5 --- /dev/null +++ b/lib/sbi/openapi/model/v2x_subscription_data.h @@ -0,0 +1,46 @@ +/* + * v2x_subscription_data.h + * + * + */ + +#ifndef _OpenAPI_v2x_subscription_data_H_ +#define _OpenAPI_v2x_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "lte_v2x_auth.h" +#include "nr_v2x_auth.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_v2x_subscription_data_s OpenAPI_v2x_subscription_data_t; +typedef struct OpenAPI_v2x_subscription_data_s { + 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_v2x_subscription_data_t; + +OpenAPI_v2x_subscription_data_t *OpenAPI_v2x_subscription_data_create( + 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 + ); +void OpenAPI_v2x_subscription_data_free(OpenAPI_v2x_subscription_data_t *v2x_subscription_data); +OpenAPI_v2x_subscription_data_t *OpenAPI_v2x_subscription_data_parseFromJSON(cJSON *v2x_subscription_dataJSON); +cJSON *OpenAPI_v2x_subscription_data_convertToJSON(OpenAPI_v2x_subscription_data_t *v2x_subscription_data); +OpenAPI_v2x_subscription_data_t *OpenAPI_v2x_subscription_data_copy(OpenAPI_v2x_subscription_data_t *dst, OpenAPI_v2x_subscription_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_v2x_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/vsmf_update_data.c b/lib/sbi/openapi/model/vsmf_update_data.c index 54d784f67..17b2ac7ac 100644 --- a/lib/sbi/openapi/model/vsmf_update_data.c +++ b/lib/sbi/openapi/model/vsmf_update_data.c @@ -27,7 +27,9 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( OpenAPI_list_t *dnai_list, OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, - OpenAPI_n4_information_t *n4_info_ext2 + OpenAPI_n4_information_t *n4_info_ext2, + int small_data_rate_control_enabled, + OpenAPI_qos_monitoring_info_t *qos_monitoring_info ) { OpenAPI_vsmf_update_data_t *vsmf_update_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_vsmf_update_data_t)); @@ -57,6 +59,8 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( vsmf_update_data_local_var->n4_info = n4_info; vsmf_update_data_local_var->n4_info_ext1 = n4_info_ext1; vsmf_update_data_local_var->n4_info_ext2 = n4_info_ext2; + vsmf_update_data_local_var->small_data_rate_control_enabled = small_data_rate_control_enabled; + vsmf_update_data_local_var->qos_monitoring_info = qos_monitoring_info; return vsmf_update_data_local_var; } @@ -104,6 +108,7 @@ void OpenAPI_vsmf_update_data_free(OpenAPI_vsmf_update_data_t *vsmf_update_data) OpenAPI_n4_information_free(vsmf_update_data->n4_info); OpenAPI_n4_information_free(vsmf_update_data->n4_info_ext1); OpenAPI_n4_information_free(vsmf_update_data->n4_info_ext2); + OpenAPI_qos_monitoring_info_free(vsmf_update_data->qos_monitoring_info); ogs_free(vsmf_update_data); } @@ -399,6 +404,26 @@ cJSON *OpenAPI_vsmf_update_data_convertToJSON(OpenAPI_vsmf_update_data_t *vsmf_u } } + if (vsmf_update_data->small_data_rate_control_enabled) { + if (cJSON_AddBoolToObject(item, "smallDataRateControlEnabled", vsmf_update_data->small_data_rate_control_enabled) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [small_data_rate_control_enabled]"); + goto end; + } + } + + if (vsmf_update_data->qos_monitoring_info) { + cJSON *qos_monitoring_info_local_JSON = OpenAPI_qos_monitoring_info_convertToJSON(vsmf_update_data->qos_monitoring_info); + if (qos_monitoring_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [qos_monitoring_info]"); + goto end; + } + cJSON_AddItemToObject(item, "qosMonitoringInfo", qos_monitoring_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [qos_monitoring_info]"); + goto end; + } + } + end: return item; } @@ -702,6 +727,22 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); } + cJSON *small_data_rate_control_enabled = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "smallDataRateControlEnabled"); + + if (small_data_rate_control_enabled) { + if (!cJSON_IsBool(small_data_rate_control_enabled)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [small_data_rate_control_enabled]"); + goto end; + } + } + + cJSON *qos_monitoring_info = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "qosMonitoringInfo"); + + OpenAPI_qos_monitoring_info_t *qos_monitoring_info_local_nonprim = NULL; + if (qos_monitoring_info) { + qos_monitoring_info_local_nonprim = OpenAPI_qos_monitoring_info_parseFromJSON(qos_monitoring_info); + } + vsmf_update_data_local_var = OpenAPI_vsmf_update_data_create ( request_indicationVariable, session_ambr ? session_ambr_local_nonprim : NULL, @@ -725,7 +766,9 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u dnai_list ? dnai_listList : NULL, n4_info ? n4_info_local_nonprim : NULL, n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, - n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL, + small_data_rate_control_enabled ? small_data_rate_control_enabled->valueint : 0, + qos_monitoring_info ? qos_monitoring_info_local_nonprim : NULL ); return vsmf_update_data_local_var; diff --git a/lib/sbi/openapi/model/vsmf_update_data.h b/lib/sbi/openapi/model/vsmf_update_data.h index c08c036d8..6506d8b50 100644 --- a/lib/sbi/openapi/model/vsmf_update_data.h +++ b/lib/sbi/openapi/model/vsmf_update_data.h @@ -21,6 +21,7 @@ #include "n4_information.h" #include "qos_flow_add_modify_request_item.h" #include "qos_flow_release_request_item.h" +#include "qos_monitoring_info.h" #include "ref_to_binary_data.h" #include "request_indication.h" #include "tunnel_info.h" @@ -54,6 +55,8 @@ typedef struct OpenAPI_vsmf_update_data_s { struct OpenAPI_n4_information_s *n4_info; struct OpenAPI_n4_information_s *n4_info_ext1; struct OpenAPI_n4_information_s *n4_info_ext2; + int small_data_rate_control_enabled; + struct OpenAPI_qos_monitoring_info_s *qos_monitoring_info; } OpenAPI_vsmf_update_data_t; OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( @@ -79,7 +82,9 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( OpenAPI_list_t *dnai_list, OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, - OpenAPI_n4_information_t *n4_info_ext2 + OpenAPI_n4_information_t *n4_info_ext2, + int small_data_rate_control_enabled, + OpenAPI_qos_monitoring_info_t *qos_monitoring_info ); void OpenAPI_vsmf_update_data_free(OpenAPI_vsmf_update_data_t *vsmf_update_data); OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_update_dataJSON); diff --git a/lib/sbi/path.c b/lib/sbi/path.c index 6d5f3b23c..318ff77e4 100644 --- a/lib/sbi/path.c +++ b/lib/sbi/path.c @@ -20,52 +20,6 @@ #include "ogs-sbi.h" #include "ogs-app.h" -static ogs_sbi_nf_instance_t *find_or_discover_nf_instance( - bool *nrf, bool *nf, - ogs_sbi_xact_t *xact, ogs_fsm_handler_t nf_state_registered) -{ - ogs_sbi_object_t *sbi_object = NULL; - - ogs_assert(nrf); - ogs_assert(nf); - - ogs_assert(xact); - ogs_assert(xact->target_nf_type); - - sbi_object = xact->sbi_object; - ogs_assert(sbi_object); - - ogs_assert(nf_state_registered); - - if (!OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, OpenAPI_nf_type_NRF)) - *nrf = ogs_sbi_nf_instance_associate(sbi_object->nf_type_array, - OpenAPI_nf_type_NRF, nf_state_registered); - if (!OGS_SBI_NF_INSTANCE_GET(sbi_object->nf_type_array, - xact->target_nf_type)) - *nf = ogs_sbi_nf_instance_associate(sbi_object->nf_type_array, - xact->target_nf_type, nf_state_registered); - - if (*nrf == false && *nf == false) { - ogs_error("Cannot discover [%s]", - OpenAPI_nf_type_ToString(xact->target_nf_type)); - return NULL; - } - - if (*nf == false) { - ogs_warn("Try to discover [%s]", - OpenAPI_nf_type_ToString(xact->target_nf_type)); - - ogs_nnrf_disc_send_nf_discover( - sbi_object->nf_type_array[OpenAPI_nf_type_NRF].nf_instance, - xact->target_nf_type, xact); - - return NULL; - } - - return sbi_object->nf_type_array[xact->target_nf_type].nf_instance; -} - void ogs_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_client_cb_f client_cb, ogs_sbi_xact_t *xact) { @@ -119,40 +73,49 @@ void ogs_sbi_send(ogs_sbi_nf_instance_t *nf_instance, bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact, ogs_fsm_handler_t nf_state_registered, ogs_sbi_client_cb_f client_cb) { - bool nrf = true; - bool nf = true; - ogs_sbi_nf_instance_t *nf_instance = NULL; ogs_assert(xact); + ogs_assert(xact->sbi_object); + ogs_assert(xact->target_nf_type); ogs_assert(nf_state_registered); ogs_assert(client_cb); - nf_instance = find_or_discover_nf_instance( - &nrf, &nf, xact, nf_state_registered); - if (nrf == false && nf == false) return false; - if (!nf_instance) return true; - - ogs_sbi_send(nf_instance, client_cb, xact); - - return true; -} - -void ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) -{ - ogs_sbi_request_t *request = NULL; - ogs_sbi_client_t *client = NULL; - - ogs_assert(nf_instance); - client = nf_instance->client; - ogs_assert(client); - - request = ogs_nnrf_nfm_build_register(nf_instance); - if (!request) { - ogs_error("ogs_nnrf_nfm_send_nf_register() failed"); - return; + /* Target NF-Instance */ + nf_instance = OGS_SBI_NF_INSTANCE(xact->sbi_object, xact->target_nf_type); + if (!nf_instance) { + ogs_assert(xact->target_nf_type != OpenAPI_nf_type_NRF); + ogs_sbi_select_first_nf( + xact->sbi_object, xact->target_nf_type, nf_state_registered); + nf_instance = OGS_SBI_NF_INSTANCE( + xact->sbi_object, xact->target_nf_type); } - ogs_sbi_client_send_request(client, client->cb, request, nf_instance); + + if (nf_instance) { + ogs_sbi_send(nf_instance, client_cb, xact); + return true; + } + + /* NRF NF-Instance */ + nf_instance = OGS_SBI_NF_INSTANCE(xact->sbi_object, OpenAPI_nf_type_NRF); + if (!nf_instance) { + ogs_sbi_select_nrf(xact->sbi_object, nf_state_registered); + nf_instance = OGS_SBI_NF_INSTANCE( + xact->sbi_object, OpenAPI_nf_type_NRF); + } + + if (nf_instance) { + ogs_warn("Try to discover [%s]", + OpenAPI_nf_type_ToString(xact->target_nf_type)); + ogs_nnrf_disc_send_nf_discover(nf_instance, xact->target_nf_type, xact); + + return true; + } + + ogs_error("Cannot discover [%s]", + OpenAPI_nf_type_ToString(xact->target_nf_type)); + + return false; } void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance) diff --git a/lib/sbi/path.h b/lib/sbi/path.h index 2fe884016..8e2a8a2b2 100644 --- a/lib/sbi/path.h +++ b/lib/sbi/path.h @@ -31,7 +31,6 @@ void ogs_sbi_send(ogs_sbi_nf_instance_t *nf_instance, bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact, ogs_fsm_handler_t nf_state_registered, ogs_sbi_client_cb_f client_cb); -void ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance); void ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance); diff --git a/lib/sbi/support/generator.sh b/lib/sbi/support/generator.sh index 1b85f563e..981383f30 100755 --- a/lib/sbi/support/generator.sh +++ b/lib/sbi/support/generator.sh @@ -7,6 +7,7 @@ export C_POST_PROCESS_FILE="${HOME}/Documents/git/my/uncrustify/build/uncrustify export UNCRUSTIFY_CONFIG=../openapi/.openapi-generator/uncrustify-0.66.1.cfg openapi_generator_cli="java -jar ${HOME}/Documents/git/my/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" +$openapi_generator_cli generate -i ./modified/TS29531_Nnssf_NSSelection.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi $openapi_generator_cli generate -i ./modified/TS29507_Npcf_AMPolicyControl.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi $openapi_generator_cli generate -i ./modified/TS29512_Npcf_SMPolicyControl.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi $openapi_generator_cli generate -i ./modified/TS29503_Nudm_SDM.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi diff --git a/lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml b/lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml index 9c55d51b8..ef097f30b 100644 --- a/lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml +++ b/lib/sbi/support/modified/TS29502_Nsmf_PDUSession.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.2' title: 'Nsmf_PDUSession' description: | SMF PDU Session Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.502 V16.3.0; 5G System; Session Management Services; Stage 3 + description: 3GPP TS 29.502 V16.6.0; 5G System; Session Management Services; Stage 3 url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.502/ servers: @@ -86,12 +86,36 @@ paths: description: successful notification '307': description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: required: true description: 'A URI pointing to the endpoint of another NF service consumer to which the notification should be sent' schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + required: true + description: 'A URI pointing to the endpoint of another NF service consumer to which the notification should be sent' + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -145,20 +169,36 @@ paths: '307': description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set ' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '308': description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set ' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': description: unsuccessful creation of an SM context - bad request content: @@ -174,6 +214,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -183,6 +226,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '403': description: unsuccessful creation of an SM context - forbidden content: @@ -198,6 +247,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -207,6 +259,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '404': description: unsuccessful creation of an SM context - not found content: @@ -222,6 +280,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -231,14 +292,20 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': - $ref: 'TS29571_CommonData.yaml#/components/responses/413' + $ref: '#/components/responses/413' '415': - $ref: 'TS29571_CommonData.yaml#/components/responses/415' + $ref: '#/components/responses/415' '429': - $ref: 'TS29571_CommonData.yaml#/components/responses/429' + $ref: '#/components/responses/429' '500': description: unsuccessful creation of an SM context - internal server error @@ -255,6 +322,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -264,6 +334,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '503': description: unsuccessful creation of an SM context - service unavailable content: @@ -279,6 +355,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -288,6 +367,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '504': description: unsuccessful creation of an SM context - gateway timeout @@ -304,6 +389,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -313,6 +401,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' @@ -344,6 +438,38 @@ paths: application/json: schema: $ref: '#/components/schemas/SmContextRetrievedData' + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -459,6 +585,38 @@ paths: type: string '204': description: successful update of an SM context without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': description: unsuccessful update of an SM context - bad request content: @@ -561,11 +719,11 @@ paths: '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': - $ref: 'TS29571_CommonData.yaml#/components/responses/413' + $ref: '#/components/responses/413' '415': - $ref: 'TS29571_CommonData.yaml#/components/responses/415' + $ref: '#/components/responses/415' '429': - $ref: 'TS29571_CommonData.yaml#/components/responses/429' + $ref: '#/components/responses/429' '500': description: unsuccessful update of an SM context - Internal server error content: @@ -678,11 +836,43 @@ paths: '200': description: successful release of a PDU session with content in the response content: - application/json: # message without binary body part + application/json: # message without binary body part schema: $ref: '#/components/schemas/SmContextReleasedData' '204': description: successful release of an SM context without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -724,7 +914,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/SendMoDataReqData' binaryMoData: @@ -742,26 +932,58 @@ paths: responses: '204': description: successful sending of MO data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': - $ref: 'TS29571_CommonData.yaml#/components/responses/400' + $ref: '#/components/responses/400' '401': - $ref: 'TS29571_CommonData.yaml#/components/responses/401' + $ref: '#/components/responses/401' '403': - $ref: 'TS29571_CommonData.yaml#/components/responses/403' + $ref: '#/components/responses/403' '404': - $ref: 'TS29571_CommonData.yaml#/components/responses/404' + $ref: '#/components/responses/404' '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': - $ref: 'TS29571_CommonData.yaml#/components/responses/413' + $ref: '#/components/responses/413' '415': - $ref: 'TS29571_CommonData.yaml#/components/responses/415' + $ref: '#/components/responses/415' '429': - $ref: 'TS29571_CommonData.yaml#/components/responses/429' + $ref: '#/components/responses/429' '500': - $ref: 'TS29571_CommonData.yaml#/components/responses/500' + $ref: '#/components/responses/500' '503': - $ref: 'TS29571_CommonData.yaml#/components/responses/503' + $ref: '#/components/responses/503' default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' @@ -818,6 +1040,38 @@ paths: responses: '204': description: successful notificationof the status change + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -850,6 +1104,38 @@ paths: responses: '204': description: successful notificationof the status change + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -886,12 +1172,46 @@ paths: $ref: '#/components/responses/VsmfUpdateResponse200' '204': description: successful update of a PDU session without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/VsmfUpdateError' '403': $ref: '#/components/responses/VsmfUpdateError' '404': $ref: '#/components/responses/VsmfUpdateError' + '409': + $ref: '#/components/responses/VsmfUpdateError' '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': @@ -923,6 +1243,38 @@ paths: $ref: '#/components/responses/VsmfUpdateResponse200' '204': description: successful update of a PDU session without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/VsmfUpdateError' '403': @@ -960,7 +1312,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/TransferMtDataReqData' binaryMtData: @@ -978,6 +1330,38 @@ paths: responses: '204': description: successful transfering of MT data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -1021,7 +1405,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/TransferMtDataReqData' binaryMtData: @@ -1039,6 +1423,38 @@ paths: responses: '204': description: successful transfering of MT data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -1101,20 +1517,32 @@ paths: type: string '307': description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '308': description: permanent redirect headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/PduSessionCreateError' '403': @@ -1264,6 +1692,38 @@ paths: type: string '204': description: successful update of a PDU session without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/HsmfUpdateError' '403': @@ -1299,21 +1759,126 @@ paths: schema: type: string requestBody: - description: representation of the data to be sent to H-SMF or SMF when releasing the PDU session + description: data sent to H-SMF or SMF when releasing the PDU session required: false content: - application/json: + application/json: # message without binary body part schema: $ref: '#/components/schemas/ReleaseData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/ReleaseData' + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + responses: '200': description: successful release of a PDU session with content in the response content: - application/json: # message without binary body part + application/json: # message without binary body part schema: $ref: '#/components/schemas/ReleasedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/ReleasedData' + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string '204': description: successful release of a PDU session + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -1335,6 +1900,88 @@ paths: default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /pdu-sessions/{pduSessionRef}/retrieve: + post: + summary: Retrieve + tags: + - Individual PDU session (H-SMF or SMF) + operationId: RetrievePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the payload of the Retrieve Request + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RetrieveData' + responses: + '200': + description: successful information retrieval + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/RetrievedData' + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + $ref: 'TS29571_CommonData.yaml#/components/responses/504' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /pdu-sessions/{pduSessionRef}/transfer-mo-data: post: summary: Transfer MO Data @@ -1355,7 +2002,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/TransferMoDataReqData' binaryMoData: @@ -1373,6 +2020,38 @@ paths: responses: '204': description: successful transfering of MO data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -1426,6 +2105,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' dnn: $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + selectedDnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' sNssai: $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' hplmnSnssai: @@ -1460,18 +2141,32 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' hSmfUri: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + hSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' smfUri: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' additionalHsmfUri: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 + additionalHsmfId: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 additionalSmfUri: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 + additionalSmfId: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 oldPduSessionId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' pduSessionsActivateList: @@ -1510,6 +2205,8 @@ components: $ref: '#/components/schemas/EpsInterworkingIndication' indirectForwardingFlag: type: boolean + directForwardingFlag: + type: boolean targetId: $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' epsBearerCtxStatus: @@ -1539,6 +2236,14 @@ components: $ref: '#/components/schemas/N2SmInfoType' smContextRef: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smContextSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smContextSmfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + smContextSmfServiceSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' + smContextSmfBinding: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/SbiBindingLevel' upCnxState: $ref: '#/components/schemas/UpCnxState' smallDataRateStatus: @@ -1604,6 +2309,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' supportedFeatures: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + selectedSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + selectedOldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' SmContextUpdateData: type: object @@ -1626,6 +2335,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' additionalAnType: $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + anTypeToReactivate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' ratType: $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' presenceInLadn: @@ -1716,8 +2427,6 @@ components: $ref: '#/components/schemas/ExemptionInd' supportedFeatures: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' extendedNasSmTimerInd: @@ -1791,6 +2500,10 @@ components: items: $ref: '#/components/schemas/ForwardingBearerContainer' minItems: 1 + selectedSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + selectedOldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' SmContextReleaseData: type: object @@ -1838,6 +2551,11 @@ components: ddnFailureStatus: type: boolean default: false + notifyCorrelationIdsForddnFailure: + type: array + items: + type: string + minItems: 1 newSmfId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' newSmfSetId: @@ -1863,6 +2581,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' dnn: $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + selectedDnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' sNssai: $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' vsmfId: @@ -1951,6 +2671,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' guami: $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + maxIntegrityProtectedDataRateUl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' cpCiotEnabled: type: boolean default: false @@ -1985,6 +2709,10 @@ components: dlServingPlmnRateCtl: type: integer minimum: 10 + upSecurityInfo: + $ref: '#/components/schemas/UpSecurityInfo' + vplmnQos: + $ref: '#/components/schemas/VplmnQos' required: - dnn - servingNetwork @@ -2042,6 +2770,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' maxIntegrityProtectedDataRate: $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' alwaysOnGranted: type: boolean default: false @@ -2073,6 +2803,16 @@ components: nefExtBufSupportInd: type: boolean default: false + smallDataRateControlEnabled: + type: boolean + default: false + ueIpv6InterfaceId: + type: string + pattern: '^[A-Fa-f0-9]{16}$' + ipv6Index: + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/IpIndex' + dnAaaAddress: + $ref: '#/components/schemas/IpAddress' required: - pduSessionType - sscMode @@ -2216,12 +2956,14 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' roamingChargingProfile: $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' vplmnQos: $ref: '#/components/schemas/VplmnQos' + securityResult: + $ref: '#/components/schemas/SecurityResult' + upSecurityInfo: + $ref: '#/components/schemas/UpSecurityInfo' required: - requestIndication @@ -2245,6 +2987,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' roamingChargingProfile: $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + maxIntegrityProtectedDataRateUl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' ipv6MultiHomingInd: type: boolean default: false @@ -2274,6 +3022,12 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' minItems: 1 + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' ReleasedData: type: object @@ -2282,6 +3036,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' apnRateStatus: $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' VsmfUpdateData: type: object @@ -2354,6 +3114,10 @@ components: $ref: '#/components/schemas/N4Information' n4InfoExt2: $ref: '#/components/schemas/N4Information' + smallDataRateControlEnabled: + type: boolean + qosMonitoringInfo: + $ref: '#/components/schemas/QosMonitoringInfo' required: - requestIndication @@ -2420,7 +3184,7 @@ components: n4InfoExt1: $ref: '#/components/schemas/N4Information' n4InfoExt2: - $ref: '#/components/schemas/N4Information' + $ref: '#/components/schemas/N4Information' StatusNotification: type: object @@ -2441,6 +3205,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' cause: $ref: '#/components/schemas/Cause' + currentQosProfileIndex: + type: integer + minimum: 1 + maximum: 8 + nullQoSProfileIndex: + type: boolean required: - qfi @@ -2510,6 +3280,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/ReflectiveQoSAttribute' additionalQosFlowInfo: $ref: 'TS29571_CommonData.yaml#/components/schemas/AdditionalQosFlowInfo' + qosMonitoringReq: + $ref: '#/components/schemas/QosMonitoringReq' + qosRepPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' required: - 5qi @@ -2530,6 +3304,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' maxPacketLossRateUl: $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + alternativeQosProfileList: + type: array + items: + $ref: '#/components/schemas/AlternativeQosProfile' required: - maxFbrDl - maxFbrUl @@ -2543,6 +3321,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' notificationCause: $ref: '#/components/schemas/NotificationCause' + currentQosProfileIndex: + type: integer + minimum: 1 + maximum: 8 + nullQoSProfileIndex: + type: boolean required: - qfi - notificationCause @@ -2668,9 +3452,13 @@ components: type: object properties: error: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ExtProblemDetails' n1SmMsg: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' recoveryTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' required: @@ -2680,7 +3468,7 @@ components: type: object properties: error: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ExtProblemDetails' n1SmMsg: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' n2SmInfo: @@ -2760,7 +3548,7 @@ components: n4InfoExt1: $ref: '#/components/schemas/N4Information' n4InfoExt2: - $ref: '#/components/schemas/N4Information' + $ref: '#/components/schemas/N4Information' required: - error @@ -2808,6 +3596,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' smfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pduSessionSmfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + pduSessionSmfServiceSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' + pduSessionSmfBinding: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/SbiBindingLevel' enablePauseCharging: type: boolean default: false @@ -2849,6 +3643,10 @@ components: nefExtBufSupportInd: type: boolean default: false + ipv6Index: + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/IpIndex' + dnAaaAddress: + $ref: '#/components/schemas/IpAddress' required: - pduSessionId - dnn @@ -2921,7 +3719,7 @@ components: $ref: '#/components/schemas/Teid' drbId: $ref: '#/components/schemas/DrbId' - additionalTnlNb: + additionalTnlNb: $ref: '#/components/schemas/AdditionalTnlNb' required: - gtpTeid @@ -2933,8 +3731,6 @@ components: properties: moData: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' ueLocation: @@ -2971,8 +3767,6 @@ components: properties: moData: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' ueLocation: @@ -3023,12 +3817,114 @@ components: ddnFailureSubsInd: type: boolean default: false + ddnFailureSubsInfoList: + type: array + items: + $ref: '#/components/schemas/DdnFailureSubInfo' + minItems: 1 + + DdnFailureSubInfo: + type: object + required: + - notifyCorrelationId + properties: + notifyCorrelationId: + type: string dddTrafficDescriptorList: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' minItems: 1 + RetrieveData: + type: object + properties: + smallDataRateStatusReq: + type: boolean + default: false + + RetrievedData: + type: object + properties: + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + + SecurityResult: + type: object + properties: + integrityProtectionResult: + $ref: '#/components/schemas/ProtectionResult' + confidentialityProtectionResult: + $ref: '#/components/schemas/ProtectionResult' + + UpSecurityInfo: + type: object + properties: + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + maxIntegrityProtectedDataRateUl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + securityResult: + $ref: '#/components/schemas/SecurityResult' + required: + - upSecurity + + AlternativeQosProfile: + type: object + properties: + index: + type: integer + minimum: 1 + maximum: 8 + guaFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + packetDelayBudget: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudget' + packetErrRate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketErrRate' + required: + - index + + ExtProblemDetails: + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + - $ref: '#/components/schemas/ProblemDetailsAddInfo' + + ProblemDetailsAddInfo: + type: object + properties: + remoteError: + type: boolean + + QosMonitoringInfo: + type: object + properties: + qosMonitoringInd: + type: boolean + default: false + + IpAddress: + type: object + oneOf: + - required: + - ipv4Addr + - required: + - ipv6Addr + - required: + - ipv6Prefix + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + ipv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + + # # SIMPLE DATA TYPES # @@ -3050,7 +3946,7 @@ components: Teid: type: string - pattern: '^[A-F0-9]{8}$' + pattern: '^[A-Fa-f0-9]{8}$' EpsBearerContextStatus: type: string @@ -3145,6 +4041,7 @@ components: - NW_REQ_PDU_SES_MOD - NW_REQ_PDU_SES_REL - EBI_ASSIGNMENT_REQ + - REL_DUE_TO_5G_AN_REQUEST type: string # description: > # This string provides forward-compatibility with future @@ -3159,6 +4056,7 @@ components: # - NW_REQ_PDU_SES_MOD # - NW_REQ_PDU_SES_REL # - EBI_ASSIGNMENT_REQ +# - REL_DUE_TO_5G_AN_REQUEST NotificationCause: # anyOf: @@ -3207,7 +4105,8 @@ components: - REL_DUE_TO_SLICE_NOT_AUTHORIZED - PDU_SESSION_HAND_OVER_FAILURE - DDN_FAILURE_STATUS - + - REL_DUE_TO_CP_ONLY_NOT_APPLICABLE + - NOT_SUPPORTED_WITH_ISMF type: string # description: > # This string provides forward-compatibility with future @@ -3238,6 +4137,8 @@ components: # - REL_DUE_TO_SLICE_NOT_AUTHORIZED # - PDU_SESSION_HAND_OVER_FAILURE # - DDN_FAILURE_STATUS +# - REL_DUE_TO_CP_ONLY_NOT_APPLICABLE +# - NOT_SUPPORTED_WITH_ISMF ResourceStatus: # anyOf: @@ -3322,6 +4223,7 @@ components: - HANDOVER_REQ_ACK - HANDOVER_RES_ALLOC_FAIL - SECONDARY_RAT_USAGE + - PDU_RES_MOD_IND_FAIL type: string # description: > # This string provides forward-compatibility with future @@ -3351,6 +4253,7 @@ components: # - HANDOVER_REQ_ACK # - HANDOVER_RES_ALLOC_FAIL # - SECONDARY_RAT_USAGE +# - PDU_RES_MOD_IND_FAIL MaxIntegrityProtectedDataRate: # anyOf: @@ -3478,6 +4381,42 @@ components: # - 3GA_UNAVAILABLE # - N3GA_UNAVAILABLE + ProtectionResult: +# anyOf: +# - type: string + enum: + - PERFORMED + - NOT_PERFORMED + type: string +# description: > +# This string provides forward-compatibility with future +# extensions to the enumeration but is not used to encode +# content defined in the present version of this API. +# description: > +# Possible values are +# - PERFORMED +# - NOT_PERFORMED + + QosMonitoringReq: +# anyOf: +# - type: string + enum: + - UL + - DL + - BOTH + - NONE + type: string +# description: > +# This string provides forward-compatibility with future +# extensions to the enumeration but is not used to encode +# content defined in the present version of this API. +# description: > +# Possible values are +# - UL +# - DL +# - BOTH +# - NONE + # # HTTP request bodies # @@ -3521,7 +4460,7 @@ components: headers: Content-Id: schema: - type: string + type: string binaryDataN4InformationExt1: contentType: application/vnd.3gpp.pfcp headers: @@ -3594,7 +4533,7 @@ components: headers: Content-Id: schema: - type: string + type: string binaryDataN4InformationExt1: contentType: application/vnd.3gpp.pfcp headers: @@ -3718,3 +4657,58 @@ components: Content-Id: schema: type: string + + '400': + description: Bad request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '401': + description: Unauthorized + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '403': + description: Forbidden + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '404': + description: Not Found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '413': + description: Payload Too Large + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '415': + description: Unsupported Media Type + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '429': + description: Too Many Requests + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' diff --git a/lib/sbi/support/modified/TS29503_Nudm_EE.yaml b/lib/sbi/support/modified/TS29503_Nudm_EE.yaml index ca3c0441e..494331891 100644 --- a/lib/sbi/support/modified/TS29503_Nudm_EE.yaml +++ b/lib/sbi/support/modified/TS29503_Nudm_EE.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.1' title: 'Nudm_EE' description: | Nudm Event Exposure Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -172,11 +172,11 @@ paths: application/json: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' - '204': + '204': description: Successful response - '403': + '403': $ref: 'TS29571_CommonData.yaml#/components/responses/403' - '404': + '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: description: Unexpected error @@ -185,8 +185,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-ee: Access to the nudm-ee API @@ -210,6 +210,8 @@ components: items: $ref: '#/components/schemas/MonitoringReport' minItems: 1 + epcStatusInd: + type: boolean EeSubscription: type: object @@ -224,13 +226,24 @@ components: type: object additionalProperties: $ref: '#/components/schemas/MonitoringConfiguration' - minProperties: 1 + minProperties: 1 reportingOptions: $ref: '#/components/schemas/ReportingOptions' supportedFeatures: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' subscriptionId: type: string + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' + epcAppliedInd: + type: boolean + default: false + scefDiamHost: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + scefDiamRealm: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + notifyCorrelationId: + type: string MonitoringConfiguration: @@ -248,6 +261,30 @@ components: $ref: '#/components/schemas/AssociationType' datalinkReportCfg: $ref: '#/components/schemas/DatalinkReportingConfiguration' + lossConnectivityCfg: + $ref: '#/components/schemas/LossConnectivityCfg' + maximumLatency: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + maximumResponseTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + suggestedPacketNumDl: + type: integer + minimum: 1 + pduSessionStatusCfg: + $ref: '#/components/schemas/PduSessionStatusCfg' + reachabilityForSmsCfg: + $ref: '#/components/schemas/ReachabilityForSmsConfiguration' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' + afId: + type: string + + + LossConnectivityCfg: + type: object + properties: + maxDetectionTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' LocationReportingConfiguration: type: object @@ -313,7 +350,8 @@ components: properties: smsfAccessType: $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' - + maxAvailabilityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' ChangeOfSupiPeiAssociationReport: type: object required: @@ -380,6 +418,11 @@ components: required: - newCmInfoList + PduSessionStatusCfg: + type: object + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' # SIMPLE TYPES: @@ -392,6 +435,14 @@ components: # ENUMS: + ReachabilityForSmsConfiguration: + anyOf: + - type: string + enum: + - REACHABILITY_FOR_SMS_OVER_NAS + - REACHABILITY_FOR_SMS_OVER_IP + - type: string + EventType: anyOf: - type: string @@ -445,4 +496,3 @@ components: - PERIODIC - ON_EVENT_DETECTION - type: string - diff --git a/lib/sbi/support/modified/TS29503_Nudm_NIDDAU.yaml b/lib/sbi/support/modified/TS29503_Nudm_NIDDAU.yaml index 62e1fae9f..896275787 100644 --- a/lib/sbi/support/modified/TS29503_Nudm_NIDDAU.yaml +++ b/lib/sbi/support/modified/TS29503_Nudm_NIDDAU.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.0.0.alpha-4' + version: '1.0.1' title: 'Nudm_NIDDAU' description: | Nudm NIDD Authorization Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -158,6 +158,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' authUpdateCallbackUri: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + afId: + type: string # SIMPLE TYPES: diff --git a/lib/sbi/support/modified/TS29503_Nudm_PP.yaml b/lib/sbi/support/modified/TS29503_Nudm_PP.yaml index 8d3d6e6ce..df634e5a0 100644 --- a/lib/sbi/support/modified/TS29503_Nudm_PP.yaml +++ b/lib/sbi/support/modified/TS29503_Nudm_PP.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-3' + version: '1.1.2' title: 'Nudm_PP' description: | Nudm Parameter Provision Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -36,8 +36,10 @@ paths: in: path description: Identifier of the UE required: true - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + schema: + anyOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExtGroupId' - name: supported-features in: query description: Features required to be supported by the target NF @@ -70,14 +72,14 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error - /5g-vn-groups/{external-group-id}: + /5g-vn-groups/{extGroupId}: put: summary: create a 5G VN Group operationId: Create 5G VN Group tags: - 5G VN Group Creation parameters: - - name: external-group-id + - name: extGroupId in: path description: External Identifier of the Group required: true @@ -110,7 +112,7 @@ paths: tags: - 5G VN Group Deletion parameters: - - name: external-group-id + - name: extGroupId in: path description: External Identifier of the Group required: true @@ -137,7 +139,7 @@ paths: tags: - 5G VN Group Modification parameters: - - name: external-group-id + - name: extGroupId in: path description: External Identifier of the group required: true @@ -175,14 +177,45 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error + get: + summary: get 5G VN Group + operationId: Get 5G VN Group + tags: + - 5G VN Group Modification + parameters: + - name: extGroupId + in: path + description: External Identifier of the group + required: true + schema: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExtGroupId' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/5GVnGroupConfiguration' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error -components: +components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-pp: Access to the nudm-pp API @@ -209,6 +242,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/StnSrRm' lcsPrivacy: $ref: '#/components/schemas/LcsPrivacy' + sorInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/SorInfo' CommunicationCharacteristics: type: object @@ -237,11 +272,13 @@ components: subsRegTimer: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true PpActiveTime: @@ -254,11 +291,13 @@ components: activeTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true 5GVnGroupConfiguration: @@ -274,9 +313,11 @@ components: referenceId: $ref: '#/components/schemas/ReferenceId' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string internalGroupIdentifier: $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' 5GVnGroupData: type: object @@ -298,6 +339,10 @@ components: items: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/AppDescriptor' minItems: 1 + secondaryAuth: + type: boolean + dnAaaAddress: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/IpAddress' ExpectedUeBehaviour: type: object @@ -306,7 +351,7 @@ components: - referenceId properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' stationaryIndication: @@ -332,6 +377,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/BatteryIndicationRm' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' LocationArea: type: object @@ -387,7 +434,7 @@ components: - referenceId properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' plmnEcInfos: @@ -395,6 +442,8 @@ components: items: $ref: '#/components/schemas/PlmnEcInfo' minItems: 1 + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' PlmnEcInfo: type: object @@ -403,10 +452,11 @@ components: properties: plmnId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - ecModeARestricted: - type: boolean - ecModeBRestricted: + ecRestrictionDataWb: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/EcRestrictionDataWb' + ecRestrictionDataNb: type: boolean + default: false PpDlPacketCountExt: @@ -416,11 +466,13 @@ components: - referenceId properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true PpMaximumResponseTime: @@ -433,11 +485,13 @@ components: maximumResponseTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true PpMaximumLatency: @@ -450,22 +504,26 @@ components: maximumLatency: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true LcsPrivacy: type: object properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' lpi: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/Lpi' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' # SIMPLE TYPES: diff --git a/lib/sbi/support/modified/TS29503_Nudm_SDM.yaml b/lib/sbi/support/modified/TS29503_Nudm_SDM.yaml index 0f16f5250..3216b9df1 100644 --- a/lib/sbi/support/modified/TS29503_Nudm_SDM.yaml +++ b/lib/sbi/support/modified/TS29503_Nudm_SDM.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '2.1.0.alpha-4' + version: '2.1.2' title: 'Nudm_SDM' description: | Nudm Subscriber Data Management Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -60,12 +60,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -81,11 +81,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -125,12 +125,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -142,15 +142,15 @@ paths: $ref: '#/components/schemas/Nssai' headers: Cache-Control: - description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -163,6 +163,41 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error + /{supi}/ue-context-in-amf-data: + get: + summary: retrieve a UE's UE Context In AMF Data + operationId: GetUeCtxInAmfData + tags: + - UE Context In AMF Data Retrieval + parameters: + - name: supi + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextInAmfData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error /{supi}/am-data: get: summary: retrieve a UE's Access and Mobility Subscription Data @@ -190,12 +225,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -211,11 +246,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -248,12 +283,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -269,11 +304,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -313,12 +348,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -334,11 +369,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -448,12 +483,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -469,11 +504,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -522,12 +557,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -546,11 +581,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -589,12 +624,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -610,11 +645,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -653,12 +688,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -674,11 +709,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -711,12 +746,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -732,11 +767,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -768,20 +803,14 @@ paths: description: Supported Features schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - - name: plmn-id - in: query - content: - application/json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -797,11 +826,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -814,6 +843,130 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error + /{supi}/lcs-bca-data: + get: + summary: retrieve a UE's LCS Broadcast Assistance Data Types Subscription Data + operationId: GetLcsBcaData + tags: + - LCS Broadcast Assistance Data Types Retrieval + parameters: + - name: supi + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: plmn-id + in: query + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + + /{supi}/v2x-data: + get: + summary: retrieve a UE's V2X Subscription Data + operationId: GetV2xData + tags: + - V2X Subscription Data Retrieval + parameters: + - name: supi + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/V2xSubscriptionData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /{ueId}/sdm-subscriptions: post: summary: subscribe to notifications @@ -883,6 +1036,10 @@ paths: required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '308': description: Permanent Redirect content: @@ -895,6 +1052,10 @@ paths: required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -1014,12 +1175,12 @@ paths: $ref: '#/components/schemas/AppPortId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -1035,11 +1196,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -1225,12 +1386,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -1249,11 +1410,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -1310,6 +1471,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -1329,7 +1522,7 @@ paths: parameters: - name: subscriptionId in: path - description: Id of the Shared data Subscription + description: Id of the Shared data Subscription required: true schema: type: string @@ -1424,12 +1617,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -1445,11 +1638,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -1467,8 +1660,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-sdm: Access to the nudm-sdm API @@ -1479,7 +1672,7 @@ components: DatasetNames: type: array - items: + items: $ref: '#/components/schemas/DataSetName' minItems: 2 uniqueItems: true @@ -1491,6 +1684,8 @@ components: $ref: '#/components/schemas/AccessAndMobilitySubscriptionData' smfSelData: $ref: '#/components/schemas/SmfSelectionSubscriptionData' + uecAmfData: + $ref: '#/components/schemas/UeContextInAmfData' uecSmfData: $ref: '#/components/schemas/UeContextInSmfData' uecSmsfData: @@ -1510,6 +1705,10 @@ components: $ref: '#/components/schemas/LcsPrivacyData' lcsMoData: $ref: '#/components/schemas/LcsMoData' + v2xData: + $ref: '#/components/schemas/V2xSubscriptionData' + lcsBroadcastAssistanceTypesData: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' UeContextInSmsfData: type: object @@ -1544,11 +1743,6 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' minItems: 1 - vnGroupInfo: - type: object - additionalProperties: - $ref: '#/components/schemas/VnGroupData' - minProperties: 1 sharedVnGroupDataIds: type: object additionalProperties: @@ -1584,8 +1778,6 @@ components: $ref: '#/components/schemas/McsPriorityIndicator' activeTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' - dlPacketCount: - $ref: '#/components/schemas/DlPacketCount' sorInfo: $ref: '#/components/schemas/SorInfo' sorInfoExpectInd: @@ -1602,7 +1794,7 @@ components: $ref: '#/components/schemas/UpuInfo' micoAllowed: $ref: '#/components/schemas/MicoAllowed' - sharedAmDataIds: + sharedAmDataIds: type: array items: $ref: '#/components/schemas/SharedDataId' @@ -1618,6 +1810,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' serviceGapTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + mdtUserConsent: + $ref: '#/components/schemas/MdtUserConsent' + mdtConfiguration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MdtConfiguration' traceData: $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' cagData: @@ -1633,22 +1829,13 @@ components: default: false rgWirelineCharacteristics: $ref: 'TS29571_CommonData.yaml#/components/schemas/RgWirelineCharacteristics' - rgTMBR: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Tmbr' - ecRestrictionData: - $ref: '#/components/schemas/EcRestrictionData' + ecRestrictionDataWb: + $ref: '#/components/schemas/EcRestrictionDataWb' + ecRestrictionDataNb: + type: boolean + default: false expectedUeBehaviourList: $ref: '#/components/schemas/ExpectedUeBehaviourData' - maximumResponseTimeList: - type: array - items: - $ref: '#/components/schemas/MaximumResponseTime' - minItems: 1 - maximumLatencyList: - type: array - items: - $ref: '#/components/schemas/MaximumLatency' - minItems: 1 primaryRatRestrictions: type: array items: @@ -1670,14 +1857,12 @@ components: iabOperationAllowed: type: boolean default: false - nrV2xServicesAuth: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NrV2xAuth' - lteV2xServicesAuth: - $ref: 'TS29571_CommonData.yaml#/components/schemas/LteV2xAuth' - nrUePc5Ambr: - $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' - ltePc5Ambr: - $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + wirelineForbiddenAreas: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineArea' + wirelineServiceAreaRestriction: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' CagData: type: object @@ -1745,6 +1930,15 @@ components: $ref: '#/components/schemas/IwkEpsInd' dnnBarred: type: boolean + invokeNefInd: + type: boolean + smfList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + sameSmfInd: + type: boolean Nssai: type: object @@ -1772,6 +1966,12 @@ components: minProperties: 1 nullable: true + UeContextInAmfData: + type: object + properties: + epsInterworkingInfo: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/EpsInterworkingInfo' + UeContextInSmfData: type: object properties: @@ -1802,6 +2002,9 @@ components: $ref: '#/components/schemas/IpAddress' smfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + epdgInd: + type: boolean + default: false PduSession: @@ -1817,6 +2020,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' plmnId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + singleNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' PgwInfo: type: object @@ -1830,6 +2035,9 @@ components: type: string plmnId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + epdgInd: + type: boolean + default: false SessionManagementSubscriptionData: type: object @@ -1848,11 +2056,6 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' minItems: 1 - vnGroupInfo: - type: object - additionalProperties: - $ref: '#/components/schemas/VnGroupData' - minProperties: 1 sharedVnGroupDataIds: type: object additionalProperties: @@ -1907,8 +2110,6 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' pduSessionContinuityInd: $ref: '#/components/schemas/PduSessionContinuityInd' - invokeNefSelection: - type: boolean niddNefId: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NefId' niddInfo: @@ -1930,6 +2131,12 @@ components: atsssAllowed: type: boolean default: false + secondaryAuth: + type: boolean + dnAaaIpAddressAllocation: + type: boolean + dnAaaAddress: + $ref: '#/components/schemas/IpAddress' NiddInformation: type: object @@ -2039,7 +2246,7 @@ components: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' monitoredResourceUris: type: array - items: + items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 singleNssai: @@ -2055,6 +2262,10 @@ components: default: false report: $ref: '#/components/schemas/SubscriptionDataSets' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + contextInfo: + $ref: '#/components/schemas/ContextInfo' SdmSubsModification: type: object @@ -2063,7 +2274,7 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' monitoredResourceUris: type: array - items: + items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 @@ -2123,7 +2334,7 @@ components: SharedDataIds: type: array - items: + items: $ref: '#/components/schemas/SharedDataId' minItems: 1 uniqueItems: true @@ -2131,9 +2342,9 @@ components: UpuInfo: type: object properties: - upuDataList: + upuDataList: type: array - items: + items: $ref: 'TS29509_Nausf_UPUProtection.yaml#/components/schemas/UpuData' minItems: 1 upuRegInd: @@ -2146,7 +2357,7 @@ components: $ref: 'TS29509_Nausf_UPUProtection.yaml#/components/schemas/CounterUpu' provisioningTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - required: + required: - upuDataList - upuAckInd - upuRegInd @@ -2230,7 +2441,7 @@ components: type: object properties: osId: - $ref: 'TS29519_Policy_Data.yaml#/components/schemas/OsId' + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/OsId' appId: type: string @@ -2253,11 +2464,8 @@ components: properties: lpi: $ref: '#/components/schemas/Lpi' - unrelatedClasses: - type: array - items: - $ref: '#/components/schemas/UnrelatedClass' - minItems: 1 + unrelatedClass: + $ref: '#/components/schemas/UnrelatedClass' plmnOperatorClasses: type: array items: @@ -2277,10 +2485,10 @@ components: UnrelatedClass: type: object required: - - nonExternalUnrelatedClass + - defaultUnrelatedClass properties: - nonExternalUnrelatedClass: - $ref: '#/components/schemas/NonExternalUnrelatedClass' + defaultUnrelatedClass: + $ref: '#/components/schemas/DefaultUnrelatedClass' externalUnrelatedClass: $ref: '#/components/schemas/ExternalUnrelatedClass' serviceTypeUnrelatedClasses: @@ -2311,57 +2519,6 @@ components: endTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - NonExternalUnrelatedClass: - properties: - lcsClientNonExternals: - type: array - items: - $ref: '#/components/schemas/LcsClientNonExternal' - minItems: 1 - afNonExternals: - type: array - items: - $ref: '#/components/schemas/AfNonExternal' - minItems: 1 - - LcsClientNonExternal: - type: object - required: - - lcsClientId - properties: - lcsClientId: - $ref: '#/components/schemas/LcsClientId' - allowedGeographicArea: - type: array - items: - $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' - minItems: 1 - privacyCheckRelatedAction: - $ref: '#/components/schemas/PrivacyCheckRelatedAction' - codeWordInd: - $ref: '#/components/schemas/CodeWordInd' - validTimePeriod: - $ref: '#/components/schemas/ValidTimePeriod' - - AfNonExternal: - type: object - required: - - afId - properties: - afId: - type: string - allowedGeographicArea: - type: array - items: - $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' - minItems: 1 - privacyCheckRelatedAction: - $ref: '#/components/schemas/PrivacyCheckRelatedAction' - codeWordInd: - $ref: '#/components/schemas/CodeWordInd' - validTimePeriod: - $ref: '#/components/schemas/ValidTimePeriod' - ExternalUnrelatedClass: properties: lcsClientExternals: @@ -2384,7 +2541,7 @@ components: type: object properties: afId: - type: string + $ref: '#/components/schemas/AfId' allowedGeographicArea: type: array items: @@ -2412,7 +2569,7 @@ components: type: object properties: lcsClientGroupId: - $ref: '#/components/schemas/ExtGroupId' + $ref: '#/components/schemas/ExtGroupId' allowedGeographicArea: type: array items: @@ -2441,6 +2598,11 @@ components: $ref: '#/components/schemas/CodeWordInd' validTimePeriod: $ref: '#/components/schemas/ValidTimePeriod' + codeWordList: + type: array + items: + $ref: '#/components/schemas/CodeWord' + minItems: 1 LcsMoData: type: object @@ -2453,8 +2615,22 @@ components: $ref: '#/components/schemas/LcsMoServiceClass' minItems: 1 - EcRestrictionData: + LcsBroadcastAssistanceTypesData: type: object + required: + - locationAssistanceType + properties: + locationAssistanceType: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Binary' + minItems: 1 + + EcRestrictionDataWb: + type: object + anyOf: + - required: [ ecModeARestricted ] + - required: [ ecModeBRestricted ] properties: ecModeARestricted: type: boolean @@ -2487,33 +2663,6 @@ components: validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - MaximumResponseTime: - type: object - required: - - maximumResponseTime - properties: - maximumResponseTime: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' - snssai: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' - dnn: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' - validityTime: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - - MaximumLatency: - type: object - required: - - maximumLatency - properties: - maximumLatency: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' - snssai: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' - dnn: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' - validityTime: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' SuggestedPacketNumDl: type: object @@ -2588,6 +2737,47 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' minItems: 1 + V2xSubscriptionData: + type: object + properties: + nrV2xServicesAuth: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NrV2xAuth' + lteV2xServicesAuth: + $ref: 'TS29571_CommonData.yaml#/components/schemas/LteV2xAuth' + nrUePc5Ambr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + ltePc5Ambr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + + DefaultUnrelatedClass: + type: object + properties: + allowedGeographicArea: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + minItems: 1 + privacyCheckRelatedAction: + $ref: '#/components/schemas/PrivacyCheckRelatedAction' + codeWordInd: + $ref: '#/components/schemas/CodeWordInd' + validTimePeriod: + $ref: '#/components/schemas/ValidTimePeriod' + codeWordList: + type: array + items: + $ref: '#/components/schemas/CodeWord' + minItems: 1 + + ContextInfo: + type: object + properties: + origHeaders: + type: array + items: + type: string + minItems: 1 + # SIMPLE TYPES: UeUsageType: @@ -2638,6 +2828,8 @@ components: NbIoTUePriority: type: integer + minimum: 0 + maximum: 255 CodeWord: type: string @@ -2666,6 +2858,8 @@ components: - SMS_MNG - LCS_PRIVACY - LCS_MO + - UEC_AMF + - V2X type: string PduSessionContinuityInd: @@ -2742,3 +2936,10 @@ components: - CODEWORD_CHECK_IN_GMLC type: string + MdtUserConsent: +# anyOf: +# - type: string + enum: + - CONSENT_NOT_GIVEN + - CONSENT_GIVEN + type: string diff --git a/lib/sbi/support/modified/TS29503_Nudm_UEAU.yaml b/lib/sbi/support/modified/TS29503_Nudm_UEAU.yaml index 8de5fde8e..32241210b 100644 --- a/lib/sbi/support/modified/TS29503_Nudm_UEAU.yaml +++ b/lib/sbi/support/modified/TS29503_Nudm_UEAU.yaml @@ -1,14 +1,14 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-2' - title: 'NudmUEAU' + version: '1.1.2' + title: 'Nudm_UEAU' description: | UDM UE Authentication Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -98,12 +98,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -169,12 +169,12 @@ paths: default: description: Unexpected error - /{supi}/hss-security-information/generate-av: + /{supi}/hss-security-information/{hssAuthType}/generate-av: post: summary: Generate authentication data for the UE in EPS or IMS domain operationId: GenerateAv tags: - - Generate HSS Authentication Vectors + - Generate HSS Authentication Vectors parameters: - name: supi in: path @@ -182,6 +182,12 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: hssAuthType + in: path + description: Type of AV requested by HSS + required: true + schema: + $ref: '#/components/schemas/HssAuthTypeInUri' requestBody: content: application/json: @@ -197,6 +203,8 @@ paths: $ref: '#/components/schemas/HssAuthenticationInfoResult' '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' '500': @@ -209,7 +217,7 @@ paths: description: Unexpected error /{supi}/auth-events/{authEventId}: - delete: + put: summary: Deletes the authentication result in the UDM operationId: DeleteAuth tags: @@ -227,6 +235,12 @@ paths: required: true schema: type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthEvent' + required: true responses: '204': description: Expected response to a successful authentication result removal @@ -245,8 +259,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-ueau: Access to the nudm-ueau API @@ -270,8 +284,15 @@ components: $ref: '#/components/schemas/ResynchronizationInfo' ausfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' - cagId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/CagId' + cellCagInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CagId' + minItems: 1 + n5gcInd: + type: boolean + default: false + AuthenticationInfoResult: type: object required: @@ -292,7 +313,7 @@ components: - $ref: '#/components/schemas/Av5GHeAka' discriminator: propertyName: avType - mapping: + mapping: 5G_HE_AKA: '#/components/schemas/Av5GHeAka' EAP_AKA_PRIME: '#/components/schemas/AvEapAkaPrime' @@ -369,6 +390,9 @@ components: $ref: '#/components/schemas/AuthType' servingNetworkName: $ref: '#/components/schemas/ServingNetworkName' + authRemovalInd: + type: boolean + default: false RgAuthCtx: type: object @@ -395,11 +419,16 @@ components: $ref: '#/components/schemas/HssAuthType' numOfRequestedVectors: $ref: '#/components/schemas/NumOfRequestedVectors' + requestingNodeType: + $ref: '#/components/schemas/NodeType' servingNetworkId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' resynchronizationInfo: $ref: '#/components/schemas/ResynchronizationInfo' - + anId: + $ref: '#/components/schemas/AccessNetworkId' + + HssAuthenticationInfoResult: type: object required: @@ -554,23 +583,60 @@ components: type: string HssAuthType: - anyOf: - - type: string +# anyOf: +# - type: string enum: - EPS_AKA - EAP_AKA - EAP_AKA_PRIME - IMS_AKA - GBA_AKA - - type: string + - UMTS_AKA + type: string HssAvType: - anyOf: - - type: string +# anyOf: +# - type: string enum: - EPS_AKA - EAP_AKA - IMS_AKA - GBA_AKA - - type: string + - UMTS_AKA + type: string + + HssAuthTypeInUri: +# anyOf: +# - type: string + enum: + - eps-aka + - eap-aka + - eap-aka-prime + - ims-aka + - gba-aka + type: string + + AccessNetworkId: +# anyOf: +# - type: string + enum: + - HRPD + - WIMAX + - WLAN + - ETHERNET + type: string + + NodeType: +# anyOf: +# - type: string + enum: + - AUSF + - VLR + - SGSN + - S_CSCF + - BSF + - GAN_AAA_SERVER + - WLAN_AAA_SERVER + - MME + type: string diff --git a/lib/sbi/support/modified/TS29503_Nudm_UECM.yaml b/lib/sbi/support/modified/TS29503_Nudm_UECM.yaml index 911534d1d..f34a30877 100644 --- a/lib/sbi/support/modified/TS29503_Nudm_UECM.yaml +++ b/lib/sbi/support/modified/TS29503_Nudm_UECM.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-3' + version: '1.1.2' title: 'Nudm_UECM' description: | Nudm Context Management Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -25,6 +25,61 @@ security: - {} paths: + /{ueId}/registrations: + get: + summary: retrieve UE registration data sets + operationId: GetRegistrations + tags: + - UECM Registration Info Retrieval + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: supported-features + in: query + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: registration-dataset-names + in: query + style: form + explode: false + description: List of UECM registration dataset names + required: true + schema: + $ref: '#/components/schemas/RegistrationDatasetNames' + - name: single-nssai + in: query + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + - name: dnn + in: query + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/RegistrationDataSets' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /{ueId}/registrations/amf-3gpp-access: put: summary: register as AMF for 3GPP access @@ -90,6 +145,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -112,10 +199,44 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '409': + $ref: 'TS29571_CommonData.yaml#/components/responses/409' '500': $ref: 'TS29571_CommonData.yaml#/components/responses/500' '503': @@ -344,6 +465,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -366,6 +519,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -580,6 +765,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -602,6 +819,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -937,6 +1186,115 @@ paths: default: description: Unexpected error + /{ueId}/registrations/ip-sm-gw: + put: + summary: Register an IP-SM-GW + operationId: IpSmGwRegistration + tags: + - IP-SM-GW registration + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + required: true + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudm-uecm/v1/{ueId}/registrations/ip-sm-gw' + required: true + schema: + type: string + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + delete: + summary: Delete the IP-SM-GW registration + operationId: IpSmGwDeregistration + tags: + - IP-SM-GW Deregistration + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + responses: + '204': + description: Expected response to a valid request + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + get: + summary: Retrieve the IP-SM-GW registration information + operationId: GetIpSmGwRegistration + tags: + - IP-SM-GW Registration Info Retrieval + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /restore-pcscf: post: summary: Trigger the Restoration of the P-CSCF @@ -967,9 +1325,9 @@ paths: default: description: Unexpected error - /{ueId}/registrations/loation: + /{ueId}/registrations/location: get: - summary: retrieve the target UE’s location information + summary: retrieve the target UE's location information operationId: GetLocationInfo tags: - UE Location Information retrieval @@ -1009,8 +1367,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-uecm: Access to the nudm-uecm API @@ -1062,20 +1420,19 @@ components: type: boolean amfEeSubscriptionId: type: string -# epsInterworkingInfo: -# $ref: '#/components/schemas/EpsInterworkingInfo' + epsInterworkingInfo: + $ref: '#/components/schemas/EpsInterworkingInfo' ueSrvccCapability: type: boolean - nid: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Nid' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - vgmlcAddressIpv4: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' - vgmlcAddressIpv6: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' - vgmlcFqdn: - $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + vgmlcAddress: + $ref: '#/components/schemas/VgmlcAddress' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' + noEeSubscriptionInd: + type: boolean + default: false Amf3GppAccessRegistrationModification: @@ -1100,6 +1457,9 @@ components: ueSrvccCapability: type: boolean nullable: true + noEeSubscriptionInd: + type: boolean + default: false EpsInterworkingInfo: type: object @@ -1108,7 +1468,7 @@ components: description: A map (list of key-value pairs where Dnn serves as key) of EpsIwkPgws type: object additionalProperties: - $ref: '#components/schemas/EpsIwkPgw' + $ref: '#/components/schemas/EpsIwkPgw' EpsIwkPgw: type: object @@ -1161,17 +1521,12 @@ components: type: boolean amfEeSubscriptionId: type: string - nid: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Nid' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - vgmlcAddressIpv4: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' - vgmlcAddressIpv6: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' - vgmlcFqdn: - $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' - + vgmlcAddress: + $ref: '#/components/schemas/VgmlcAddress' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' AmfNon3GppAccessRegistrationModification: type: object @@ -1228,6 +1583,8 @@ components: $ref: '#/components/schemas/RegistrationReason' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' SmsfRegistration: type: object @@ -1249,12 +1606,14 @@ components: $ref: '#/components/schemas/NetworkNodeDiameterAddress' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' + DeregistrationData: type: object required: - deregReason - - accessType properties: deregReason: $ref: '#/components/schemas/DeregistrationReason' @@ -1303,6 +1662,21 @@ components: $ref: '#/components/schemas/SmfRegistration' minItems: 1 + IpSmGwRegistration: + type: object + anyOf: + - required: [ ipSmGwMapAddress ] + - required: [ ipSmGwDiameterAddress ] + properties: + ipSmGwMapAddress: + $ref: '#/components/schemas/E164Number' + ipSmGwDiameterAddress: + $ref: '#/components/schemas/NetworkNodeDiameterAddress' + unriIndicator: + type: boolean + default: false + + AmfDeregInfo: type: object required: @@ -1331,22 +1705,20 @@ components: RegistrationLocationInfo: type: object - - CmInfoReport: - type: object required: - - newCmInfoList + - amfInstanceId + - accessTypeList properties: - oldCmInfoList: + amfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + vgmlcAddress: + $ref: '#/components/schemas/VgmlcAddress' + accessTypeList: type: array items: - $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/CmInfo' - minItems: 1 - maxItems: 2 - newCmInfoList: - type: array - items: - $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/CmInfo' + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' minItems: 1 maxItems: 2 @@ -1368,6 +1740,27 @@ components: pei: $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + RegistrationDatasetNames: + type: array + items: + $ref: '#/components/schemas/RegistrationDataSetName' + minItems: 2 + uniqueItems: true + + RegistrationDataSets: + type: object + properties: + amf3Gpp: + $ref: '#/components/schemas/Amf3GppAccessRegistration' + amfNon3Gpp: + $ref: '#/components/schemas/AmfNon3GppAccessRegistration' + smfRegistration: + $ref: '#/components/schemas/SmfRegistrationInfo' + smsf3Gpp: + $ref: '#/components/schemas/SmsfRegistration' + smsfNon3Gpp: + $ref: '#/components/schemas/SmsfRegistration' + # SIMPLE TYPES: @@ -1403,7 +1796,7 @@ components: - 5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION - REREGISTRATION_REQUIRED - SMF_CONTEXT_TRANSFERRED - - type: string + - type: string RegistrationReason: anyOf: @@ -1412,3 +1805,14 @@ components: - SMF_CONTEXT_TRANSFERRED - type: string + RegistrationDataSetName: + anyOf: + - type: string + enum: + - AMF_3GPP + - AMF_NON_3GPP + - SMF_PDU_SESSIONS + - SMSF_3GPP + - SMSF_NON_3GPP + - type: string + diff --git a/lib/sbi/support/modified/TS29504_Nudr_DR.yaml b/lib/sbi/support/modified/TS29504_Nudr_DR.yaml index 92231b905..a3ee47b58 100644 --- a/lib/sbi/support/modified/TS29504_Nudr_DR.yaml +++ b/lib/sbi/support/modified/TS29504_Nudr_DR.yaml @@ -1,7 +1,7 @@ -openapi: 3.0.0 +openapi: 3.0.0 info: - version: 2.1.0.alpha-4 + version: 2.1.2 title: 'Nudr_DataRepository API OpenAPI file' description: | Unified Data Repository Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.504 V16.3.0; 5G System; Unified Data Repository Services; Stage 3 + description: 3GPP TS 29.504 V16.6.0; 5G System; Unified Data Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.504/' servers: @@ -45,6 +45,8 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1smf-selection-subscription-data' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sm-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1sm-data' + /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-bca-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1lcs-bca-data' /subscription-data/{ueId}/context-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data' /subscription-data/{ueId}/context-data/amf-3gpp-access: @@ -61,14 +63,20 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1smsf-3gpp-access' /subscription-data/{ueId}/context-data/smsf-non-3gpp-access: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1smsf-non-3gpp-access' + /subscription-data/{ueId}/context-data/location: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1location' + /subscription-data/{ueId}/context-data/ip-sm-gw: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1ip-sm-gw' + /subscription-data/{ueId}/context-data/mwd: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1mwd' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-mng-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1sms-mng-data' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1sms-data' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-privacy-data: - $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1lcs-privacy-data' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-mo-data: - $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1lcs-mo-data' + /subscription-data/{ueId}/lcs-privacy-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1lcs-privacy-data' + /subscription-data/{ueId}/lcs-mo-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1lcs-mo-data' /subscription-data/{ueId}/pp-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1pp-data' /subscription-data/{ueId}/context-data/ee-subscriptions: @@ -85,6 +93,8 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~15g-vn-groups' /subscription-data/group-data/5g-vn-groups/{externalGroupId}: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~15g-vn-groups~1%7BexternalGroupId%7D' + /subscription-data/group-data/5g-vn-groups/internal: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~15g-vn-groups~1internal' /subscription-data/{ueId}/ee-profile-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1ee-profile-data' /subscription-data/{ueId}/context-data/sdm-subscriptions: @@ -105,6 +115,10 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1operator-determined-barring-data' /subscription-data/{ueId}/nidd-authorization-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1nidd-authorization-data' + /subscription-data/{ueId}/v2x-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1v2x-data' + /subscription-data/{ueId}/coverage-restriction-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1coverage-restriction-data' /subscription-data/group-data/group-identifiers: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~1group-identifiers' /policy-data/ues/{ueId}/am-data: @@ -170,3 +184,5 @@ components: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudr-dr: Access to the Nudr_DataRepository API + nudr-dr:subscription-data:authentication-subscription:read: Access to read the AuthenticationSubscription resource of the SubscriptionData data set + nudr-dr:subscription-data:authentication-subscription:modify: Access to update the AuthenticationSubscription resource of the SubscriptionData data set diff --git a/lib/sbi/support/modified/TS29505_Subscription_Data.yaml b/lib/sbi/support/modified/TS29505_Subscription_Data.yaml index 6438ea68f..849c3fb3c 100644 --- a/lib/sbi/support/modified/TS29505_Subscription_Data.yaml +++ b/lib/sbi/support/modified/TS29505_Subscription_Data.yaml @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.505 V16.2.0; 5G System; Usage of the Unified Data Repository Service for subscription data; Stage 3 + description: 3GPP TS 29.505 V16.5.0; 5G System; Usage of the Unified Data Repository Service for subscription data; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.505/' paths: @@ -20,13 +20,20 @@ paths: operationId: QueryAuthSubsData tags: - Authentication Data (Document) + security: + - {} + - oAuth2ClientCredentials: + - nudr-dr + - oAuth2ClientCredentials: + - nudr-dr + - nudr-dr:subscription-data:authentication-subscription:read parameters: - name: ueId in: path description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -40,23 +47,27 @@ paths: schema: $ref: '#/components/schemas/AuthenticationSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the authentication subscription data of a UE operationId: ModifyAuthenticationSubscription tags: - Authentication Subscription (Document) + security: + - {} + - oAuth2ClientCredentials: + - nudr-dr + - oAuth2ClientCredentials: + - nudr-dr + - nudr-dr:subscription-data:authentication-subscription:modify parameters: - name: ueId in: path description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Features required to be supported by the target NF @@ -86,11 +97,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/authentication-data/authentication-status: put: @@ -104,7 +111,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' requestBody: content: application/json: @@ -114,11 +121,7 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieves the Authentication Status of a UE @@ -131,7 +134,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: fields in: query description: attributes to be retrieved @@ -156,11 +159,7 @@ paths: schema: $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/AuthEvent' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' delete: summary: To remove the Authentication Status of a UE @@ -173,16 +172,110 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' responses: '204': description: Upon success, an empty response body shall be returned. default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/authentication-data/authentication-status/{servingNetworkName}: + put: + summary: To store the individual Authentication Status data of a UE + operationId: CreateIndividualAuthenticationStatus + tags: + - Individual Authentication Status (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: servingNetworkName + in: path + description: Serving Network Name + required: true + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + requestBody: + content: + application/json: + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/AuthEvent' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + get: + summary: Retrieves the Individual Authentication Status of a UE + operationId: QueryIndividualAuthenticationStatus + tags: + - Individual AuthEvent (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: servingNetworkName + in: path + description: Serving Network Name + required: true + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: supported-features + description: Supported Features + in: query + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/AuthEvent' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + delete: + summary: To remove the Individual Authentication Status of a UE + operationId: DeleteIndividualAuthenticationStatus + tags: + - Individual AuthEvent (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: servingNetworkName + in: path + description: Serving Network Name + required: true + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + responses: + '204': + description: Upon success, an empty response body shall be returned. + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/sor-data: put: @@ -196,7 +289,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -211,11 +304,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the SoR acknowledgement information of a UE operationId: QueryAuthSoR @@ -227,7 +317,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supportedFeatures in: query description: Supported Features @@ -241,11 +331,7 @@ paths: schema: $ref: '#/components/schemas/SorData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/upu-data: put: @@ -259,7 +345,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -274,11 +360,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the UPU acknowledgement information of a UE operationId: QueryAuthUPU @@ -290,7 +373,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supportedFeatures in: query description: Supported Features @@ -304,11 +387,7 @@ paths: schema: $ref: '#/components/schemas/UpuData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/subscribed-snssais: put: @@ -322,7 +401,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -337,11 +416,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the UPU acknowledgement information of a UE operationId: QueryNssaiAck @@ -353,7 +429,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supportedFeatures in: query description: Supported Features @@ -367,11 +443,7 @@ paths: schema: $ref: '#/components/schemas/NssaiAckData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/subscribed-cag: put: @@ -385,7 +457,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -400,11 +472,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the CAG acknowledgement information of a UE operationId: QueryCagAck @@ -416,7 +485,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -430,11 +499,7 @@ paths: schema: $ref: '#/components/schemas/CagAckData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data: get: @@ -470,12 +535,7 @@ paths: schema: $ref: '#/components/schemas/ProvisionedDataSets' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' - + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/am-data: get: @@ -543,11 +603,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/smf-selection-subscription-data: get: @@ -615,11 +671,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sm-data: get: @@ -704,11 +756,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/amf-3gpp-access: get: @@ -747,11 +795,8 @@ paths: schema: $ref: '#/components/schemas/Amf3GppAccessRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: summary: To store the AMF context data of a UE using 3gpp access in the UDR operationId: CreateAmfContext3gpp @@ -772,12 +817,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/Amf3GppAccessRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/amf-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: To modify the AMF context data of a UE using 3gpp access in the UDR operationId: AmfContext3gpp @@ -819,11 +873,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/amf-non-3gpp-access: get: @@ -862,11 +912,8 @@ paths: schema: $ref: '#/components/schemas/AmfNon3GppAccessRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: summary: To store the AMF context data of a UE using non-3gpp access in the UDR operationId: CreateAmfContextNon3gpp @@ -887,12 +934,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/Amf3GppAccessRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/amf-non-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: To modify the AMF context data of a UE using non 3gpp access in the UDR operationId: AmfContextNon3gpp @@ -934,11 +990,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smf-registrations: get: @@ -966,11 +1018,7 @@ paths: schema: $ref: '#/components/schemas/SmfRegList' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smf-registrations/{pduSessionId}: get: @@ -1015,11 +1063,8 @@ paths: schema: $ref: '#/components/schemas/SmfRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: summary: To create an individual SMF context data of a UE in the UDR operationId: CreateSmfContextNon3gpp @@ -1046,18 +1091,21 @@ paths: responses: '201': description: Upon success, a response body containing a representation of the created Individual SmfRegistration resource shall be returned - default: - description: Unexpected error content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SmfRegistration' headers: Location: description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/smf-registrations/{pduSessionId}' required: true schema: type: string + '204': + description: No content + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: To remove an individual SMF context data of a UE the UDR operationId: DeleteSmfContext @@ -1080,11 +1128,7 @@ paths: '204': description: Upon success, an empty response body shall be returned. default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/operator-specific-data: get: @@ -1148,11 +1192,8 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: To modify operator specific data of a UE operationId: ModifyOperSpecData @@ -1194,11 +1235,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smsf-3gpp-access: put: @@ -1221,12 +1258,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SmsfRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/smsf-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: To remove the SMSF context data of a UE via 3GPP access operationId: DeleteSmsfContext3gpp @@ -1243,11 +1289,8 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the SMSF context data of a UE using 3gpp access operationId: QuerySmsfContext3gpp @@ -1284,11 +1327,7 @@ paths: schema: $ref: '#/components/schemas/SmsfRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smsf-non-3gpp-access: put: @@ -1311,12 +1350,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SmsfRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/smsf-non-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: To remove the SMSF context data of a UE via non-3GPP access operationId: DeleteSmsfContextNon3gpp @@ -1333,11 +1381,8 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the SMSF context data of a UE using non-3gpp access operationId: QuerySmsfContextNon3gpp @@ -1374,11 +1419,228 @@ paths: schema: $ref: '#/components/schemas/SmsfRegistration' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/context-data/ip-sm-gw: + put: + summary: Create the IP-SM-GW context data of a UE + operationId: CreateIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + delete: + summary: To remove the IP-SM-GW context data of a UE + operationId: DeleteIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + patch: + summary: Modify the IP-SM-GW context data of a UE + operationId: ModifyIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + minItems: 1 + required: true + responses: + '204': + description: Successful response + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + get: + summary: Retrieves the IP-SM-GW context data of a UE + operationId: QueryIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/IpSmGwRegistration' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/context-data/mwd: + put: + summary: Create the Message Waiting Data of the UE + operationId: CreateMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MessageWaitingData' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + description: Unexpected error + delete: + summary: To remove the Message Waiting Data of the UE + operationId: DeleteMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + patch: + summary: Modify the Message Waiting Data of the UE + operationId: ModifyMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + minItems: 1 + required: true + responses: + '204': + description: Successful response + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + get: + summary: Retrieves the Message Waiting Data of the UE + operationId: QueryMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/MessageWaitingData' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-mng-data: get: @@ -1435,11 +1697,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-data: get: @@ -1496,11 +1754,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/pp-data: get: @@ -1557,11 +1811,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the provisioned parameter data operationId: ModifyPpData @@ -1595,7 +1846,7 @@ paths: content: application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' '403': description: modification is rejected content: @@ -1603,11 +1854,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/ee-subscriptions: get: @@ -1637,11 +1884,8 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + post: summary: Create individual EE subscription operationId: CreateEeSubscriptions @@ -1674,11 +1918,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/ee-subscriptions/{subsId}: put: @@ -1712,11 +1952,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes a eeSubscription operationId: RemoveeeSubscriptions @@ -1737,6 +1974,8 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual ee subscription of a UE @@ -1783,7 +2022,7 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieve a eeSubscription @@ -1811,11 +2050,7 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/ee-subscriptions/{subsId}/amf-subscriptions: put: @@ -1847,11 +2082,8 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes AMF Subscription Info for an eeSubscription operationId: RemoveAmfSubscriptionsInfo @@ -1871,6 +2103,9 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the AMF Subscription Info operationId: ModifyAmfSubscriptionInfo @@ -1916,11 +2151,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieve AMF subscription Info operationId: GetAmfSubscriptionInfo @@ -1948,11 +2180,7 @@ paths: $ref: '#/components/schemas/AmfSubscriptionInfo' minItems: 1 default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/{ueGroupId}/ee-subscriptions: get: @@ -1982,11 +2210,8 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + post: summary: Create individual EE subscription for a group of UEs or any UE operationId: CreateEeGroupSubscriptions @@ -2014,23 +2239,19 @@ paths: $ref: '#/components/schemas/EeSubscription' headers: Location: - description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/group-data/{ueGroupId}/ee-subscriptions ' + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/group-data/{ueGroupId}/ee-subscriptions' required: true schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/{ueGroupId}/ee-subscriptions/{subsId}: put: summary: Update an individual ee subscription of a group of UEs or any UE operationId: UpdateEeGroupSubscriptions tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2057,16 +2278,13 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes a eeSubscription for a group of UEs or any UE operationId: RemoveEeGroupSubscriptions tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2082,12 +2300,14 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual ee subscription for a group of a UEs operationId: ModifyEeGroupSubscription tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2127,13 +2347,13 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieve a individual eeSubscription for a group of UEs or any UE operationId: QueryEeGroupSubscription tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2155,11 +2375,7 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ee-profile-data: get: @@ -2197,12 +2413,7 @@ paths: schema: $ref: '#/components/schemas/EeProfileData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' - + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/sdm-subscriptions: get: @@ -2232,11 +2443,8 @@ paths: items: $ref: '#/components/schemas/SdmSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + post: summary: Create individual sdm subscription operationId: CreateSdmSubscriptions @@ -2269,11 +2477,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/sdm-subscriptions/{subsId}: put: @@ -2307,11 +2511,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes a sdmsubscriptions operationId: RemovesdmSubscriptions @@ -2334,6 +2535,8 @@ paths: description: Expected response to a successful subscription removal '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual sdm subscription @@ -2380,7 +2583,7 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieves a individual sdmSubscription identified by subsId @@ -2407,6 +2610,8 @@ paths: schema: items: $ref: '#/components/schemas/SdmSubscription' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/shared-data: get: @@ -2447,13 +2652,14 @@ paths: '503': $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscription-data/subs-to-notify: post: summary: Subscription data subscriptions operationId: SubscriptionDataSubscriptions tags: - - Subs To Nofify (Collection) + - Subs To Notify (Collection) requestBody: content: application/json: @@ -2474,11 +2680,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' callbacks: onDataChange: '{request.body#/callbackReference}': @@ -2497,7 +2699,7 @@ paths: summary: Retrieves the list of subscriptions operationId: QuerySubsToNotify tags: - - Subs To Nofify (Collection) + - Subs To Notify (Collection) parameters: - name: ue-id in: query @@ -2520,11 +2722,8 @@ paths: items: $ref: '#/components/schemas/SubscriptionDataSubscriptions' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes subscriptions identified by a given ue-id parameter operationId: RemoveMultipleSubscriptionDataSubscriptions @@ -2558,6 +2757,8 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/subs-to-notify/{subsId}: delete: @@ -2575,6 +2776,8 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual subscriptionDataSubscription @@ -2615,7 +2818,7 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieves a individual subscriptionDataSubscription identified by subsId @@ -2637,6 +2840,8 @@ paths: schema: items: $ref: '#/components/schemas/SubscriptionDataSubscriptions' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/trace-data: get: @@ -2689,6 +2894,7 @@ paths: type: string default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscription-data/{ueId}/identity-data: get: summary: Retrieve identity data by SUPI or GPSI @@ -2740,11 +2946,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/operator-determined-barring-data: get: @@ -2767,11 +2969,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/OdbData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data: get: @@ -2802,11 +3000,7 @@ paths: schema: $ref: '#/components/schemas/ContextDataSets' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/group-identifiers: get: @@ -2846,6 +3040,8 @@ paths: application/json: schema: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/GroupIdentifiers' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/5g-vn-groups: get: @@ -2874,11 +3070,7 @@ paths: additionalProperties: $ref: 'TS29503_Nudm_PP.yaml#/components/schemas/5GVnGroupConfiguration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/5g-vn-groups/{externalGroupId}: put: @@ -2908,11 +3100,8 @@ paths: '403': $ref: 'TS29571_CommonData.yaml#/components/responses/403' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes the 5GVnGroup operationId: Delete5GVnGroup @@ -2927,6 +3116,9 @@ paths: responses: '204': description: Expected response to a successful group removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the 5GVnGroup operationId: Modify5GVnGroup @@ -2967,11 +3159,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieve a 5GVnGroup configuration operationId: Get5GVnGroupConfiguration @@ -2991,13 +3180,9 @@ paths: schema: $ref: 'TS29503_Nudm_PP.yaml#/components/schemas/5GVnGroupConfiguration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-privacy-data: + /subscription-data/{ueId}/lcs-privacy-data: get: summary: Retrieves the LCS Privacy subscription data of a UE operationId: QueryLcsPrivacyData @@ -3010,12 +3195,6 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' - - name: servingPlmnId - in: path - description: PLMN ID - required: true - schema: - $ref: '#/components/schemas/VarPlmnId' - name: fields in: query description: attributes to be retrieved @@ -3048,10 +3227,7 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/LcsPrivacyData' - minItems: 1 + $ref: '#/components/schemas/LcsPrivacyData' headers: Cache-Control: description: Cache-Control containing max-age, as described in RFC 7234, 5.2 @@ -3066,13 +3242,9 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-mo-data: + /subscription-data/{ueId}/lcs-mo-data: get: summary: Retrieves the LCS Mobile Originated subscription data of a UE operationId: QueryLcsMoData @@ -3085,12 +3257,6 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' - - name: servingPlmnId - in: path - description: PLMN ID - required: true - schema: - $ref: '#/components/schemas/VarPlmnId' - name: fields in: query description: attributes to be retrieved @@ -3123,10 +3289,7 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/LcsMoData' - minItems: 1 + $ref: '#/components/schemas/LcsMoData' headers: Cache-Control: description: Cache-Control containing max-age, as described in RFC 7234, 5.2 @@ -3141,11 +3304,8 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscription-data/{ueId}/nidd-authorization-data: get: summary: Retrieve NIDD Authorization Data GPSI or External Group identifier @@ -3211,11 +3371,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/coverage-restriction-data: get: @@ -3265,6 +3421,142 @@ paths: description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/context-data/location: + get: + summary: Retrieves the UE's Location Information + operationId: QueryUeLocation + tags: + - UE's Location Information (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/LocationInfo' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/v2x-data: + get: + summary: Retrieves the subscribed V2X Data of a UE + operationId: QueryV2xData + tags: + - V2X Subscription Data + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V2xSubscriptionData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-bca-data: + get: + summary: Retrieves the LCS Broadcast Assistance subscription data of a UE + operationId: QueryLcsBcaData + tags: + - LCS Broadcast Assistance Subscription Data + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: servingPlmnId + in: path + description: PLMN ID + required: true + schema: + $ref: '#/components/schemas/VarPlmnId' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string default: description: Unexpected error content: @@ -3272,6 +3564,36 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + /subscription-data/group-data/5g-vn-groups/internal: + get: + summary: Retrieves the data of 5G VN Group + operationId: Query5GVnGroupInternal + tags: + - 5G-VN-Groups-Internal (Document) + parameters: + - name: internal-group-ids + in: query + description: List of Internal Group IDs + required: true + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + style: form + explode: false + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + type: object + description: A map (list of key-value pairs) where ExtGroupId serves as key + additionalProperties: + $ref: 'TS29503_Nudm_PP.yaml#/components/schemas/5GVnGroupConfiguration' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + components: schemas: AuthenticationSubscription: @@ -3299,6 +3621,13 @@ components: vectorGenerationInHss: type: boolean default: false + n5gcAuthMethod: + $ref: '#/components/schemas/AuthMethod' + rgAuthenticationInd: + type: boolean + default: false + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' SequenceNumber: type: object properties: @@ -3341,8 +3670,8 @@ components: minItems: 1 uniqueItems: true DataSetName: - anyOf: - - type: string +# anyOf: +# - type: string enum: - AM - SMF_SEL @@ -3352,7 +3681,9 @@ components: - SMS_MNG - LCS_PRIVACY - LCS_MO - - type: string + - LCS_BCA + - V2X + type: string ProvisionedDataSets: type: object properties: @@ -3374,6 +3705,10 @@ components: $ref: '#/components/schemas/LcsPrivacyData' lcsMoData: $ref: '#/components/schemas/LcsMoData' + lcsBcaData: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' + v2xData: + $ref: '#/components/schemas/V2xSubscriptionData' AccessAndMobilitySubscriptionData: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/AccessAndMobilitySubscriptionData' SmfSelectionSubscriptionData: @@ -3392,6 +3727,8 @@ components: $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/SmfRegistration' SmsfRegistration: $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/SmsfRegistration' + LocationInfo: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/LocationInfo' SmsManagementSubscriptionData: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/SmsManagementSubscriptionData' SmsSubscriptionData: @@ -3404,6 +3741,10 @@ components: $ref: 'TS29503_Nudm_NIDDAU.yaml#/components/schemas/AuthorizationData' EnhancedCoverageRestrictionData: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/EnhancedCoverageRestrictionData' + V2xSubscriptionData: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/V2xSubscriptionData' + LcsBroadcastAssistanceTypesData: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/LcsBroadcastAssistanceTypesData' OperatorSpecificDataContainer: type: object required: @@ -3422,7 +3763,7 @@ components: type: string value: # oneOf: - type: string + type: string # - type: integer # - type: number # - type: boolean @@ -3600,11 +3941,11 @@ components: type: array items: $ref: '#/components/schemas/ContextDataSetName' - minItems: 1 + minItems: 2 uniqueItems: true ContextDataSetName: - anyOf: - - type: string +# anyOf: +# - type: string enum: - AMF_3GPP - AMF_NON_3GPP @@ -3614,7 +3955,8 @@ components: - SMSF_NON_3GPP - SUBS_TO_NOTIFY - SMF_REG - - type: string + - IP_SM_GW + type: string ContextDataSets: type: object properties: @@ -3643,3 +3985,28 @@ components: minItems: 1 smfRegistrations: $ref: '#/components/schemas/SmfRegList' + ipSmGw: + $ref: '#/components/schemas/IpSmGwRegistration' + + IpSmGwRegistration: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/IpSmGwRegistration' + + MessageWaitingData: + type: object + properties: + mwdList: + type: array + items: + $ref: '#/components/schemas/SmscData' + minItems: 1 + + SmscData: + type: object + anyOf: + - required: [ smscMapAddress ] + - required: [ smscDiameterAddress ] + properties: + smscMapAddress: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/E164Number' + smscDiameterAddress: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/NetworkNodeDiameterAddress' diff --git a/lib/sbi/support/modified/TS29510_Nnrf_NFDiscovery.yaml b/lib/sbi/support/modified/TS29510_Nnrf_NFDiscovery.yaml index d4b28785c..60917c5b9 100644 --- a/lib/sbi/support/modified/TS29510_Nnrf_NFDiscovery.yaml +++ b/lib/sbi/support/modified/TS29510_Nnrf_NFDiscovery.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.2' title: 'NRF NFDiscovery Service' description: | NRF NFDiscovery Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.510 V16.3.0; 5G System; Network Function Repository Services; Stage 3 + description: 3GPP TS 29.510 V16.6.0; 5G System; Network Function Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' servers: @@ -135,6 +135,16 @@ paths: items: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' minItems: 1 + - name: requester-plmn-specific-snssai-list + in: query + description: PLMN-specific slice info of the NF issuing the Discovery request + content: + application/json: + schema: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' + minItems: 1 - name: dnn in: query description: Dnn supported by the BSF, SMF or UPF @@ -350,6 +360,13 @@ paths: type: integer maximum: 2000 default: 124 + - name: max-payload-size-ext + in: query + description: Extended query for maximum payload size of the response expressed in kilo octets + required: false + schema: + type: integer + default: 124 - name: atsss-capability in: query description: ATSSS Capability @@ -406,7 +423,7 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' minItems: 1 style: form - explode: false + explode: false - name: If-None-Match in: header description: Validator for conditional requests, as described in IETF RFC 7232, 3.2 @@ -419,6 +436,16 @@ paths: application/json: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + - name: requester-snpn-list + in: query + description: SNPN ID(s) of the NF instance issuing the Discovery request + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + minItems: 1 - name: af-ee-data in: query description: NEF exposured by the AF @@ -467,6 +494,16 @@ paths: description: Notification Type schema: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NotificationType' + - name: n1-msg-class + in: query + description: N1 Message Class + schema: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N1MessageClass' + - name: n2-info-class + in: query + description: N2 Information Class + schema: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N2InformationClass' - name: serving-scope in: query description: areas that can be served by the target NF @@ -482,6 +519,21 @@ paths: description: IMSI of the requester UE to search for an appropriate NF (e.g. HSS) schema: type: string + - name: ims-private-identity + in: query + description: IMPI of the requester UE to search for a target HSS + schema: + type: string + - name: ims-public-identity + in: query + description: IMS Public Identity of the requester UE to search for a target HSS + schema: + type: string + - name: msisdn + in: query + description: MSISDN of the requester UE to search for a target HSS + schema: + type: string - name: preferred-api-versions in: query description: Preferred API version of the services to be discovered @@ -507,6 +559,78 @@ paths: description: UPF supports redundant transport path to be discovered schema: type: boolean + - name: ipups + in: query + description: UPF which is configured for IPUPS functionality to be discovered + schema: + type: boolean + - name: scp-domain-list + in: query + description: SCP domains the target SCP belongs to + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: address-domain + in: query + description: Address domain reachable through the SCP + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: ipv4-addr + in: query + description: IPv4 address reachable through the SCP + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + - name: ipv6-prefix + in: query + description: IPv6 prefix reachable through the SCP + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + - name: served-nf-set-id + in: query + description: NF Set ID served by the SCP + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + - name: remote-plmn-id + in: query + description: Id of the PLMN reachable through the SCP + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: data-forwarding + in: query + description: UPF Instance(s) configured for data forwarding are requested + schema: + type: boolean + - name: preferred-full-plmn + in: query + description: NF Instance(s) serving the full PLMN are preferred + schema: + type: boolean + - name: requester-features + in: query + description: Features supported by the NF Service Consumer that is invoking the Nnrf_NFDiscovery service + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: realm-id + in: query + description: realm-id to search for an appropriate UDSF + schema: + type: string + - name: storage-id + in: query + description: storage-id to search for an appropriate UDSF + schema: + type: string + - name: vsmf-support-ind + in: query + description: V-SMF capability supported by the target NF instance(s) + schema: + type: boolean responses: '200': description: Expected response to a valid request @@ -544,6 +668,22 @@ paths: type: string '307': description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: description: 'The URI pointing to the resource located on the redirect target NRF' @@ -592,6 +732,30 @@ paths: responses: '200': $ref: '#/components/responses/200' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string /searches/{searchId}/complete: get: @@ -608,6 +772,30 @@ paths: responses: '200': $ref: '#/components/responses/200' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string components: securitySchemes: @@ -646,6 +834,31 @@ components: description: Content-Encoding, described in IETF RFC 7231 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + schemas: SearchResult: description: Contains the list of NF Profiles returned in a Discovery response @@ -701,7 +914,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -743,88 +956,88 @@ components: maximum: 65535 udrInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' - udrInfoExt: - type: array - items: + udrInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' - minItems: 1 + minProperties: 1 udmInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' - udmInfoExt: - type: array - items: + udmInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' - minItems: 1 + minProperties: 1 ausfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' - ausfInfoExt: - type: array - items: + ausfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' - minItems: 1 + minProperties: 1 amfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' - amfInfoExt: - type: array - items: + amfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' - minItems: 1 + minProperties: 1 smfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' - smfInfoExt: - type: array - items: + smfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' - minItems: 1 + minProperties: 1 upfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' - upfInfoExt: - type: array - items: + upfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' - minItems: 1 + minProperties: 1 pcfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' - pcfInfoExt: - type: array - items: + pcfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' - minItems: 1 + minProperties: 1 bsfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' - bsfInfoExt: - type: array - items: + bsfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' - minItems: 1 + minProperties: 1 chfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' - chfInfoExt: - type: array - items: + chfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' - minItems: 1 + minProperties: 1 udsfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdsfInfo' - udsfInfoExt: - type: array - items: + udsfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdsfInfo' - minItems: 1 + minProperties: 1 nwdafInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NwdafInfo' nefInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NefInfo' - pcscfInfo: - type: array - items: + pcscfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcscfInfo' - minItems: 1 - hssInfo: - type: array - items: + minProperties: 1 + hssInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/HssInfo' - minItems: 1 + minProperties: 1 customInfo: type: object recoveryTime: @@ -833,10 +1046,16 @@ components: type: boolean default: false nfServices: + deprecated: true type: array items: $ref: '#/components/schemas/NFService' minItems: 1 + nfServiceList: + type: object + additionalProperties: + $ref: '#/components/schemas/NFService' + minProperties: 1 defaultNotificationSubscriptions: type: array items: @@ -866,6 +1085,23 @@ components: olcHSupportInd: type: boolean default: false + nfSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + serviceSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + scpDomains: + type: array + items: + type: string + minItems: 1 + scpInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ScpInfo' NFService: description: Information of a given NF Service Instance; it is part of the NFProfile of an NF Instance discovered by the NRF type: object @@ -931,7 +1167,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -949,6 +1185,20 @@ components: minProperties: 1 oauth2Required: type: boolean + allowedOperationsPerNfType: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 + allowedOperationsPerNfInstance: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 PreferredSearch: description: Contains information on whether the returned NFProfiles match the preferred query parameters type: object @@ -956,3 +1206,16 @@ components: preferredTaiMatchInd: type: boolean default: false + preferredFullPlmnMatchInd: + type: boolean + default: false + preferredApiVersionsMatchInd: + type: boolean + otherApiVersionsInd: + type: boolean + preferredLocalityMatchInd: + type: boolean + default: false + otherLocalityInd: + type: boolean + default: false diff --git a/lib/sbi/support/modified/TS29510_Nnrf_NFManagement.yaml b/lib/sbi/support/modified/TS29510_Nnrf_NFManagement.yaml index cbeaa886b..89865351e 100644 --- a/lib/sbi/support/modified/TS29510_Nnrf_NFManagement.yaml +++ b/lib/sbi/support/modified/TS29510_Nnrf_NFManagement.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.2' title: 'NRF NFManagement Service' description: | NRF NFManagement Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.510 V16.3.0; 5G System; Network Function Repository Services; Stage 3 + description: 3GPP TS 29.510 V16.6.0; 5G System; Network Function Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' servers: @@ -58,6 +58,30 @@ paths: additionalProperties: $ref: 'TS29571_CommonData.yaml#/components/schemas/LinksValueSchema' minProperties: 1 + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -92,11 +116,46 @@ paths: responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OptionsResponse' headers: Accept-Encoding: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '204': + description: No Content + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -130,6 +189,11 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: requester-features + in: query + description: Features supported by the NF Service Consumer + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' responses: '200': description: Expected response to a valid request @@ -137,6 +201,30 @@ paths: application/json: schema: $ref: '#/components/schemas/NFProfile' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -227,6 +315,30 @@ paths: description: Content-Encoding, described in IETF RFC 7231 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -305,6 +417,30 @@ paths: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -342,6 +478,30 @@ paths: responses: '204': description: Expected response to a successful deregistration + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -406,6 +566,30 @@ paths: description: Content-Encoding, described in IETF RFC 7231 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -454,6 +638,30 @@ paths: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on another NF service consumer instance' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on another NF service consumer instance' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -533,6 +741,30 @@ paths: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -571,6 +803,30 @@ paths: responses: '204': description: Expected response to a successful subscription removal + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -606,7 +862,7 @@ components: nnrf-nfm: Access to the Nnrf_NFManagement API schemas: NFProfile: - description: Information of an NF Instance registered in the NRF + description: Information of an NF Instance registered in the NRF type: object required: - nfInstanceId @@ -640,7 +896,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -689,7 +945,7 @@ components: allowedNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 priority: type: integer @@ -709,90 +965,90 @@ components: type: string udrInfo: $ref: '#/components/schemas/UdrInfo' - udrInfoExt: - type: array - items: + udrInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UdrInfo' - minItems: 1 + minProperties: 1 udmInfo: $ref: '#/components/schemas/UdmInfo' - udmInfoExt: - type: array - items: + udmInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UdmInfo' - minItems: 1 + minProperties: 1 ausfInfo: $ref: '#/components/schemas/AusfInfo' - ausfInfoExt: - type: array - items: + ausfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/AusfInfo' - minItems: 1 + minProperties: 1 amfInfo: $ref: '#/components/schemas/AmfInfo' - amfInfoExt: - type: array - items: + amfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/AmfInfo' - minItems: 1 + minProperties: 1 smfInfo: $ref: '#/components/schemas/SmfInfo' - smfInfoExt: - type: array - items: + smfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/SmfInfo' - minItems: 1 + minProperties: 1 upfInfo: $ref: '#/components/schemas/UpfInfo' - upfInfoExt: - type: array - items: + upfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UpfInfo' - minItems: 1 + minProperties: 1 pcfInfo: $ref: '#/components/schemas/PcfInfo' - pcfInfoExt: - type: array - items: + pcfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/PcfInfo' - minItems: 1 + minProperties: 1 bsfInfo: $ref: '#/components/schemas/BsfInfo' - bsfInfoExt: - type: array - items: + bsfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/BsfInfo' - minItems: 1 + minProperties: 1 chfInfo: $ref: '#/components/schemas/ChfInfo' - chfInfoExt: - type: array - items: + chfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/ChfInfo' - minItems: 1 + minProperties: 1 nefInfo: $ref: '#/components/schemas/NefInfo' nrfInfo: $ref: '#/components/schemas/NrfInfo' udsfInfo: $ref: '#/components/schemas/UdsfInfo' - udsfInfoExt: - type: array - items: + udsfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UdsfInfo' - minItems: 1 + minProperties: 1 nwdafInfo: $ref: '#/components/schemas/NwdafInfo' - pcscfInfo: - type: array - items: + pcscfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/PcscfInfo' - minItems: 1 - hssInfo: - type: array - items: + minProperties: 1 + hssInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/HssInfo' - minItems: 1 + minProperties: 1 customInfo: type: object recoveryTime: @@ -801,10 +1057,16 @@ components: type: boolean default: false nfServices: + deprecated: true type: array items: $ref: '#/components/schemas/NFService' minItems: 1 + nfServiceList: + type: object + additionalProperties: + $ref: '#/components/schemas/NFService' + minProperties: 1 nfProfileChangesSupportInd: type: boolean default: false @@ -837,6 +1099,23 @@ components: olcHSupportInd: type: boolean default: false + nfSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + serviceSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + scpDomains: + type: array + items: + type: string + minItems: 1 + scpInfo: + $ref: '#/components/schemas/ScpInfo' NFService: description: Information of a given NF Service Instance; it is part of the NFProfile of an NF Instance type: object @@ -899,8 +1178,22 @@ components: allowedNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 + allowedOperationsPerNfType: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 + allowedOperationsPerNfInstance: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 priority: type: integer minimum: 0 @@ -929,7 +1222,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -983,6 +1276,9 @@ components: - SCSAS - SCEF - SCP + - NSSAAF + - ICSCF + - SCSCF type: string Fqdn: description: Fully Qualified Domain Name @@ -1058,6 +1354,7 @@ components: minItems: 1 # oneOf: # - $ref: '#/components/schemas/NfInstanceIdCond' +# - $ref: '#/components/schemas/NfInstanceIdListCond' # - $ref: '#/components/schemas/NfTypeCond' # - $ref: '#/components/schemas/ServiceNameCond' # - $ref: '#/components/schemas/AmfCond' @@ -1067,6 +1364,9 @@ components: # - $ref: '#/components/schemas/NfSetCond' # - $ref: '#/components/schemas/NfServiceSetCond' # - $ref: '#/components/schemas/UpfCond' +# - $ref: '#/components/schemas/ScpDomainCond' +# - $ref: '#/components/schemas/NwdafCond' +# - $ref: '#/components/schemas/NefCond' subscriptionId: type: string pattern: '^([0-9]{5,6}-)?[^-]+$' @@ -1093,11 +1393,34 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' minItems: 1 + reqPerPlmnSnssais: + type: array + items: + $ref: '#/components/schemas/PlmnSnssai' + minItems: 1 reqPlmnList: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' minItems: 1 + reqSnpnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + minItems: 1 + servingScope: + type: array + items: + type: string + minItems: 1 +# requesterFeatures: +# writeOnly: true +# allOf: +# - $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' +# nrfSupportedFeatures: +# readOnly: true +# allOf: +# - $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' NfInstanceIdCond: description: Subscription to a given NF Instance Id type: object @@ -1106,6 +1429,17 @@ components: properties: nfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + NfInstanceIdListCond: + description: Subscription to a list of NF Instances + type: object + required: + - nfInstanceIdList + properties: + nfInstanceIdList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 NfTypeCond: description: Subscription to a set of NFs based on their NF Type type: object @@ -1219,7 +1553,7 @@ components: $ref: '#/components/schemas/DataSetId' minItems: 1 SupiRange: - description: A range of SUPIs (subscriber identities), either based on a numeric range, or based on regular-expression matching + description: A range of SUPIs (subscriber identities), either based on a numeric range, or based on regular-expression matching type: object properties: start: @@ -1382,6 +1716,9 @@ components: type: integer minimum: 0 maximum: 65535 + vsmfSupportInd: + type: boolean + default: false SnssaiSmfInfoItem: description: Set of parameters supported by SMF for a given S-NSSAI type: object @@ -1456,6 +1793,12 @@ components: redundantGtpu: type: boolean default: false + ipups: + type: boolean + default: false + dataForwarding: + type: boolean + default: false SnssaiUpfInfoItem: description: Set of parameters supported by UPF for a given S-NSSAI type: object @@ -1531,6 +1874,7 @@ components: - N3 - N6 - N9 + - DATA_FORWARDING - type: string WAgfInfo: description: Information of the W-AGF end-points @@ -1673,6 +2017,8 @@ components: items: type: string minItems: 1 + binding: + type: string NfSetCond: description: Subscription to a set of NFs based on their Set Id type: object @@ -1690,6 +2036,7 @@ components: nfServiceSetId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' UpfCond: + description: Subscription to a set of NF Instances (UPFs), able to serve a certain service area (i.e. SMF serving area or TAI list) type: object properties: smfServingArea: @@ -1702,6 +2049,24 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' minItems: 1 + NwdafCond: + description: Subscription to a set of NF Instances (NWDAFs), identified by Analytics ID(s). + type: object + properties: + analyticsIds: + type: array + items: + type: string + minItems: 1 + NefCond: + description: Subscription to a set of NF Instances (NEFs), identified by Event ID(s) provided by AF. + type: object + properties: + eventIds: + type: array + items: + $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/EventId' + minItems: 1 NotificationType: # description: Types of notifications used in Default Notification URIs in the NF Profile of an NF Instance # anyOf: @@ -1713,14 +2078,16 @@ components: - DATA_REMOVAL_NOTIFICATION - DATA_CHANGE_NOTIFICATION - LOCATION_UPDATE_NOTIFICATION + - NSSAA_REAUTH_NOTIFICATION + - NSSAA_REVOC_NOTIFICATION type: string TransportProtocol: - description: Types of transport protocol used in a given IP endpoint of an NF Service Instance - anyOf: - - type: string +# description: Types of transport protocol used in a given IP endpoint of an NF Service Instance +# anyOf: +# - type: string enum: - TCP - - type: string + type: string NotificationEventType: # description: Types of events sent in notifications from NRF to subscribed NF Instances # anyOf: @@ -1775,6 +2142,8 @@ components: required: [ interPlmnFqdn ] - not: required: [ allowedPlmns ] + - not: + required: [ allowedSnpns ] - not: required: [ allowedNfTypes ] - not: @@ -1791,6 +2160,8 @@ components: required: [ interPlmnFqdn ] - not: required: [ allowedPlmns ] + - not: + required: [ allowedSnpns ] - not: required: [ allowedNfTypes ] - not: @@ -1802,6 +2173,8 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/ChangeItem' minItems: 1 + conditionEvent: + $ref: '#/components/schemas/ConditionEventType' NFStatus: # description: Status of a given NF Instance stored in NRF # anyOf: @@ -1845,6 +2218,7 @@ components: # - namf-loc # - nsmf-pdusession # - nsmf-event-exposure +# - nsmf-nidd # - nausf-auth # - nausf-sorprotection # - nausf-upuprotection @@ -1876,12 +2250,15 @@ components: # - nhss-sdm # - nhss-uecm # - nhss-ueau +# - nhss-ee # - nhss-ims-sdm # - nhss-ims-uecm # - nhss-ims-ueau # - nsepp-telescopic # - nsoraf-sor # - nspaf-secured-packet +# - nudsf-dr +# - nnssaaf-nssaa type: string N2InterfaceAmfInfo: description: AMF N2 interface information @@ -1967,46 +2344,118 @@ components: additionalProperties: $ref: '#/components/schemas/UdrInfo' minProperties: 1 + servedUdrInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UdrInfo' + minProperties: 1 + minProperties: 1 servedUdmInfo: type: object additionalProperties: $ref: '#/components/schemas/UdmInfo' minProperties: 1 + servedUdmInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UdmInfo' + minProperties: 1 + minProperties: 1 servedAusfInfo: type: object additionalProperties: $ref: '#/components/schemas/AusfInfo' minProperties: 1 + servedAusfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/AusfInfo' + minProperties: 1 + minProperties: 1 servedAmfInfo: type: object additionalProperties: $ref: '#/components/schemas/AmfInfo' minProperties: 1 + servedAmfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/AmfInfo' + minProperties: 1 + minProperties: 1 servedSmfInfo: type: object additionalProperties: $ref: '#/components/schemas/SmfInfo' minProperties: 1 + servedSmfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/SmfInfo' + minProperties: 1 + minProperties: 1 servedUpfInfo: type: object additionalProperties: $ref: '#/components/schemas/UpfInfo' minProperties: 1 + servedUpfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UpfInfo' + minProperties: 1 + minProperties: 1 servedPcfInfo: type: object additionalProperties: $ref: '#/components/schemas/PcfInfo' minProperties: 1 + servedPcfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/PcfInfo' + minProperties: 1 + minProperties: 1 servedBsfInfo: type: object additionalProperties: $ref: '#/components/schemas/BsfInfo' minProperties: 1 + servedBsfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/BsfInfo' + minProperties: 1 + minProperties: 1 servedChfInfo: type: object additionalProperties: $ref: '#/components/schemas/ChfInfo' minProperties: 1 + servedChfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/ChfInfo' + minProperties: 1 + minProperties: 1 servedNefInfo: type: object additionalProperties: @@ -2017,10 +2466,13 @@ components: additionalProperties: $ref: '#/components/schemas/NwdafInfo' minProperties: 1 - servedPcscfInfo: + servedPcscfInfoList: type: object additionalProperties: - $ref: '#/components/schemas/PcscfInfo' + type: object + additionalProperties: + $ref: '#/components/schemas/PcscfInfo' + minProperties: 1 minProperties: 1 servedGmlcInfo: type: object @@ -2037,10 +2489,31 @@ components: additionalProperties: $ref: '#/components/schemas/NfInfo' minProperties: 1 - servedHssInfo: + servedHssInfoList: type: object additionalProperties: - $ref: '#/components/schemas/HssInfo' + type: object + additionalProperties: + $ref: '#/components/schemas/HssInfo' + minProperties: 1 + minProperties: 1 + servedUdsfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UdsfInfo' + minProperties: 1 + servedUdsfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UdsfInfo' + minProperties: 1 + minProperties: 1 + servedScpInfoList: + type: object + additionalProperties: + $ref: '#/components/schemas/ScpInfo' minProperties: 1 PlmnSnssai: description: List of network slices (S-NSSAIs) for a given PLMN ID @@ -2054,7 +2527,7 @@ components: sNssaiList: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 nid: $ref: 'TS29571_CommonData.yaml#/components/schemas/Nid' @@ -2068,6 +2541,21 @@ components: $ref: '#/components/schemas/PfdData' afEeData: $ref: '#/components/schemas/AfEventExposureData' + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + externalGroupIdentifiersRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + servedFqdnList: + type: array + items: + type: string + minItems: 1 PfdData: description: List of Application IDs and/or AF IDs managed by a given NEF Instance type: object @@ -2107,6 +2595,7 @@ components: $ref: '#/components/schemas/TaiRange' minItems: 1 LmfInfo: + description: Information of an LMF NF Instance type: object properties: servingClientTypes: @@ -2132,6 +2621,7 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' minItems: 1 GmlcInfo: + description: Information of a GMLC NF Instance type: object properties: servingClientTypes: @@ -2174,6 +2664,18 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' minItems: 1 + gmFqdn: + $ref: '#/components/schemas/Fqdn' + gmIpv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + gmIpv6Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 NfInfo: description: Information of a generic NF Instance type: object @@ -2186,11 +2688,26 @@ components: properties: groupId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' - imsRanges: + imsiRanges: type: array items: $ref: '#/components/schemas/ImsiRange' minItems: 1 + imsPrivateIdentityRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + imsPublicIdentityRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + msisdnRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 ImsiRange: description: A range of IMSIs (subscriber identities), either based on a numeric range, or based on regular-expression matching type: object @@ -2204,6 +2721,7 @@ components: pattern: type: string TwifInfo: + description: Addressing information (IP addresses, FQDN) of the TWIF type: object properties: ipv4EndpointAddresses: @@ -2234,13 +2752,15 @@ components: featureVersion: type: string AnNodeType: - anyOf: - - type: string +# description: Access Network Node Type (gNB, ng-eNB...) +# anyOf: +# - type: string enum: - GNB - NG_ENB - - type: string + type: string UdsfInfo: + description: Information related to UDSF type: object properties: groupId: @@ -2250,3 +2770,113 @@ components: items: $ref: '#/components/schemas/SupiRange' minItems: 1 + storageIdRanges: + description: A map (list of key-value pairs) where realmId serves as key and each value in the map is an array of IdentityRanges. Each IdentityRange is a range of storageIds. + type: object + additionalProperties: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + minProperties: 1 + ScpInfo: + description: Information of an SCP Instance + type: object + properties: + scpDomainInfoList: + type: object + additionalProperties: + items: + $ref: '#/components/schemas/ScpDomainInfo' + minProperties: 1 + scpPrefix: + type: string + scpPorts: + type: object + additionalProperties: + type: integer + minimum: 0 + maximum: 65535 + minProperties: 1 + addressDomains: + type: array + items: + type: string + minItems: 1 + ipv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6Prefixes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + minItems: 1 + ipv4AddrRanges: + type: array + items: + $ref: '#/components/schemas/Ipv4AddressRange' + minItems: 1 + ipv6PrefixRanges: + type: array + items: + $ref: '#/components/schemas/Ipv6PrefixRange' + minItems: 1 + servedNfSetIdList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + minItems: 1 + remotePlmnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + + ScpDomainInfo: + description: SCP Domain specific information + type: object + properties: + scpFqdn: + $ref: '#/components/schemas/Fqdn' + scpIpEndPoints: + type: array + items: + $ref: '#/components/schemas/IpEndPoint' + minItems: 1 + scpPrefix: + type: string + scpPorts: + type: object + additionalProperties: + type: integer + minimum: 0 + maximum: 65535 + minProperties: 1 + + ScpDomainCond: + description: Subscription to a set of NF or SCP instances belonging to certain SCP domains + type: object + properties: + scpDomains: + type: array + items: + type: string + minItems: 1 + + OptionsResponse: + description: Communication options of the NRF sent in response payload of OPTIONS method + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + ConditionEventType: +# description: Indicates whether a notification is due to the NF Instance to start or stop being part of a condition for a subscription to a set of NFs +# anyOf: +# - type: string + enum: + - NF_ADDED + - NF_REMOVED + type: string diff --git a/lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml b/lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml index 54d34c0e5..895d5f6e2 100644 --- a/lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml +++ b/lib/sbi/support/modified/TS29531_Nnssf_NSSelection.yaml @@ -311,12 +311,12 @@ components: RoamingIndication: - anyOf: - - type: string +# anyOf: +# - type: string enum: - NON_ROAMING - LOCAL_BREAKOUT - HOME_ROUTED_ROAMING - - type: string + type: string NsiId: type: string diff --git a/lib/sbi/support/modified/TS29571_CommonData.yaml b/lib/sbi/support/modified/TS29571_CommonData.yaml index f06dd2cac..f62e00479 100644 --- a/lib/sbi/support/modified/TS29571_CommonData.yaml +++ b/lib/sbi/support/modified/TS29571_CommonData.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.2.0.alpha-4' + version: '1.2.2' title: 'Common Data Types' description: | Common Data Types for Service Based Interfaces. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.571 Common Data Types for Service Based Interfaces, version 16.3.0 + description: 3GPP TS 29.571 Common Data Types for Service Based Interfaces, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.571/' paths: {} @@ -161,22 +161,23 @@ components: maximum: 65535 nullable: true Uint32: - format: int32 type: integer minimum: 0 + maximum: 4294967295 #(2^32)-1 Uint32Rm: format: int32 type: integer minimum: 0 + maximum: 4294967295 #(2^32)-1 nullable: true Uint64: - format: int64 type: integer minimum: 0 + maximum: 18446744073709551615 #(2^64)-1 Uint64Rm: - format: int64 type: integer minimum: 0 + maximum: 18446744073709551615 #(2^64)-1 nullable: true Uri: type: string @@ -247,8 +248,8 @@ components: - REPLACE type: string HttpMethod: - anyOf: - - type: string +# anyOf: +# - type: string enum: - GET - POST @@ -259,7 +260,7 @@ components: - HEAD - CONNECT - TRACE - - type: string + type: string NullValue: enum: - null @@ -290,6 +291,8 @@ components: minItems: 1 supportedFeatures: $ref: '#/components/schemas/SupportedFeatures' + targetScp: + $ref: '#/components/schemas/Uri' Link: type: object properties: @@ -310,6 +313,7 @@ components: type: string from: type: string +# value: {} value: type: string required: @@ -569,23 +573,16 @@ components: type: object properties: plmnId: - $ref: '#/components/schemas/PlmnId' + $ref: '#/components/schemas/PlmnIdNid' amfId: $ref: '#/components/schemas/AmfId' required: - plmnId - amfId GuamiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - amfId: - $ref: '#/components/schemas/AmfId' - required: - - plmnId - - amfId - nullable: true + anyOf: + - $ref: '#/components/schemas/Guami' + - $ref: '#/components/schemas/NullValue' NetworkId: type: object properties: @@ -663,6 +660,12 @@ components: N3IwfId: type: string pattern: '^[A-Fa-f0-9]+$' + WAgfId: + type: string + pattern: '^[A-Fa-f0-9]+$' + TngfId: + type: string + pattern: '^[A-Fa-f0-9]+$' NgeNbId: type: string pattern: '^(MacroNGeNB-[A-Fa-f0-9]{5}|LMacroNGeNB-[A-Fa-f0-9]{6}|SMacroNGeNB-[A-Fa-f0-9]{5})$' @@ -696,6 +699,8 @@ components: pattern: '^(MacroeNB-[A-Fa-f0-9]{5}|LMacroeNB-[A-Fa-f0-9]{6}|SMacroeNB-[A-Fa-f0-9]{5}|HomeeNB-[A-Fa-f0-9]{7})$' Gli: $ref: '#/components/schemas/Bytes' + Gci: + type: string # # ENUMERATED DATA TYPES @@ -721,8 +726,7 @@ components: - NBIOT - WIRELINE - WIRELINE_CABLE - - WIRELINE_DSL - - WIRELINE_PON + - WIRELINE_BBF - LTE-M - NR_U - EUTRA_U @@ -732,9 +736,9 @@ components: - GERA type: string RatTypeRm: - allOf: + anyOf: - $ref: '#/components/schemas/RatType' - nullable: true + - $ref: '#/components/schemas/NullValue' PduSessionType: # anyOf: # - type: string @@ -750,25 +754,25 @@ components: - $ref: '#/components/schemas/PduSessionType' - $ref: '#/components/schemas/NullValue' UpIntegrity: - anyOf: - - type: string +# anyOf: +# - type: string enum: - REQUIRED - PREFERRED - NOT_NEEDED - - type: string + type: string UpIntegrityRm: anyOf: - $ref: '#/components/schemas/UpIntegrity' - $ref: '#/components/schemas/NullValue' UpConfidentiality: - anyOf: - - type: string +# anyOf: +# - type: string enum: - REQUIRED - PREFERRED - NOT_NEEDED - - type: string + type: string UpConfidentialityRm: anyOf: - $ref: '#/components/schemas/UpConfidentiality' @@ -792,7 +796,7 @@ components: - EARLY - EARLY_LATE - LATE - - type: string + type: string description: > This string provides forward-compatibility with future extensions to the enumeration but is not used to encode @@ -893,75 +897,73 @@ components: - $ref: '#/components/schemas/TrafficProfile' - $ref: '#/components/schemas/NullValue' LcsServiceAuth: - anyOf: - - type: string +# anyOf: +# - type: string enum: - - "LOCATION_NOT_ALLOWED" - "LOCATION_ALLOWED_WITH_NOTIFICATION" - "LOCATION_ALLOWED_WITHOUT_NOTIFICATION" - "LOCATION_ALLOWED_WITHOUT_RESPONSE" - "LOCATION_RESTRICTED_WITHOUT_RESPONSE" - "NOTIFICATION_ONLY" - "NOTIFICATION_AND_VERIFICATION_ONLY" - - type: string - description: > - This string provides forward-compatibility with future - extensions to the enumeration but is not used to encode - content defined in the present version of this API. - description: > - Possible values are - - "LOCATION_NOT_ALLOWED": Indicates the start of MO Exception Data delivery. - - "STOP": Indicates the stop of MO Exception Data delivery. - - "LOCATION_NOT_ALLOWED": Location not allowed - - "LOCATION_ALLOWED_WITH_NOTIFICATION": Location allowed with notification - - "LOCATION_ALLOWED_WITHOUT_NOTIFICATION": Location allowed without notification - - "LOCATION_ALLOWED_WITHOUT_RESPONSE": Location with notification and privacy verification; location allowed if no response - - "LOCATION_RESTRICTED_WITHOUT_RESPONSE": Location with notification and privacy verification; location restricted if no response - - "NOTIFICATION_ONLY": Notification only - - "NOTIFICATION_AND_VERIFICATION_ONLY": Notification and privacy verification only + type: string +# description: > +# This string provides forward-compatibility with future +# extensions to the enumeration but is not used to encode +# content defined in the present version of this API. +# description: > +# Possible values are +# - "LOCATION_ALLOWED_WITH_NOTIFICATION": Location allowed with notification +# - "LOCATION_ALLOWED_WITHOUT_NOTIFICATION": Location allowed without notification +# - "LOCATION_ALLOWED_WITHOUT_RESPONSE": Location with notification and privacy verification; location allowed if no response +# - "LOCATION_RESTRICTED_WITHOUT_RESPONSE": Location with notification and privacy verification; location restricted if no response +# - "NOTIFICATION_ONLY": Notification only +# - "NOTIFICATION_AND_VERIFICATION_ONLY": Notification and privacy verification only UeAuth: - anyOf: - - type: string +# anyOf: +# - type: string enum: - AUTHORIZED - NOT_AUTHORIZED - - type: string + type: string DlDataDeliveryStatus: - anyOf: - - type: string +# anyOf: +# - type: string enum: - BUFFERED - TRANSMITTED - DISCARDED - - type: string - description: > - This string provides forward-compatibility with future - extensions to the enumeration but is not used to encode - content defined in the present version of this API. - description: > - Possible values are - - BUFFERED: The first downlink data is buffered with extended buffering matching the source of the downlink traffic. - - TRANSMITTED: The first downlink data matching the source of the downlink traffic is transmitted after previous buffering or discarding of corresponding packet(s) because the UE of the PDU Session becomes ACTIVE, and buffered data can be delivered to UE. - - DISCARDED: The first downlink data matching the source of the downlink traffic is discarded because the Extended Buffering time, as determined by the SMF, expires or the amount of downlink data to be buffered is exceeded. + type: string +# description: > +# This string provides forward-compatibility with future +# extensions to the enumeration but is not used to encode +# content defined in the present version of this API. +# description: > +# Possible values are +# - BUFFERED: The first downlink data is buffered with extended buffering matching the source of the downlink traffic. +# - TRANSMITTED: The first downlink data matching the source of the downlink traffic is transmitted after previous buffering or discarding of corresponding packet(s) because the UE of the PDU Session becomes ACTIVE, and buffered data can be delivered to UE. +# - DISCARDED: The first downlink data matching the source of the downlink traffic is discarded because the Extended Buffering time, as determined by the SMF, expires or the amount of downlink data to be buffered is exceeded. DlDataDeliveryStatusRm: anyOf: - $ref: '#/components/schemas/DlDataDeliveryStatus' - $ref: '#/components/schemas/NullValue' - MoExceptionDataFlag: - anyOf: - - type: string + AuthStatus: +# anyOf: +# - type: string enum: - - START - - STOP - - type: string - description: > - This string provides forward-compatibility with future - extensions to the enumeration but is not used to encode - content defined in the present version of this API. - description: > - Possible values are - - "START": Indicates the start of MO Exception Data delivery. - - "STOP": Indicates the stop of MO Exception Data delivery. + - EAP_SUCCESS + - EAP_FAILURE + - PENDING + type: string +# description: > +# This string provides forward-compatibility with future +# extensions to the enumeration but is not used to encode +# content defined in the present version of this API. +# description: > +# Possible values are +# - "EAP_SUCCESS": The NSSAA status is EAP-Success. +# - "EAP_FAILURE": The NSSAA status is EAP-Failure. +# - "PENDING": The NSSAA status is Pending. # # STRUCTURED DATA TYPES @@ -979,6 +981,7 @@ components: pattern: '^[A-Fa-f0-9]{6}$' required: - sst + PlmnId: type: object properties: @@ -990,16 +993,9 @@ components: - mcc - mnc PlmnIdRm: - type: object - properties: - mcc: - $ref: '#/components/schemas/Mcc' - mnc: - $ref: '#/components/schemas/Mnc' - required: - - mcc - - mnc - nullable: true + anyOf: + - $ref: '#/components/schemas/PlmnId' + - $ref: '#/components/schemas/NullValue' Tai: type: object properties: @@ -1013,18 +1009,9 @@ components: - plmnId - tac TaiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - tac: - $ref: '#/components/schemas/Tac' - nid: - $ref: '#/components/schemas/Nid' - required: - - plmnId - - tac - nullable: true + anyOf: + - $ref: '#/components/schemas/Tai' + - $ref: '#/components/schemas/NullValue' Ecgi: type: object properties: @@ -1039,19 +1026,9 @@ components: - plmnId - eutraCellId EcgiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - # PLMN Identity - eutraCellId: - $ref: '#/components/schemas/EutraCellId' - nid: - $ref: '#/components/schemas/Nid' - required: - - plmnId - - eutraCellId - nullable: true + anyOf: + - $ref: '#/components/schemas/Ecgi' + - $ref: '#/components/schemas/NullValue' Ncgi: type: object properties: @@ -1065,18 +1042,9 @@ components: - plmnId - nrCellId NcgiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - nrCellId: - $ref: '#/components/schemas/NrCellId' - nid: - $ref: '#/components/schemas/Nid' - required: - - plmnId - - nrCellId - nullable: true + anyOf: + - $ref: '#/components/schemas/Ncgi' + - $ref: '#/components/schemas/NullValue' UserLocation: type: object properties: @@ -1116,32 +1084,9 @@ components: - tai - ecgi EutraLocationRm: - type: object - properties: - tai: - $ref: '#/components/schemas/Tai' - ecgi: - $ref: '#/components/schemas/Ecgi' - ageOfLocationInformation: - type: integer - minimum: 0 - maximum: 32767 - ueLocationTimestamp: - $ref: '#/components/schemas/DateTime' - geographicalInformation: - type: string - pattern: '^[0-9A-F]{16}$' - geodeticInformation: - type: string - pattern: '^[0-9A-F]{20}$' - globalNgenbId: - $ref: '#/components/schemas/GlobalRanNodeId' - globalENbId: - $ref: '#/components/schemas/GlobalRanNodeId' - required: - - tai - - ecgi - nullable: true + anyOf: + - $ref: '#/components/schemas/EutraLocation' + - $ref: '#/components/schemas/NullValue' NrLocation: type: object properties: @@ -1167,33 +1112,9 @@ components: - tai - ncgi NrLocationRm: - type: object - properties: - tai: - $ref: '#/components/schemas/Tai' - ncgi: - $ref: '#/components/schemas/Ncgi' - ignoreNcgi: - type: boolean - default: false - ageOfLocationInformation: - type: integer - minimum: 0 - maximum: 32767 - ueLocationTimestamp: - $ref: '#/components/schemas/DateTime' - geographicalInformation: - type: string - pattern: '^[0-9A-F]{16}$' - geodeticInformation: - type: string - pattern: '^[0-9A-F]{20}$' - globalGnbId: - $ref: '#/components/schemas/GlobalRanNodeId' - required: - - tai - - ncgi - nullable: true + anyOf: + - $ref: '#/components/schemas/NrLocation' + - $ref: '#/components/schemas/NullValue' N3gaLocation: type: object properties: @@ -1208,16 +1129,18 @@ components: $ref: '#/components/schemas/Ipv6Addr' portNumber: $ref: '#/components/schemas/Uinteger' - ssId: - type: string - bssId: - type: string - civicAddress: - $ref: '#/components/schemas/Bytes' + tnapId: + $ref: '#/components/schemas/TnapId' + twapId: + $ref: '#/components/schemas/TwapId' hfcNodeId: $ref: '#/components/schemas/HfcNodeId' gli: $ref: '#/components/schemas/Gli' + w5gbanLineType: + $ref: '#/components/schemas/LineType' + gci: + $ref: '#/components/schemas/Gci' UpSecurity: type: object properties: @@ -1229,16 +1152,9 @@ components: - upIntegr - upConfid UpSecurityRm: - type: object - properties: - upIntegr: - $ref: '#/components/schemas/UpIntegrity' - upConfid: - $ref: '#/components/schemas/UpConfidentiality' - required: - - upIntegr - - upConfid - nullable: true + anyOf: + - $ref: '#/components/schemas/UpSecurity' + - $ref: '#/components/schemas/NullValue' NgApCause: type: object properties: @@ -1269,13 +1185,9 @@ components: required: - contentId RefToBinaryDataRm: - type: object - properties: - contentId: - type: string - required: - - contentId - nullable: true + anyOf: + - $ref: '#/components/schemas/RefToBinaryData' + - $ref: '#/components/schemas/NullValue' RouteToLocation: type: object properties: @@ -1410,6 +1322,8 @@ components: properties: praId: type: string + additionalPraId: + type: string presenceState: $ref: '#/components/schemas/PresenceState' trackingAreaList: @@ -1442,6 +1356,8 @@ components: properties: praId: type: string + additionalPraId: + type: string presenceState: $ref: '#/components/schemas/PresenceState' trackingAreaList: @@ -1480,6 +1396,10 @@ components: $ref: '#/components/schemas/GNbId' ngeNbId: $ref: '#/components/schemas/NgeNbId' + wagfId: + $ref: '#/components/schemas/WAgfId' + tngfId: + $ref: '#/components/schemas/TngfId' nid: $ref: '#/components/schemas/Nid' eNbId: @@ -1488,6 +1408,8 @@ components: - required: [ n3IwfId ] - required: [ gNbId ] - required: [ ngeNbId ] + - required: [ wagfId ] + - required: [ tngfId ] - required: [ eNbId ] required: - plmnId @@ -1513,6 +1435,9 @@ components: mptcp: type: boolean default: false + rttWithoutPmf: + type: boolean + default: false PlmnIdNid: type: object required: @@ -1567,13 +1492,9 @@ components: hfcNId: $ref: '#/components/schemas/HfcNId' HfcNodeIdRm: - type: object - required: - - hfcNId - properties: - hfcNId: - $ref: '#/components/schemas/HfcNId' - nullable: true + anyOf: + - $ref: '#/components/schemas/HfcNodeId' + - $ref: '#/components/schemas/NullValue' ScheduledCommunicationTime: type: object properties: @@ -1800,7 +1721,99 @@ components: type: integer timeStamp: $ref: '#/components/schemas/DateTime' + NssaaStatus: + type: object + required: + - snssai + - status + properties: + snssai: + $ref: '#/components/schemas/Snssai' + status: + $ref: '#/components/schemas/AuthStatus' + NssaaStatusRm: + anyOf: + - $ref: '#/components/schemas/NssaaStatus' + - $ref: '#/components/schemas/NullValue' + TnapId: + type: object + properties: + ssId: + type: string + bssId: + type: string + civicAddress: + $ref: '#/components/schemas/Bytes' + TnapIdRm: + anyOf: + - $ref: '#/components/schemas/TnapId' + - $ref: '#/components/schemas/NullValue' + TwapId: + type: object + required: + - ssId + properties: + ssId: + type: string + bssId: + type: string + civicAddress: + $ref: '#/components/schemas/Bytes' + TwapIdRm: + anyOf: + - $ref: '#/components/schemas/TwapId' + - $ref: '#/components/schemas/NullValue' + LineType: +# anyOf: +# - type: string + enum: + - DSL + - PON + type: string +# description: > +# This string provides forward-compatibility with future +# extensions to the enumeration but is not used to encode +# content defined in the present version of this API. +# description: > +# Possible values are +# - DSL: Identifies a DSL line +# - PON: Identifies a PON line + LineTypeRm: + anyOf: + - $ref: '#/components/schemas/LineType' + - $ref: '#/components/schemas/NullValue' + SnssaiExtension: + description: Extensions to the Snssai data type + type: object + properties: + sdRanges: + type: array + items: + $ref: '#/components/schemas/SdRange' + minItems: 1 + wildcardSd: + type: boolean + default: false + + SdRange: + description: A range of SDs (Slice Differentiators) + type: object + properties: + start: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + end: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + +# +# Data types describing alternative data types or combinations of data types +# + ExtSnssai: + allOf: + - $ref: '#/components/schemas/Snssai' + - $ref: '#/components/schemas/SnssaiExtension' # # Data Types related to 5G QoS as defined in clause 5.5 @@ -1910,9 +1923,9 @@ components: RgWirelineCharacteristics: $ref: '#/components/schemas/Bytes' RgWirelineCharacteristicsRm: - allOf: + anyOf: - $ref: '#/components/schemas/RgWirelineCharacteristics' - - nullable: true + - $ref: '#/components/schemas/NullValue' ExtMaxDataBurstVol: type: integer minimum: 4096 @@ -1922,6 +1935,13 @@ components: minimum: 4096 maximum: 2000000 nullable: true + ExtPacketDelBudget: + type: integer + minimum: 1 + ExtPacketDelBudgetRm: + type: integer + minimum: 1 + nullable: true # # ENUMERATED DATA TYPES @@ -1950,23 +1970,23 @@ components: - $ref: '#/components/schemas/PreemptionVulnerability' - $ref: '#/components/schemas/NullValue' ReflectiveQoSAttribute: - anyOf: - - type: string +# anyOf: +# - type: string enum: - RQOS - NO_RQOS - - type: string + type: string ReflectiveQoSAttributeRm: anyOf: - $ref: '#/components/schemas/ReflectiveQoSAttribute' - $ref: '#/components/schemas/NullValue' NotificationControl: - anyOf: - - type: string +# anyOf: +# - type: string enum: - REQUESTED - NOT_REQUESTED - - type: string + type: string NotificationControlRm: anyOf: - $ref: '#/components/schemas/NotificationControl' @@ -1978,19 +1998,19 @@ components: - NON_GBR - NON_CRITICAL_GBR - CRITICAL_GBR - - type: string + type: string QosResourceTypeRm: anyOf: - $ref: '#/components/schemas/QosResourceType' - $ref: '#/components/schemas/NullValue' AdditionalQosFlowInfo: - anyOf: - - anyOf: - - type: string +# anyOf: +# - anyOf: +# - type: string enum: - MORE_LIKELY - - type: string - - $ref: '#/components/schemas/NullValue' + type: string +# - $ref: '#/components/schemas/NullValue' # # @@ -2011,19 +2031,9 @@ components: - preemptCap - preemptVuln ArpRm: - type: object - properties: - priorityLevel: - $ref: '#/components/schemas/ArpPriorityLevel' - preemptCap: - $ref: '#/components/schemas/PreemptionCapability' - preemptVuln: - $ref: '#/components/schemas/PreemptionVulnerability' - required: - - priorityLevel - - preemptCap - - preemptVuln - nullable: true + anyOf: + - $ref: '#/components/schemas/Arp' + - $ref: '#/components/schemas/NullValue' Ambr: type: object properties: @@ -2035,16 +2045,9 @@ components: - uplink - downlink AmbrRm: - type: object - properties: - uplink: - $ref: '#/components/schemas/BitRate' - downlink: - $ref: '#/components/schemas/BitRate' - required: - - uplink - - downlink - nullable: true + anyOf: + - $ref: '#/components/schemas/Ambr' + - $ref: '#/components/schemas/NullValue' Dynamic5Qi: type: object properties: @@ -2062,6 +2065,12 @@ components: $ref: '#/components/schemas/MaxDataBurstVol' extMaxDataBurstVol: $ref: '#/components/schemas/ExtMaxDataBurstVol' + extPacketDelBudget: + $ref: '#/components/schemas/ExtPacketDelBudget' + cnPacketDelayBudgetDl: + $ref: '#/components/schemas/ExtPacketDelBudget' + cnPacketDelayBudgetUl: + $ref: '#/components/schemas/ExtPacketDelBudget' required: - resourceType - priorityLevel @@ -2078,21 +2087,11 @@ components: $ref: '#/components/schemas/MaxDataBurstVol' extMaxDataBurstVol: $ref: '#/components/schemas/ExtMaxDataBurstVol' + cnPacketDelayBudgetDl: + $ref: '#/components/schemas/ExtPacketDelBudget' + cnPacketDelayBudgetUl: + $ref: '#/components/schemas/ExtPacketDelBudget' minProperties: 0 - Tmbr: - type: object - properties: - uplink: - $ref: '#/components/schemas/BitRate' - downlink: - $ref: '#/components/schemas/BitRate' - required: - - uplink - - downlink - TmbrRm: - anyOf: - - $ref: '#/components/schemas/Tmbr' - - $ref: '#/components/schemas/NullValue' # # Data Types related to 5G Trace as defined in clause 5.6 @@ -2101,13 +2100,21 @@ components: # # SIMPLE DATA TYPES # + PhysCellId: + type: integer + minimum: 0 + maximum: 1007 + ArfcnValueNR: + type: integer + minimum: 0 + maximum: 3279165 # # # Enumerations # TraceDepth: - anyOf: - - type: string +# anyOf: +# - type: string enum: - MINIMUM - MEDIUM @@ -2115,11 +2122,237 @@ components: - MINIMUM_WO_VENDOR_EXTENSION - MEDIUM_WO_VENDOR_EXTENSION - MAXIMUM_WO_VENDOR_EXTENSION - - type: string + type: string TraceDepthRm: anyOf: - $ref: '#/components/schemas/TraceDepth' - $ref: '#/components/schemas/NullValue' + JobType: +# anyOf: +# - type: string + enum: + - IMMEDIATE_MDT_ONLY + - LOGGED_MDT_ONLY + - TRACE_ONLY + - IMMEDIATE_MDT_AND_TRACE + - RLF_REPORTS_ONLY + - RCEF_REPORTS_ONLY + - LOGGED_MBSFN_MDT + type: string + ReportTypeMdt: +# anyOf: +# - type: string + enum: + - PERIODICAL + - EVENT_TRIGGED + type: string + MeasurementLteForMdt: +# anyOf: +# - type: string + enum: + - M1 + - M2 + - M3 + - M4_DL + - M4_UL + - M5_DL + - M5_UL + - M6_DL + - M6_UL + - M7_DL + - M7_UL + - M8 + - M9 + type: string + MeasurementNrForMdt: +# anyOf: +# - type: string + enum: + - M1 + - M2 + - M3 + - M4_DL + - M4_UL + - M5_DL + - M5_UL + - M6_DL + - M6_UL + - M7_DL + - M7_UL + - M8 + - M9 + type: string + SensorMeasurement: +# anyOf: +# - type: string + enum: + - BAROMETRIC_PRESSURE + - UE_SPEED + - UE_ORIENTATION + type: string + ReportingTrigger: +# anyOf: +# - type: string + enum: + - PERIODICAL + - EVENT_A2 + - EVENT_A2_PERIODIC + - ALL_RRM_EVENT_TRIGGERS + type: string + ReportIntervalMdt: +# anyOf: +# - type: string + enum: + - 120 + - 240 + - 480 + - 640 + - 1024 + - 2048 + - 5120 + - 10240 + - 60000 + - 360000 + - 720000 + - 1800000 + - 3600000 + type: string + ReportAmountMdt: +# anyOf: +# - type: string + enum: + - 1 + - 2 + - 4 + - 8 + - 16 + - 32 + - 64 + - infinity + type: string + EventForMdt: +# anyOf: +# - type: string + enum: + - OUT_OF_COVERAG + - A2_EVENT + type: string + LoggingIntervalMdt: +# anyOf: +# - type: string + enum: + - 128 + - 256 + - 512 + - 1024 + - 2048 + - 3072 + - 4096 + - 6144 + type: string + LoggingDurationMdt: +# anyOf: +# - type: string + enum: + - 600 + - 1200 + - 2400 + - 3600 + - 5400 + - 7200 + type: string + PositioningMethodMdt: +# anyOf: +# - type: string + enum: + - GNSS + - E_CELL_ID + type: string + CollectionPeriodRmmLteMdt: +# anyOf: +# - type: string + enum: + - 1024 + - 1280 + - 2048 + - 2560 + - 5120 + - 10240 + - 60000 + type: string + MeasurementPeriodLteMdt: +# anyOf: +# - type: string + enum: + - 1024 + - 1280 + - 2048 + - 2560 + - 5120 + - 10240 + - 60000 + type: string + + ReportIntervalNrMdt: +# anyOf: +# - type: string + enum: + - 120 + - 240 + - 480 + - 640 + - 1024 + - 2048 + - 5120 + - 10240 + - 20480 + - 40960 + - 60000 + - 360000 + - 720000 + - 1800000 + - 3600000 + type: string + + LoggingIntervalNrMdt: +# anyOf: +# - type: string + enum: + - 128 + - 256 + - 512 + - 1024 + - 2048 + - 3072 + - 4096 + - 6144 + - 320 + - 640 + - infinity + type: string + + CollectionPeriodRmmNrMdt: +# anyOf: +# - type: string + enum: + - 1024 + - 2048 + - 5120 + - 10240 + - 60000 + type: string + + LoggingDurationNrMdt: +# anyOf: +# - type: string + enum: + - 600 + - 1200 + - 2400 + - 3600 + - 5400 + - 7200 + type: string # # STRUCTURED DATA TYPES # @@ -2150,6 +2383,154 @@ components: - traceDepth - neTypeList - eventList + MdtConfiguration: + type: object + required: + - jobType + properties: + jobType: + $ref: '#/components/schemas/JobType' + reportType: + $ref: '#/components/schemas/ReportTypeMdt' + areaScope: + $ref: '#/components/schemas/AreaScope' + measurementLteList: + type: array + items: + $ref: '#/components/schemas/MeasurementLteForMdt' + measurementNrList: + type: array + items: + $ref: '#/components/schemas/MeasurementNrForMdt' + minItems: 1 + sensorMeasurementList: + type: array + items: + $ref: '#/components/schemas/SensorMeasurement' + minItems: 1 + reportingTriggerList: + type: array + items: + $ref: '#/components/schemas/ReportingTrigger' + minItems: 1 + reportInterval: + $ref: '#/components/schemas/ReportIntervalMdt' + reportIntervalNr: + $ref: '#/components/schemas/ReportIntervalNrMdt' + reportAmount: + $ref: '#/components/schemas/ReportAmountMdt' + eventThresholdRsrp: + type: integer + minimum: 0 + maximum: 97 + eventThresholdRsrpNr: + type: integer + minimum: 0 + maximum: 127 + eventThresholdRsrq: + type: integer + minimum: 0 + maximum: 34 + eventThresholdRsrqNr: + type: integer + minimum: 0 + maximum: 127 + eventList: + type: array + items: + $ref: '#/components/schemas/EventForMdt' + minItems: 1 + loggingInterval: + $ref: '#/components/schemas/LoggingIntervalMdt' + loggingIntervalNr: + $ref: '#/components/schemas/LoggingIntervalNrMdt' + loggingDuration: + $ref: '#/components/schemas/LoggingDurationMdt' + loggingDurationNr: + $ref: '#/components/schemas/LoggingDurationNrMdt' + positioningMethod: + $ref: '#/components/schemas/PositioningMethodMdt' + collectionPeriodRmmLte: + $ref: '#/components/schemas/CollectionPeriodRmmLteMdt' + collectionPeriodRmmNr: + $ref: '#/components/schemas/CollectionPeriodRmmNrMdt' + measurementPeriodLte: + $ref: '#/components/schemas/MeasurementPeriodLteMdt' + mdtAllowedPlmnIdList: + type: array + items: + $ref: '#/components/schemas/PlmnId' + minItems: 1 + maxItems: 16 + mbsfnAreaList: + type: array + items: + $ref: '#/components/schemas/MbsfnArea' + minItems: 1 + maxItems: 8 + interFreqTargetList: + type: array + items: + $ref: '#/components/schemas/InterFreqTargetInfo' + minItems: 1 + maxItems: 8 + AreaScope: + type: object + properties: + eutraCellIdList: + type: array + items: + $ref: '#/components/schemas/EutraCellId' + minItems: 1 + nrCellIdList: + type: array + items: + $ref: '#/components/schemas/NrCellId' + minItems: 1 + tacList: + type: array + items: + $ref: '#/components/schemas/Tac' + minItems: 1 + tacInfoPerPlmn: + type: object + additionalProperties: + $ref: '#/components/schemas/TacInfo' + TacInfo: + type: object + required: + - tacList + properties: + tacList: + type: array + items: + $ref: '#/components/schemas/Tac' + minItems: 1 + MbsfnArea: + type: object + properties: + mbsfnAreaId: + type: integer + minimum: 0 + maximum: 255 + carrierFrequency: + type: integer + minimum: 0 + maximum: 262143 + + InterFreqTargetInfo: + required: + - dlCarrierFreq + type: object + properties: + dlCarrierFreq: + $ref: '#/components/schemas/ArfcnValueNR' + cellIdList: + type: array + items: + $ref: '#/components/schemas/PhysCellId' + minItems: 1 + maxItems: 32 # Data Types related to 5G ODB as defined in clause 5.7 @@ -2162,23 +2543,23 @@ components: # Enumerations # RoamingOdb: - anyOf: - - type: string +# anyOf: +# - type: string enum: - OUTSIDE_HOME_PLMN - OUTSIDE_HOME_PLMN_COUNTRY - - type: string + type: string OdbPacketServices: - anyOf: - - anyOf: - - type: string +# anyOf: +# - anyOf: +# - type: string enum: - ALL_PACKET_SERVICES - ROAMER_ACCESS_HPLMN_AP - ROAMER_ACCESS_VPLMN_AP - - type: string - - $ref: '#/components/schemas/NullValue' + type: string +# - $ref: '#/components/schemas/NullValue' # # STRUCTURED DATA TYPES diff --git a/lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml b/lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml index 4747cd33b..ec991f551 100644 --- a/lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml +++ b/lib/sbi/support/standard/TS29502_Nsmf_PDUSession.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.2' title: 'Nsmf_PDUSession' description: | SMF PDU Session Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.502 V16.3.0; 5G System; Session Management Services; Stage 3 + description: 3GPP TS 29.502 V16.6.0; 5G System; Session Management Services; Stage 3 url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.502/ servers: @@ -86,12 +86,36 @@ paths: description: successful notification '307': description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: required: true description: 'A URI pointing to the endpoint of another NF service consumer to which the notification should be sent' schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + required: true + description: 'A URI pointing to the endpoint of another NF service consumer to which the notification should be sent' + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -145,20 +169,36 @@ paths: '307': description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set ' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '308': description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set ' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': description: unsuccessful creation of an SM context - bad request content: @@ -174,6 +214,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -183,6 +226,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '403': description: unsuccessful creation of an SM context - forbidden content: @@ -198,6 +247,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -207,6 +259,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '404': description: unsuccessful creation of an SM context - not found content: @@ -222,6 +280,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -231,14 +292,20 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': - $ref: 'TS29571_CommonData.yaml#/components/responses/413' + $ref: '#/components/responses/413' '415': - $ref: 'TS29571_CommonData.yaml#/components/responses/415' + $ref: '#/components/responses/415' '429': - $ref: 'TS29571_CommonData.yaml#/components/responses/429' + $ref: '#/components/responses/429' '500': description: unsuccessful creation of an SM context - internal server error @@ -255,6 +322,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -264,6 +334,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '503': description: unsuccessful creation of an SM context - service unavailable content: @@ -279,6 +355,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -288,6 +367,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string '504': description: unsuccessful creation of an SM context - gateway timeout @@ -304,6 +389,9 @@ paths: binaryDataN1SmMessage: type: string format: binary + binaryDataN2SmMessage: + type: string + format: binary encoding: jsonData: contentType: application/json @@ -313,6 +401,12 @@ paths: Content-Id: schema: type: string + binaryDataN2SmMessage: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' @@ -344,6 +438,38 @@ paths: application/json: schema: $ref: '#/components/schemas/SmContextRetrievedData' + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -459,6 +585,38 @@ paths: type: string '204': description: successful update of an SM context without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': description: unsuccessful update of an SM context - bad request content: @@ -561,11 +719,11 @@ paths: '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': - $ref: 'TS29571_CommonData.yaml#/components/responses/413' + $ref: '#/components/responses/413' '415': - $ref: 'TS29571_CommonData.yaml#/components/responses/415' + $ref: '#/components/responses/415' '429': - $ref: 'TS29571_CommonData.yaml#/components/responses/429' + $ref: '#/components/responses/429' '500': description: unsuccessful update of an SM context - Internal server error content: @@ -678,11 +836,43 @@ paths: '200': description: successful release of a PDU session with content in the response content: - application/json: # message without binary body part + application/json: # message without binary body part schema: $ref: '#/components/schemas/SmContextReleasedData' '204': description: successful release of an SM context without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -724,7 +914,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/SendMoDataReqData' binaryMoData: @@ -742,26 +932,58 @@ paths: responses: '204': description: successful sending of MO data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': - $ref: 'TS29571_CommonData.yaml#/components/responses/400' + $ref: '#/components/responses/400' '401': - $ref: 'TS29571_CommonData.yaml#/components/responses/401' + $ref: '#/components/responses/401' '403': - $ref: 'TS29571_CommonData.yaml#/components/responses/403' + $ref: '#/components/responses/403' '404': - $ref: 'TS29571_CommonData.yaml#/components/responses/404' + $ref: '#/components/responses/404' '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': - $ref: 'TS29571_CommonData.yaml#/components/responses/413' + $ref: '#/components/responses/413' '415': - $ref: 'TS29571_CommonData.yaml#/components/responses/415' + $ref: '#/components/responses/415' '429': - $ref: 'TS29571_CommonData.yaml#/components/responses/429' + $ref: '#/components/responses/429' '500': - $ref: 'TS29571_CommonData.yaml#/components/responses/500' + $ref: '#/components/responses/500' '503': - $ref: 'TS29571_CommonData.yaml#/components/responses/503' + $ref: '#/components/responses/503' default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' @@ -818,6 +1040,38 @@ paths: responses: '204': description: successful notificationof the status change + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -850,6 +1104,38 @@ paths: responses: '204': description: successful notificationof the status change + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -886,12 +1172,46 @@ paths: $ref: '#/components/responses/VsmfUpdateResponse200' '204': description: successful update of a PDU session without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/VsmfUpdateError' '403': $ref: '#/components/responses/VsmfUpdateError' '404': $ref: '#/components/responses/VsmfUpdateError' + '409': + $ref: '#/components/responses/VsmfUpdateError' '411': $ref: 'TS29571_CommonData.yaml#/components/responses/411' '413': @@ -923,6 +1243,38 @@ paths: $ref: '#/components/responses/VsmfUpdateResponse200' '204': description: successful update of a PDU session without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/VsmfUpdateError' '403': @@ -960,7 +1312,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/TransferMtDataReqData' binaryMtData: @@ -978,6 +1330,38 @@ paths: responses: '204': description: successful transfering of MT data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -1021,7 +1405,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/TransferMtDataReqData' binaryMtData: @@ -1039,6 +1423,38 @@ paths: responses: '204': description: successful transfering of MT data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -1101,20 +1517,32 @@ paths: type: string '307': description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '308': description: permanent redirect headers: Location: - description: 'An alternative URI of the resource located on an alternative service instance within the SMF that was selected by the AMF' + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/PduSessionCreateError' '403': @@ -1264,6 +1692,38 @@ paths: type: string '204': description: successful update of a PDU session without content in the response + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: '#/components/responses/HsmfUpdateError' '403': @@ -1299,21 +1759,126 @@ paths: schema: type: string requestBody: - description: representation of the data to be sent to H-SMF or SMF when releasing the PDU session + description: data sent to H-SMF or SMF when releasing the PDU session required: false content: - application/json: + application/json: # message without binary body part schema: $ref: '#/components/schemas/ReleaseData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/ReleaseData' + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + responses: '200': description: successful release of a PDU session with content in the response content: - application/json: # message without binary body part + application/json: # message without binary body part schema: $ref: '#/components/schemas/ReleasedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/ReleasedData' + binaryDataN4Information: + type: string + format: binary + binaryDataN4InformationExt1: + type: string + format: binary + binaryDataN4InformationExt2: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN4Information: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt1: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string + binaryDataN4InformationExt2: + contentType: application/vnd.3gpp.pfcp + headers: + Content-Id: + schema: + type: string '204': description: successful release of a PDU session + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -1335,6 +1900,88 @@ paths: default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /pdu-sessions/{pduSessionRef}/retrieve: + post: + summary: Retrieve + tags: + - Individual PDU session (H-SMF or SMF) + operationId: RetrievePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the payload of the Retrieve Request + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RetrieveData' + responses: + '200': + description: successful information retrieval + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/RetrievedData' + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + '504': + $ref: 'TS29571_CommonData.yaml#/components/responses/504' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /pdu-sessions/{pduSessionRef}/transfer-mo-data: post: summary: Transfer MO Data @@ -1355,7 +2002,7 @@ paths: multipart/related: # message with a binary body part schema: type: object - properties: + properties: jsonData: $ref: '#/components/schemas/TransferMoDataReqData' binaryMoData: @@ -1373,6 +2020,38 @@ paths: responses: '204': description: successful transfering of MO data + '307': + description: temporary redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string + '308': + description: permanent redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'An alternative URI of the resource located on an alternative service instance within the same SMF or SMF (service) set' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target SMF (service) instance towards which the request is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -1426,6 +2105,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' dnn: $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + selectedDnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' sNssai: $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' hplmnSnssai: @@ -1460,18 +2141,32 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' hSmfUri: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + hSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' smfUri: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' additionalHsmfUri: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 + additionalHsmfId: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 additionalSmfUri: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 + additionalSmfId: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 oldPduSessionId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' pduSessionsActivateList: @@ -1510,6 +2205,8 @@ components: $ref: '#/components/schemas/EpsInterworkingIndication' indirectForwardingFlag: type: boolean + directForwardingFlag: + type: boolean targetId: $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' epsBearerCtxStatus: @@ -1539,6 +2236,14 @@ components: $ref: '#/components/schemas/N2SmInfoType' smContextRef: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smContextSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smContextSmfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + smContextSmfServiceSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' + smContextSmfBinding: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/SbiBindingLevel' upCnxState: $ref: '#/components/schemas/UpCnxState' smallDataRateStatus: @@ -1604,6 +2309,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' supportedFeatures: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + selectedSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + selectedOldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' SmContextUpdateData: type: object @@ -1626,6 +2335,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' additionalAnType: $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + anTypeToReactivate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' ratType: $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' presenceInLadn: @@ -1716,8 +2427,6 @@ components: $ref: '#/components/schemas/ExemptionInd' supportedFeatures: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' extendedNasSmTimerInd: @@ -1791,6 +2500,10 @@ components: items: $ref: '#/components/schemas/ForwardingBearerContainer' minItems: 1 + selectedSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + selectedOldSmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' SmContextReleaseData: type: object @@ -1838,6 +2551,11 @@ components: ddnFailureStatus: type: boolean default: false + notifyCorrelationIdsForddnFailure: + type: array + items: + type: string + minItems: 1 newSmfId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' newSmfSetId: @@ -1863,6 +2581,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' dnn: $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + selectedDnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' sNssai: $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' vsmfId: @@ -1951,6 +2671,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' guami: $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + maxIntegrityProtectedDataRateUl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' cpCiotEnabled: type: boolean default: false @@ -1985,6 +2709,10 @@ components: dlServingPlmnRateCtl: type: integer minimum: 10 + upSecurityInfo: + $ref: '#/components/schemas/UpSecurityInfo' + vplmnQos: + $ref: '#/components/schemas/VplmnQos' required: - dnn - servingNetwork @@ -2042,6 +2770,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' maxIntegrityProtectedDataRate: $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' alwaysOnGranted: type: boolean default: false @@ -2073,6 +2803,16 @@ components: nefExtBufSupportInd: type: boolean default: false + smallDataRateControlEnabled: + type: boolean + default: false + ueIpv6InterfaceId: + type: string + pattern: '^[A-Fa-f0-9]{16}$' + ipv6Index: + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/IpIndex' + dnAaaAddress: + $ref: '#/components/schemas/IpAddress' required: - pduSessionType - sscMode @@ -2216,12 +2956,14 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' roamingChargingProfile: $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' vplmnQos: $ref: '#/components/schemas/VplmnQos' + securityResult: + $ref: '#/components/schemas/SecurityResult' + upSecurityInfo: + $ref: '#/components/schemas/UpSecurityInfo' required: - requestIndication @@ -2245,6 +2987,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' roamingChargingProfile: $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + maxIntegrityProtectedDataRateUl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' ipv6MultiHomingInd: type: boolean default: false @@ -2274,6 +3022,12 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' minItems: 1 + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' ReleasedData: type: object @@ -2282,6 +3036,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' apnRateStatus: $ref: 'TS29571_CommonData.yaml#/components/schemas/ApnRateStatus' + n4Info: + $ref: '#/components/schemas/N4Information' + n4InfoExt1: + $ref: '#/components/schemas/N4Information' + n4InfoExt2: + $ref: '#/components/schemas/N4Information' VsmfUpdateData: type: object @@ -2354,6 +3114,10 @@ components: $ref: '#/components/schemas/N4Information' n4InfoExt2: $ref: '#/components/schemas/N4Information' + smallDataRateControlEnabled: + type: boolean + qosMonitoringInfo: + $ref: '#/components/schemas/QosMonitoringInfo' required: - requestIndication @@ -2420,7 +3184,7 @@ components: n4InfoExt1: $ref: '#/components/schemas/N4Information' n4InfoExt2: - $ref: '#/components/schemas/N4Information' + $ref: '#/components/schemas/N4Information' StatusNotification: type: object @@ -2441,6 +3205,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' cause: $ref: '#/components/schemas/Cause' + currentQosProfileIndex: + type: integer + minimum: 1 + maximum: 8 + nullQoSProfileIndex: + type: boolean required: - qfi @@ -2510,6 +3280,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/ReflectiveQoSAttribute' additionalQosFlowInfo: $ref: 'TS29571_CommonData.yaml#/components/schemas/AdditionalQosFlowInfo' + qosMonitoringReq: + $ref: '#/components/schemas/QosMonitoringReq' + qosRepPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' required: - 5qi @@ -2530,6 +3304,10 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' maxPacketLossRateUl: $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + alternativeQosProfileList: + type: array + items: + $ref: '#/components/schemas/AlternativeQosProfile' required: - maxFbrDl - maxFbrUl @@ -2543,6 +3321,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' notificationCause: $ref: '#/components/schemas/NotificationCause' + currentQosProfileIndex: + type: integer + minimum: 1 + maximum: 8 + nullQoSProfileIndex: + type: boolean required: - qfi - notificationCause @@ -2668,9 +3452,13 @@ components: type: object properties: error: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ExtProblemDetails' n1SmMsg: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' recoveryTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' required: @@ -2680,7 +3468,7 @@ components: type: object properties: error: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ExtProblemDetails' n1SmMsg: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' n2SmInfo: @@ -2760,7 +3548,7 @@ components: n4InfoExt1: $ref: '#/components/schemas/N4Information' n4InfoExt2: - $ref: '#/components/schemas/N4Information' + $ref: '#/components/schemas/N4Information' required: - error @@ -2808,6 +3596,12 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' smfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pduSessionSmfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + pduSessionSmfServiceSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' + pduSessionSmfBinding: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/SbiBindingLevel' enablePauseCharging: type: boolean default: false @@ -2849,6 +3643,10 @@ components: nefExtBufSupportInd: type: boolean default: false + ipv6Index: + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/IpIndex' + dnAaaAddress: + $ref: '#/components/schemas/IpAddress' required: - pduSessionId - dnn @@ -2921,7 +3719,7 @@ components: $ref: '#/components/schemas/Teid' drbId: $ref: '#/components/schemas/DrbId' - additionalTnlNb: + additionalTnlNb: $ref: '#/components/schemas/AdditionalTnlNb' required: - gtpTeid @@ -2933,8 +3731,6 @@ components: properties: moData: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' ueLocation: @@ -2971,8 +3767,6 @@ components: properties: moData: $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' - moExpDataInd: - $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExceptionDataFlag' moExpDataCounter: $ref: 'TS29571_CommonData.yaml#/components/schemas/MoExpDataCounter' ueLocation: @@ -3023,12 +3817,114 @@ components: ddnFailureSubsInd: type: boolean default: false + ddnFailureSubsInfoList: + type: array + items: + $ref: '#/components/schemas/DdnFailureSubInfo' + minItems: 1 + + DdnFailureSubInfo: + type: object + required: + - notifyCorrelationId + properties: + notifyCorrelationId: + type: string dddTrafficDescriptorList: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' minItems: 1 + RetrieveData: + type: object + properties: + smallDataRateStatusReq: + type: boolean + default: false + + RetrievedData: + type: object + properties: + smallDataRateStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SmallDataRateStatus' + + SecurityResult: + type: object + properties: + integrityProtectionResult: + $ref: '#/components/schemas/ProtectionResult' + confidentialityProtectionResult: + $ref: '#/components/schemas/ProtectionResult' + + UpSecurityInfo: + type: object + properties: + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + maxIntegrityProtectedDataRateUl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + maxIntegrityProtectedDataRateDl: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + securityResult: + $ref: '#/components/schemas/SecurityResult' + required: + - upSecurity + + AlternativeQosProfile: + type: object + properties: + index: + type: integer + minimum: 1 + maximum: 8 + guaFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + packetDelayBudget: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudget' + packetErrRate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketErrRate' + required: + - index + + ExtProblemDetails: + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + - $ref: '#/components/schemas/ProblemDetailsAddInfo' + + ProblemDetailsAddInfo: + type: object + properties: + remoteError: + type: boolean + + QosMonitoringInfo: + type: object + properties: + qosMonitoringInd: + type: boolean + default: false + + IpAddress: + type: object + oneOf: + - required: + - ipv4Addr + - required: + - ipv6Addr + - required: + - ipv6Prefix + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + ipv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + + # # SIMPLE DATA TYPES # @@ -3050,7 +3946,7 @@ components: Teid: type: string - pattern: '^[A-F0-9]{8}$' + pattern: '^[A-Fa-f0-9]{8}$' EpsBearerContextStatus: type: string @@ -3145,6 +4041,7 @@ components: - NW_REQ_PDU_SES_MOD - NW_REQ_PDU_SES_REL - EBI_ASSIGNMENT_REQ + - REL_DUE_TO_5G_AN_REQUEST - type: string description: > This string provides forward-compatibility with future @@ -3159,6 +4056,7 @@ components: - NW_REQ_PDU_SES_MOD - NW_REQ_PDU_SES_REL - EBI_ASSIGNMENT_REQ + - REL_DUE_TO_5G_AN_REQUEST NotificationCause: anyOf: @@ -3207,7 +4105,8 @@ components: - REL_DUE_TO_SLICE_NOT_AUTHORIZED - PDU_SESSION_HAND_OVER_FAILURE - DDN_FAILURE_STATUS - + - REL_DUE_TO_CP_ONLY_NOT_APPLICABLE + - NOT_SUPPORTED_WITH_ISMF - type: string description: > This string provides forward-compatibility with future @@ -3238,6 +4137,8 @@ components: - REL_DUE_TO_SLICE_NOT_AUTHORIZED - PDU_SESSION_HAND_OVER_FAILURE - DDN_FAILURE_STATUS + - REL_DUE_TO_CP_ONLY_NOT_APPLICABLE + - NOT_SUPPORTED_WITH_ISMF ResourceStatus: anyOf: @@ -3322,6 +4223,7 @@ components: - HANDOVER_REQ_ACK - HANDOVER_RES_ALLOC_FAIL - SECONDARY_RAT_USAGE + - PDU_RES_MOD_IND_FAIL - type: string description: > This string provides forward-compatibility with future @@ -3351,6 +4253,7 @@ components: - HANDOVER_REQ_ACK - HANDOVER_RES_ALLOC_FAIL - SECONDARY_RAT_USAGE + - PDU_RES_MOD_IND_FAIL MaxIntegrityProtectedDataRate: anyOf: @@ -3478,6 +4381,42 @@ components: - 3GA_UNAVAILABLE - N3GA_UNAVAILABLE + ProtectionResult: + anyOf: + - type: string + enum: + - PERFORMED + - NOT_PERFORMED + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - PERFORMED + - NOT_PERFORMED + + QosMonitoringReq: + anyOf: + - type: string + enum: + - UL + - DL + - BOTH + - NONE + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - UL + - DL + - BOTH + - NONE + # # HTTP request bodies # @@ -3521,7 +4460,7 @@ components: headers: Content-Id: schema: - type: string + type: string binaryDataN4InformationExt1: contentType: application/vnd.3gpp.pfcp headers: @@ -3594,7 +4533,7 @@ components: headers: Content-Id: schema: - type: string + type: string binaryDataN4InformationExt1: contentType: application/vnd.3gpp.pfcp headers: @@ -3718,3 +4657,58 @@ components: Content-Id: schema: type: string + + '400': + description: Bad request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '401': + description: Unauthorized + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '403': + description: Forbidden + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '404': + description: Not Found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '413': + description: Payload Too Large + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '415': + description: Unsupported Media Type + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '429': + description: Too Many Requests + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' diff --git a/lib/sbi/support/standard/TS29503_Nudm_EE.yaml b/lib/sbi/support/standard/TS29503_Nudm_EE.yaml index ca3c0441e..494331891 100644 --- a/lib/sbi/support/standard/TS29503_Nudm_EE.yaml +++ b/lib/sbi/support/standard/TS29503_Nudm_EE.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.1' title: 'Nudm_EE' description: | Nudm Event Exposure Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -172,11 +172,11 @@ paths: application/json: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' - '204': + '204': description: Successful response - '403': + '403': $ref: 'TS29571_CommonData.yaml#/components/responses/403' - '404': + '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: description: Unexpected error @@ -185,8 +185,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-ee: Access to the nudm-ee API @@ -210,6 +210,8 @@ components: items: $ref: '#/components/schemas/MonitoringReport' minItems: 1 + epcStatusInd: + type: boolean EeSubscription: type: object @@ -224,13 +226,24 @@ components: type: object additionalProperties: $ref: '#/components/schemas/MonitoringConfiguration' - minProperties: 1 + minProperties: 1 reportingOptions: $ref: '#/components/schemas/ReportingOptions' supportedFeatures: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' subscriptionId: type: string + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' + epcAppliedInd: + type: boolean + default: false + scefDiamHost: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + scefDiamRealm: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + notifyCorrelationId: + type: string MonitoringConfiguration: @@ -248,6 +261,30 @@ components: $ref: '#/components/schemas/AssociationType' datalinkReportCfg: $ref: '#/components/schemas/DatalinkReportingConfiguration' + lossConnectivityCfg: + $ref: '#/components/schemas/LossConnectivityCfg' + maximumLatency: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + maximumResponseTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + suggestedPacketNumDl: + type: integer + minimum: 1 + pduSessionStatusCfg: + $ref: '#/components/schemas/PduSessionStatusCfg' + reachabilityForSmsCfg: + $ref: '#/components/schemas/ReachabilityForSmsConfiguration' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' + afId: + type: string + + + LossConnectivityCfg: + type: object + properties: + maxDetectionTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' LocationReportingConfiguration: type: object @@ -313,7 +350,8 @@ components: properties: smsfAccessType: $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' - + maxAvailabilityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' ChangeOfSupiPeiAssociationReport: type: object required: @@ -380,6 +418,11 @@ components: required: - newCmInfoList + PduSessionStatusCfg: + type: object + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' # SIMPLE TYPES: @@ -392,6 +435,14 @@ components: # ENUMS: + ReachabilityForSmsConfiguration: + anyOf: + - type: string + enum: + - REACHABILITY_FOR_SMS_OVER_NAS + - REACHABILITY_FOR_SMS_OVER_IP + - type: string + EventType: anyOf: - type: string @@ -445,4 +496,3 @@ components: - PERIODIC - ON_EVENT_DETECTION - type: string - diff --git a/lib/sbi/support/standard/TS29503_Nudm_MT.yaml b/lib/sbi/support/standard/TS29503_Nudm_MT.yaml index d2d357974..1a9711204 100644 --- a/lib/sbi/support/standard/TS29503_Nudm_MT.yaml +++ b/lib/sbi/support/standard/TS29503_Nudm_MT.yaml @@ -1,14 +1,14 @@ openapi: 3.0.0 info: - version: '1.0.0.alpha-2' - title: 'NudmMT' + version: '1.0.1' + title: 'Nudm_MT' description: | UDM MT Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.5.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -116,8 +116,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-mt: Access to the nudm-mt API @@ -134,6 +134,20 @@ components: $ref: 'TS29518_Namf_MT.yaml#/components/schemas/UeContextInfo' userState: $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/5GsUserState' + 5gSrvccInfo: + $ref: '#/components/schemas/5GSrvccInfo' + + 5GSrvccInfo: + type: object + required: + - ue5GSrvccCapability + properties: + ue5GSrvccCapability: + type: boolean + stnSr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/StnSr' + cMsisdn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CMsisdn' LocationInfoRequest: type: object @@ -152,7 +166,7 @@ components: default: false reqServingNode: type: boolean - default: false + default: false supportedFeatures: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' @@ -160,17 +174,17 @@ components: type: object properties: vPlmnId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' amfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' smsfInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' ncgi: $ref: 'TS29571_CommonData.yaml#/components/schemas/Ncgi' ecgi: $ref: 'TS29571_CommonData.yaml#/components/schemas/Ecgi' tai: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' currentLoc: type: boolean geoInfo: diff --git a/lib/sbi/support/standard/TS29503_Nudm_NIDDAU.yaml b/lib/sbi/support/standard/TS29503_Nudm_NIDDAU.yaml index 62e1fae9f..896275787 100644 --- a/lib/sbi/support/standard/TS29503_Nudm_NIDDAU.yaml +++ b/lib/sbi/support/standard/TS29503_Nudm_NIDDAU.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.0.0.alpha-4' + version: '1.0.1' title: 'Nudm_NIDDAU' description: | Nudm NIDD Authorization Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -158,6 +158,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' authUpdateCallbackUri: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + afId: + type: string # SIMPLE TYPES: diff --git a/lib/sbi/support/standard/TS29503_Nudm_PP.yaml b/lib/sbi/support/standard/TS29503_Nudm_PP.yaml index 8d3d6e6ce..df634e5a0 100644 --- a/lib/sbi/support/standard/TS29503_Nudm_PP.yaml +++ b/lib/sbi/support/standard/TS29503_Nudm_PP.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-3' + version: '1.1.2' title: 'Nudm_PP' description: | Nudm Parameter Provision Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -36,8 +36,10 @@ paths: in: path description: Identifier of the UE required: true - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + schema: + anyOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExtGroupId' - name: supported-features in: query description: Features required to be supported by the target NF @@ -70,14 +72,14 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error - /5g-vn-groups/{external-group-id}: + /5g-vn-groups/{extGroupId}: put: summary: create a 5G VN Group operationId: Create 5G VN Group tags: - 5G VN Group Creation parameters: - - name: external-group-id + - name: extGroupId in: path description: External Identifier of the Group required: true @@ -110,7 +112,7 @@ paths: tags: - 5G VN Group Deletion parameters: - - name: external-group-id + - name: extGroupId in: path description: External Identifier of the Group required: true @@ -137,7 +139,7 @@ paths: tags: - 5G VN Group Modification parameters: - - name: external-group-id + - name: extGroupId in: path description: External Identifier of the group required: true @@ -175,14 +177,45 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error + get: + summary: get 5G VN Group + operationId: Get 5G VN Group + tags: + - 5G VN Group Modification + parameters: + - name: extGroupId + in: path + description: External Identifier of the group + required: true + schema: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExtGroupId' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/5GVnGroupConfiguration' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error -components: +components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-pp: Access to the nudm-pp API @@ -209,6 +242,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/StnSrRm' lcsPrivacy: $ref: '#/components/schemas/LcsPrivacy' + sorInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/SorInfo' CommunicationCharacteristics: type: object @@ -237,11 +272,13 @@ components: subsRegTimer: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true PpActiveTime: @@ -254,11 +291,13 @@ components: activeTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true 5GVnGroupConfiguration: @@ -274,9 +313,11 @@ components: referenceId: $ref: '#/components/schemas/ReferenceId' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string internalGroupIdentifier: $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' 5GVnGroupData: type: object @@ -298,6 +339,10 @@ components: items: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/AppDescriptor' minItems: 1 + secondaryAuth: + type: boolean + dnAaaAddress: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/IpAddress' ExpectedUeBehaviour: type: object @@ -306,7 +351,7 @@ components: - referenceId properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' stationaryIndication: @@ -332,6 +377,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/BatteryIndicationRm' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' LocationArea: type: object @@ -387,7 +434,7 @@ components: - referenceId properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' plmnEcInfos: @@ -395,6 +442,8 @@ components: items: $ref: '#/components/schemas/PlmnEcInfo' minItems: 1 + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' PlmnEcInfo: type: object @@ -403,10 +452,11 @@ components: properties: plmnId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - ecModeARestricted: - type: boolean - ecModeBRestricted: + ecRestrictionDataWb: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/EcRestrictionDataWb' + ecRestrictionDataNb: type: boolean + default: false PpDlPacketCountExt: @@ -416,11 +466,13 @@ components: - referenceId properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true PpMaximumResponseTime: @@ -433,11 +485,13 @@ components: maximumResponseTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true PpMaximumLatency: @@ -450,22 +504,26 @@ components: maximumLatency: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' nullable: true LcsPrivacy: type: object properties: afInstanceId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + type: string referenceId: $ref: '#/components/schemas/ReferenceId' lpi: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/Lpi' + mtcProviderInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' # SIMPLE TYPES: diff --git a/lib/sbi/support/standard/TS29503_Nudm_SDM.yaml b/lib/sbi/support/standard/TS29503_Nudm_SDM.yaml index 9bff7dac8..972c5167e 100644 --- a/lib/sbi/support/standard/TS29503_Nudm_SDM.yaml +++ b/lib/sbi/support/standard/TS29503_Nudm_SDM.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '2.1.0.alpha-4' + version: '2.1.2' title: 'Nudm_SDM' description: | Nudm Subscriber Data Management Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -60,12 +60,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -81,11 +81,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -125,12 +125,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -142,15 +142,15 @@ paths: $ref: '#/components/schemas/Nssai' headers: Cache-Control: - description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -163,6 +163,41 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error + /{supi}/ue-context-in-amf-data: + get: + summary: retrieve a UE's UE Context In AMF Data + operationId: GetUeCtxInAmfData + tags: + - UE Context In AMF Data Retrieval + parameters: + - name: supi + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextInAmfData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error /{supi}/am-data: get: summary: retrieve a UE's Access and Mobility Subscription Data @@ -190,12 +225,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -211,11 +246,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -248,12 +283,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -269,11 +304,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -313,12 +348,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -334,11 +369,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -448,12 +483,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -469,11 +504,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -522,12 +557,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -546,11 +581,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -589,12 +624,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -610,11 +645,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -653,12 +688,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -674,11 +709,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -711,12 +746,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -732,11 +767,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -768,20 +803,14 @@ paths: description: Supported Features schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - - name: plmn-id - in: query - content: - application/json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -797,11 +826,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -814,6 +843,130 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: description: Unexpected error + /{supi}/lcs-bca-data: + get: + summary: retrieve a UE's LCS Broadcast Assistance Data Types Subscription Data + operationId: GetLcsBcaData + tags: + - LCS Broadcast Assistance Data Types Retrieval + parameters: + - name: supi + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: plmn-id + in: query + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + + /{supi}/v2x-data: + get: + summary: retrieve a UE's V2X Subscription Data + operationId: GetV2xData + tags: + - V2X Subscription Data Retrieval + parameters: + - name: supi + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/V2xSubscriptionData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /{ueId}/sdm-subscriptions: post: summary: subscribe to notifications @@ -883,6 +1036,10 @@ paths: required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '308': description: Permanent Redirect content: @@ -895,6 +1052,10 @@ paths: required: true schema: type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -1014,12 +1175,12 @@ paths: $ref: '#/components/schemas/AppPortId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -1035,11 +1196,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -1225,12 +1386,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -1249,11 +1410,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -1310,6 +1471,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -1329,7 +1522,7 @@ paths: parameters: - name: subscriptionId in: path - description: Id of the Shared data Subscription + description: Id of the Shared data Subscription required: true schema: type: string @@ -1424,12 +1617,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -1445,11 +1638,11 @@ paths: schema: type: string ETag: - description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 schema: type: string Last-Modified: - description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string '400': @@ -1467,8 +1660,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-sdm: Access to the nudm-sdm API @@ -1479,7 +1672,7 @@ components: DatasetNames: type: array - items: + items: $ref: '#/components/schemas/DataSetName' minItems: 2 uniqueItems: true @@ -1491,6 +1684,8 @@ components: $ref: '#/components/schemas/AccessAndMobilitySubscriptionData' smfSelData: $ref: '#/components/schemas/SmfSelectionSubscriptionData' + uecAmfData: + $ref: '#/components/schemas/UeContextInAmfData' uecSmfData: $ref: '#/components/schemas/UeContextInSmfData' uecSmsfData: @@ -1510,6 +1705,10 @@ components: $ref: '#/components/schemas/LcsPrivacyData' lcsMoData: $ref: '#/components/schemas/LcsMoData' + v2xData: + $ref: '#/components/schemas/V2xSubscriptionData' + lcsBroadcastAssistanceTypesData: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' UeContextInSmsfData: type: object @@ -1544,11 +1743,6 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' minItems: 1 - vnGroupInfo: - type: object - additionalProperties: - $ref: '#/components/schemas/VnGroupData' - minProperties: 1 sharedVnGroupDataIds: type: object additionalProperties: @@ -1584,8 +1778,6 @@ components: $ref: '#/components/schemas/McsPriorityIndicator' activeTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' - dlPacketCount: - $ref: '#/components/schemas/DlPacketCount' sorInfo: $ref: '#/components/schemas/SorInfo' sorInfoExpectInd: @@ -1602,7 +1794,7 @@ components: $ref: '#/components/schemas/UpuInfo' micoAllowed: $ref: '#/components/schemas/MicoAllowed' - sharedAmDataIds: + sharedAmDataIds: type: array items: $ref: '#/components/schemas/SharedDataId' @@ -1617,6 +1809,10 @@ components: - $ref: 'TS29571_CommonData.yaml#/components/schemas/WildcardDnn' serviceGapTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + mdtUserConsent: + $ref: '#/components/schemas/MdtUserConsent' + mdtConfiguration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MdtConfiguration' traceData: $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' cagData: @@ -1632,22 +1828,13 @@ components: default: false rgWirelineCharacteristics: $ref: 'TS29571_CommonData.yaml#/components/schemas/RgWirelineCharacteristics' - rgTMBR: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Tmbr' - ecRestrictionData: - $ref: '#/components/schemas/EcRestrictionData' + ecRestrictionDataWb: + $ref: '#/components/schemas/EcRestrictionDataWb' + ecRestrictionDataNb: + type: boolean + default: false expectedUeBehaviourList: $ref: '#/components/schemas/ExpectedUeBehaviourData' - maximumResponseTimeList: - type: array - items: - $ref: '#/components/schemas/MaximumResponseTime' - minItems: 1 - maximumLatencyList: - type: array - items: - $ref: '#/components/schemas/MaximumLatency' - minItems: 1 primaryRatRestrictions: type: array items: @@ -1669,14 +1856,12 @@ components: iabOperationAllowed: type: boolean default: false - nrV2xServicesAuth: - $ref: 'TS29571_CommonData.yaml#/components/schemas/NrV2xAuth' - lteV2xServicesAuth: - $ref: 'TS29571_CommonData.yaml#/components/schemas/LteV2xAuth' - nrUePc5Ambr: - $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' - ltePc5Ambr: - $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + wirelineForbiddenAreas: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineArea' + wirelineServiceAreaRestriction: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' CagData: type: object @@ -1743,6 +1928,15 @@ components: $ref: '#/components/schemas/IwkEpsInd' dnnBarred: type: boolean + invokeNefInd: + type: boolean + smfList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + sameSmfInd: + type: boolean Nssai: type: object @@ -1770,6 +1964,12 @@ components: minProperties: 1 nullable: true + UeContextInAmfData: + type: object + properties: + epsInterworkingInfo: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/EpsInterworkingInfo' + UeContextInSmfData: type: object properties: @@ -1800,6 +2000,9 @@ components: $ref: '#/components/schemas/IpAddress' smfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + epdgInd: + type: boolean + default: false PduSession: @@ -1815,6 +2018,8 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' plmnId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + singleNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' PgwInfo: type: object @@ -1828,6 +2033,9 @@ components: type: string plmnId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + epdgInd: + type: boolean + default: false SessionManagementSubscriptionData: type: object @@ -1846,11 +2054,6 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' minItems: 1 - vnGroupInfo: - type: object - additionalProperties: - $ref: '#/components/schemas/VnGroupData' - minProperties: 1 sharedVnGroupDataIds: type: object additionalProperties: @@ -1905,8 +2108,6 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' pduSessionContinuityInd: $ref: '#/components/schemas/PduSessionContinuityInd' - invokeNefSelection: - type: boolean niddNefId: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NefId' niddInfo: @@ -1928,6 +2129,12 @@ components: atsssAllowed: type: boolean default: false + secondaryAuth: + type: boolean + dnAaaIpAddressAllocation: + type: boolean + dnAaaAddress: + $ref: '#/components/schemas/IpAddress' NiddInformation: type: object @@ -2037,7 +2244,7 @@ components: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' monitoredResourceUris: type: array - items: + items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 singleNssai: @@ -2053,6 +2260,10 @@ components: default: false report: $ref: '#/components/schemas/SubscriptionDataSets' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + contextInfo: + $ref: '#/components/schemas/ContextInfo' SdmSubsModification: type: object @@ -2061,7 +2272,7 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' monitoredResourceUris: type: array - items: + items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' minItems: 1 @@ -2121,7 +2332,7 @@ components: SharedDataIds: type: array - items: + items: $ref: '#/components/schemas/SharedDataId' minItems: 1 uniqueItems: true @@ -2129,9 +2340,9 @@ components: UpuInfo: type: object properties: - upuDataList: + upuDataList: type: array - items: + items: $ref: 'TS29509_Nausf_UPUProtection.yaml#/components/schemas/UpuData' minItems: 1 upuRegInd: @@ -2144,7 +2355,7 @@ components: $ref: 'TS29509_Nausf_UPUProtection.yaml#/components/schemas/CounterUpu' provisioningTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - required: + required: - upuDataList - upuAckInd - upuRegInd @@ -2228,7 +2439,7 @@ components: type: object properties: osId: - $ref: 'TS29519_Policy_Data.yaml#/components/schemas/OsId' + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/OsId' appId: type: string @@ -2251,11 +2462,8 @@ components: properties: lpi: $ref: '#/components/schemas/Lpi' - unrelatedClasses: - type: array - items: - $ref: '#/components/schemas/UnrelatedClass' - minItems: 1 + unrelatedClass: + $ref: '#/components/schemas/UnrelatedClass' plmnOperatorClasses: type: array items: @@ -2275,10 +2483,10 @@ components: UnrelatedClass: type: object required: - - nonExternalUnrelatedClass + - defaultUnrelatedClass properties: - nonExternalUnrelatedClass: - $ref: '#/components/schemas/NonExternalUnrelatedClass' + defaultUnrelatedClass: + $ref: '#/components/schemas/DefaultUnrelatedClass' externalUnrelatedClass: $ref: '#/components/schemas/ExternalUnrelatedClass' serviceTypeUnrelatedClasses: @@ -2309,57 +2517,6 @@ components: endTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - NonExternalUnrelatedClass: - properties: - lcsClientNonExternals: - type: array - items: - $ref: '#/components/schemas/LcsClientNonExternal' - minItems: 1 - afNonExternals: - type: array - items: - $ref: '#/components/schemas/AfNonExternal' - minItems: 1 - - LcsClientNonExternal: - type: object - required: - - lcsClientId - properties: - lcsClientId: - $ref: '#/components/schemas/LcsClientId' - allowedGeographicArea: - type: array - items: - $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' - minItems: 1 - privacyCheckRelatedAction: - $ref: '#/components/schemas/PrivacyCheckRelatedAction' - codeWordInd: - $ref: '#/components/schemas/CodeWordInd' - validTimePeriod: - $ref: '#/components/schemas/ValidTimePeriod' - - AfNonExternal: - type: object - required: - - afId - properties: - afId: - type: string - allowedGeographicArea: - type: array - items: - $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' - minItems: 1 - privacyCheckRelatedAction: - $ref: '#/components/schemas/PrivacyCheckRelatedAction' - codeWordInd: - $ref: '#/components/schemas/CodeWordInd' - validTimePeriod: - $ref: '#/components/schemas/ValidTimePeriod' - ExternalUnrelatedClass: properties: lcsClientExternals: @@ -2382,7 +2539,7 @@ components: type: object properties: afId: - type: string + $ref: '#/components/schemas/AfId' allowedGeographicArea: type: array items: @@ -2410,7 +2567,7 @@ components: type: object properties: lcsClientGroupId: - $ref: '#/components/schemas/ExtGroupId' + $ref: '#/components/schemas/ExtGroupId' allowedGeographicArea: type: array items: @@ -2439,6 +2596,11 @@ components: $ref: '#/components/schemas/CodeWordInd' validTimePeriod: $ref: '#/components/schemas/ValidTimePeriod' + codeWordList: + type: array + items: + $ref: '#/components/schemas/CodeWord' + minItems: 1 LcsMoData: type: object @@ -2451,8 +2613,22 @@ components: $ref: '#/components/schemas/LcsMoServiceClass' minItems: 1 - EcRestrictionData: + LcsBroadcastAssistanceTypesData: type: object + required: + - locationAssistanceType + properties: + locationAssistanceType: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Binary' + minItems: 1 + + EcRestrictionDataWb: + type: object + anyOf: + - required: [ ecModeARestricted ] + - required: [ ecModeBRestricted ] properties: ecModeARestricted: type: boolean @@ -2485,33 +2661,6 @@ components: validityTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - MaximumResponseTime: - type: object - required: - - maximumResponseTime - properties: - maximumResponseTime: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' - snssai: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' - dnn: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' - validityTime: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - - MaximumLatency: - type: object - required: - - maximumLatency - properties: - maximumLatency: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' - snssai: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' - dnn: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' - validityTime: - $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' SuggestedPacketNumDl: type: object @@ -2586,6 +2735,47 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' minItems: 1 + V2xSubscriptionData: + type: object + properties: + nrV2xServicesAuth: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NrV2xAuth' + lteV2xServicesAuth: + $ref: 'TS29571_CommonData.yaml#/components/schemas/LteV2xAuth' + nrUePc5Ambr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + ltePc5Ambr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + + DefaultUnrelatedClass: + type: object + properties: + allowedGeographicArea: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + minItems: 1 + privacyCheckRelatedAction: + $ref: '#/components/schemas/PrivacyCheckRelatedAction' + codeWordInd: + $ref: '#/components/schemas/CodeWordInd' + validTimePeriod: + $ref: '#/components/schemas/ValidTimePeriod' + codeWordList: + type: array + items: + $ref: '#/components/schemas/CodeWord' + minItems: 1 + + ContextInfo: + type: object + properties: + origHeaders: + type: array + items: + type: string + minItems: 1 + # SIMPLE TYPES: UeUsageType: @@ -2636,6 +2826,8 @@ components: NbIoTUePriority: type: integer + minimum: 0 + maximum: 255 CodeWord: type: string @@ -2664,6 +2856,8 @@ components: - SMS_MNG - LCS_PRIVACY - LCS_MO + - UEC_AMF + - V2X - type: string PduSessionContinuityInd: @@ -2740,3 +2934,10 @@ components: - CODEWORD_CHECK_IN_GMLC - type: string + MdtUserConsent: + anyOf: + - type: string + enum: + - CONSENT_NOT_GIVEN + - CONSENT_GIVEN + - type: string diff --git a/lib/sbi/support/standard/TS29503_Nudm_UEAU.yaml b/lib/sbi/support/standard/TS29503_Nudm_UEAU.yaml index daa90e9d6..f005d60df 100644 --- a/lib/sbi/support/standard/TS29503_Nudm_UEAU.yaml +++ b/lib/sbi/support/standard/TS29503_Nudm_UEAU.yaml @@ -1,14 +1,14 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-2' - title: 'NudmUEAU' + version: '1.1.2' + title: 'Nudm_UEAU' description: | UDM UE Authentication Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -98,12 +98,12 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' - name: If-None-Match in: header - description: Validator for conditional requests, as described in RFC 7232, 3.2 + description: Validator for conditional requests, as described in RFC 7232, 3.2 schema: type: string - name: If-Modified-Since in: header - description: Validator for conditional requests, as described in RFC 7232, 3.3 + description: Validator for conditional requests, as described in RFC 7232, 3.3 schema: type: string responses: @@ -169,12 +169,12 @@ paths: default: description: Unexpected error - /{supi}/hss-security-information/generate-av: + /{supi}/hss-security-information/{hssAuthType}/generate-av: post: summary: Generate authentication data for the UE in EPS or IMS domain operationId: GenerateAv tags: - - Generate HSS Authentication Vectors + - Generate HSS Authentication Vectors parameters: - name: supi in: path @@ -182,6 +182,12 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: hssAuthType + in: path + description: Type of AV requested by HSS + required: true + schema: + $ref: '#/components/schemas/HssAuthTypeInUri' requestBody: content: application/json: @@ -197,6 +203,8 @@ paths: $ref: '#/components/schemas/HssAuthenticationInfoResult' '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' '500': @@ -209,7 +217,7 @@ paths: description: Unexpected error /{supi}/auth-events/{authEventId}: - delete: + put: summary: Deletes the authentication result in the UDM operationId: DeleteAuth tags: @@ -227,6 +235,12 @@ paths: required: true schema: type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthEvent' + required: true responses: '204': description: Expected response to a successful authentication result removal @@ -245,8 +259,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-ueau: Access to the nudm-ueau API @@ -270,8 +284,15 @@ components: $ref: '#/components/schemas/ResynchronizationInfo' ausfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' - cagId: - $ref: 'TS29571_CommonData.yaml#/components/schemas/CagId' + cellCagInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CagId' + minItems: 1 + n5gcInd: + type: boolean + default: false + AuthenticationInfoResult: type: object required: @@ -292,7 +313,7 @@ components: - $ref: '#/components/schemas/Av5GHeAka' discriminator: propertyName: avType - mapping: + mapping: 5G_HE_AKA: '#/components/schemas/Av5GHeAka' EAP_AKA_PRIME: '#/components/schemas/AvEapAkaPrime' @@ -369,6 +390,9 @@ components: $ref: '#/components/schemas/AuthType' servingNetworkName: $ref: '#/components/schemas/ServingNetworkName' + authRemovalInd: + type: boolean + default: false RgAuthCtx: type: object @@ -395,11 +419,16 @@ components: $ref: '#/components/schemas/HssAuthType' numOfRequestedVectors: $ref: '#/components/schemas/NumOfRequestedVectors' + requestingNodeType: + $ref: '#/components/schemas/NodeType' servingNetworkId: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' resynchronizationInfo: $ref: '#/components/schemas/ResynchronizationInfo' - + anId: + $ref: '#/components/schemas/AccessNetworkId' + + HssAuthenticationInfoResult: type: object required: @@ -562,6 +591,7 @@ components: - EAP_AKA_PRIME - IMS_AKA - GBA_AKA + - UMTS_AKA - type: string HssAvType: @@ -572,5 +602,41 @@ components: - EAP_AKA - IMS_AKA - GBA_AKA + - UMTS_AKA + - type: string + + HssAuthTypeInUri: + anyOf: + - type: string + enum: + - eps-aka + - eap-aka + - eap-aka-prime + - ims-aka + - gba-aka + - type: string + + AccessNetworkId: + anyOf: + - type: string + enum: + - HRPD + - WIMAX + - WLAN + - ETHERNET + - type: string + + NodeType: + anyOf: + - type: string + enum: + - AUSF + - VLR + - SGSN + - S_CSCF + - BSF + - GAN_AAA_SERVER + - WLAN_AAA_SERVER + - MME - type: string diff --git a/lib/sbi/support/standard/TS29503_Nudm_UECM.yaml b/lib/sbi/support/standard/TS29503_Nudm_UECM.yaml index 57d8d1c28..f34a30877 100644 --- a/lib/sbi/support/standard/TS29503_Nudm_UECM.yaml +++ b/lib/sbi/support/standard/TS29503_Nudm_UECM.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-3' + version: '1.1.2' title: 'Nudm_UECM' description: | Nudm Context Management Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.503 Unified Data Management Services, version 16.3.0 + description: 3GPP TS 29.503 Unified Data Management Services, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' servers: @@ -25,6 +25,61 @@ security: - {} paths: + /{ueId}/registrations: + get: + summary: retrieve UE registration data sets + operationId: GetRegistrations + tags: + - UECM Registration Info Retrieval + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: supported-features + in: query + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: registration-dataset-names + in: query + style: form + explode: false + description: List of UECM registration dataset names + required: true + schema: + $ref: '#/components/schemas/RegistrationDatasetNames' + - name: single-nssai + in: query + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + - name: dnn + in: query + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/RegistrationDataSets' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /{ueId}/registrations/amf-3gpp-access: put: summary: register as AMF for 3GPP access @@ -90,6 +145,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -112,10 +199,44 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '409': + $ref: 'TS29571_CommonData.yaml#/components/responses/409' '500': $ref: 'TS29571_CommonData.yaml#/components/responses/500' '503': @@ -344,6 +465,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -366,6 +519,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -580,6 +765,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -602,6 +819,38 @@ paths: responses: '204': description: Successful Notification response + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'Contains the new Callback URI of the target NF Service Consumer (e.g. SMF) to which the request is redirected' + required: true + schema: + type: string + 3gpp-Sbi-Target-Nf-Id: + description: 'Identifier of target NF (service) instance towards which the notification is redirected' + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '404': @@ -937,6 +1186,115 @@ paths: default: description: Unexpected error + /{ueId}/registrations/ip-sm-gw: + put: + summary: Register an IP-SM-GW + operationId: IpSmGwRegistration + tags: + - IP-SM-GW registration + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + required: true + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudm-uecm/v1/{ueId}/registrations/ip-sm-gw' + required: true + schema: + type: string + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + delete: + summary: Delete the IP-SM-GW registration + operationId: IpSmGwDeregistration + tags: + - IP-SM-GW Deregistration + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + responses: + '204': + description: Expected response to a valid request + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + get: + summary: Retrieve the IP-SM-GW registration information + operationId: GetIpSmGwRegistration + tags: + - IP-SM-GW Registration Info Retrieval + parameters: + - name: ueId + in: path + description: Identifier of the UE + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /restore-pcscf: post: summary: Trigger the Restoration of the P-CSCF @@ -967,9 +1325,9 @@ paths: default: description: Unexpected error - /{ueId}/registrations/loation: + /{ueId}/registrations/location: get: - summary: retrieve the target UE’s location information + summary: retrieve the target UE's location information operationId: GetLocationInfo tags: - UE Location Information retrieval @@ -1009,8 +1367,8 @@ components: securitySchemes: oAuth2ClientCredentials: type: oauth2 - flows: - clientCredentials: + flows: + clientCredentials: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudm-uecm: Access to the nudm-uecm API @@ -1066,16 +1424,15 @@ components: $ref: '#/components/schemas/EpsInterworkingInfo' ueSrvccCapability: type: boolean - nid: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Nid' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - vgmlcAddressIpv4: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' - vgmlcAddressIpv6: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' - vgmlcFqdn: - $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + vgmlcAddress: + $ref: '#/components/schemas/VgmlcAddress' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' + noEeSubscriptionInd: + type: boolean + default: false Amf3GppAccessRegistrationModification: @@ -1100,6 +1457,9 @@ components: ueSrvccCapability: type: boolean nullable: true + noEeSubscriptionInd: + type: boolean + default: false EpsInterworkingInfo: type: object @@ -1108,7 +1468,7 @@ components: description: A map (list of key-value pairs where Dnn serves as key) of EpsIwkPgws type: object additionalProperties: - $ref: '#components/schemas/EpsIwkPgw' + $ref: '#/components/schemas/EpsIwkPgw' EpsIwkPgw: type: object @@ -1161,17 +1521,12 @@ components: type: boolean amfEeSubscriptionId: type: string - nid: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Nid' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' - vgmlcAddressIpv4: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' - vgmlcAddressIpv6: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' - vgmlcFqdn: - $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' - + vgmlcAddress: + $ref: '#/components/schemas/VgmlcAddress' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' AmfNon3GppAccessRegistrationModification: type: object @@ -1228,6 +1583,8 @@ components: $ref: '#/components/schemas/RegistrationReason' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' SmsfRegistration: type: object @@ -1249,12 +1606,14 @@ components: $ref: '#/components/schemas/NetworkNodeDiameterAddress' registrationTime: $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + contextInfo: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ContextInfo' + DeregistrationData: type: object required: - deregReason - - accessType properties: deregReason: $ref: '#/components/schemas/DeregistrationReason' @@ -1303,6 +1662,21 @@ components: $ref: '#/components/schemas/SmfRegistration' minItems: 1 + IpSmGwRegistration: + type: object + anyOf: + - required: [ ipSmGwMapAddress ] + - required: [ ipSmGwDiameterAddress ] + properties: + ipSmGwMapAddress: + $ref: '#/components/schemas/E164Number' + ipSmGwDiameterAddress: + $ref: '#/components/schemas/NetworkNodeDiameterAddress' + unriIndicator: + type: boolean + default: false + + AmfDeregInfo: type: object required: @@ -1331,22 +1705,20 @@ components: RegistrationLocationInfo: type: object - - CmInfoReport: - type: object required: - - newCmInfoList + - amfInstanceId + - accessTypeList properties: - oldCmInfoList: + amfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + vgmlcAddress: + $ref: '#/components/schemas/VgmlcAddress' + accessTypeList: type: array items: - $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/CmInfo' - minItems: 1 - maxItems: 2 - newCmInfoList: - type: array - items: - $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/CmInfo' + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' minItems: 1 maxItems: 2 @@ -1368,6 +1740,27 @@ components: pei: $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + RegistrationDatasetNames: + type: array + items: + $ref: '#/components/schemas/RegistrationDataSetName' + minItems: 2 + uniqueItems: true + + RegistrationDataSets: + type: object + properties: + amf3Gpp: + $ref: '#/components/schemas/Amf3GppAccessRegistration' + amfNon3Gpp: + $ref: '#/components/schemas/AmfNon3GppAccessRegistration' + smfRegistration: + $ref: '#/components/schemas/SmfRegistrationInfo' + smsf3Gpp: + $ref: '#/components/schemas/SmsfRegistration' + smsfNon3Gpp: + $ref: '#/components/schemas/SmsfRegistration' + # SIMPLE TYPES: @@ -1403,7 +1796,7 @@ components: - 5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION - REREGISTRATION_REQUIRED - SMF_CONTEXT_TRANSFERRED - - type: string + - type: string RegistrationReason: anyOf: @@ -1412,3 +1805,14 @@ components: - SMF_CONTEXT_TRANSFERRED - type: string + RegistrationDataSetName: + anyOf: + - type: string + enum: + - AMF_3GPP + - AMF_NON_3GPP + - SMF_PDU_SESSIONS + - SMSF_3GPP + - SMSF_NON_3GPP + - type: string + diff --git a/lib/sbi/support/standard/TS29504_Nudr_DR.yaml b/lib/sbi/support/standard/TS29504_Nudr_DR.yaml index 92231b905..a3ee47b58 100644 --- a/lib/sbi/support/standard/TS29504_Nudr_DR.yaml +++ b/lib/sbi/support/standard/TS29504_Nudr_DR.yaml @@ -1,7 +1,7 @@ -openapi: 3.0.0 +openapi: 3.0.0 info: - version: 2.1.0.alpha-4 + version: 2.1.2 title: 'Nudr_DataRepository API OpenAPI file' description: | Unified Data Repository Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.504 V16.3.0; 5G System; Unified Data Repository Services; Stage 3 + description: 3GPP TS 29.504 V16.6.0; 5G System; Unified Data Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.504/' servers: @@ -45,6 +45,8 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1smf-selection-subscription-data' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sm-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1sm-data' + /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-bca-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1lcs-bca-data' /subscription-data/{ueId}/context-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data' /subscription-data/{ueId}/context-data/amf-3gpp-access: @@ -61,14 +63,20 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1smsf-3gpp-access' /subscription-data/{ueId}/context-data/smsf-non-3gpp-access: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1smsf-non-3gpp-access' + /subscription-data/{ueId}/context-data/location: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1location' + /subscription-data/{ueId}/context-data/ip-sm-gw: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1ip-sm-gw' + /subscription-data/{ueId}/context-data/mwd: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1context-data~1mwd' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-mng-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1sms-mng-data' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1sms-data' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-privacy-data: - $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1lcs-privacy-data' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-mo-data: - $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1%7BservingPlmnId%7D~1provisioned-data~1lcs-mo-data' + /subscription-data/{ueId}/lcs-privacy-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1lcs-privacy-data' + /subscription-data/{ueId}/lcs-mo-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1lcs-mo-data' /subscription-data/{ueId}/pp-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1pp-data' /subscription-data/{ueId}/context-data/ee-subscriptions: @@ -85,6 +93,8 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~15g-vn-groups' /subscription-data/group-data/5g-vn-groups/{externalGroupId}: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~15g-vn-groups~1%7BexternalGroupId%7D' + /subscription-data/group-data/5g-vn-groups/internal: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~15g-vn-groups~1internal' /subscription-data/{ueId}/ee-profile-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1ee-profile-data' /subscription-data/{ueId}/context-data/sdm-subscriptions: @@ -105,6 +115,10 @@ paths: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1operator-determined-barring-data' /subscription-data/{ueId}/nidd-authorization-data: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1nidd-authorization-data' + /subscription-data/{ueId}/v2x-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1v2x-data' + /subscription-data/{ueId}/coverage-restriction-data: + $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1%7BueId%7D~1coverage-restriction-data' /subscription-data/group-data/group-identifiers: $ref: 'TS29505_Subscription_Data.yaml#/paths/~1subscription-data~1group-data~1group-identifiers' /policy-data/ues/{ueId}/am-data: @@ -170,3 +184,5 @@ components: tokenUrl: '{nrfApiRoot}/oauth2/token' scopes: nudr-dr: Access to the Nudr_DataRepository API + nudr-dr:subscription-data:authentication-subscription:read: Access to read the AuthenticationSubscription resource of the SubscriptionData data set + nudr-dr:subscription-data:authentication-subscription:modify: Access to update the AuthenticationSubscription resource of the SubscriptionData data set diff --git a/lib/sbi/support/standard/TS29504_Nudr_GroupIDmap.yaml b/lib/sbi/support/standard/TS29504_Nudr_GroupIDmap.yaml index 5ad19d796..2f94329d1 100644 --- a/lib/sbi/support/standard/TS29504_Nudr_GroupIDmap.yaml +++ b/lib/sbi/support/standard/TS29504_Nudr_GroupIDmap.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: 1.0.0.alpha-1 + version: 1.0.0 title: 'Nudr_GroupIDmap' description: | Unified Data Repository Service for NF-Group ID retrieval. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.504 V16.2.0; 5G System; Unified Data Repository Services; Stage 3 + description: 3GPP TS 29.504 V16.4.0; 5G System; Unified Data Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.504/' servers: diff --git a/lib/sbi/support/standard/TS29505_Subscription_Data.yaml b/lib/sbi/support/standard/TS29505_Subscription_Data.yaml index ab1e93807..ed71e74f4 100644 --- a/lib/sbi/support/standard/TS29505_Subscription_Data.yaml +++ b/lib/sbi/support/standard/TS29505_Subscription_Data.yaml @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.505 V16.2.0; 5G System; Usage of the Unified Data Repository Service for subscription data; Stage 3 + description: 3GPP TS 29.505 V16.5.0; 5G System; Usage of the Unified Data Repository Service for subscription data; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.505/' paths: @@ -20,13 +20,20 @@ paths: operationId: QueryAuthSubsData tags: - Authentication Data (Document) + security: + - {} + - oAuth2ClientCredentials: + - nudr-dr + - oAuth2ClientCredentials: + - nudr-dr + - nudr-dr:subscription-data:authentication-subscription:read parameters: - name: ueId in: path description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -40,23 +47,27 @@ paths: schema: $ref: '#/components/schemas/AuthenticationSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the authentication subscription data of a UE operationId: ModifyAuthenticationSubscription tags: - Authentication Subscription (Document) + security: + - {} + - oAuth2ClientCredentials: + - nudr-dr + - oAuth2ClientCredentials: + - nudr-dr + - nudr-dr:subscription-data:authentication-subscription:modify parameters: - name: ueId in: path description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Features required to be supported by the target NF @@ -86,11 +97,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/authentication-data/authentication-status: put: @@ -104,7 +111,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' requestBody: content: application/json: @@ -114,11 +121,7 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieves the Authentication Status of a UE @@ -131,7 +134,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: fields in: query description: attributes to be retrieved @@ -156,11 +159,7 @@ paths: schema: $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/AuthEvent' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' delete: summary: To remove the Authentication Status of a UE @@ -173,16 +172,110 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' responses: '204': description: Upon success, an empty response body shall be returned. default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/authentication-data/authentication-status/{servingNetworkName}: + put: + summary: To store the individual Authentication Status data of a UE + operationId: CreateIndividualAuthenticationStatus + tags: + - Individual Authentication Status (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: servingNetworkName + in: path + description: Serving Network Name + required: true + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + requestBody: + content: + application/json: + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/AuthEvent' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + get: + summary: Retrieves the Individual Authentication Status of a UE + operationId: QueryIndividualAuthenticationStatus + tags: + - Individual AuthEvent (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: servingNetworkName + in: path + description: Serving Network Name + required: true + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: supported-features + description: Supported Features + in: query + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/AuthEvent' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + delete: + summary: To remove the Individual Authentication Status of a UE + operationId: DeleteIndividualAuthenticationStatus + tags: + - Individual AuthEvent (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: servingNetworkName + in: path + description: Serving Network Name + required: true + schema: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + responses: + '204': + description: Upon success, an empty response body shall be returned. + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/sor-data: put: @@ -196,7 +289,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -211,11 +304,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the SoR acknowledgement information of a UE operationId: QueryAuthSoR @@ -227,7 +317,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supportedFeatures in: query description: Supported Features @@ -241,11 +331,7 @@ paths: schema: $ref: '#/components/schemas/SorData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/upu-data: put: @@ -259,7 +345,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -274,11 +360,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the UPU acknowledgement information of a UE operationId: QueryAuthUPU @@ -290,7 +373,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supportedFeatures in: query description: Supported Features @@ -304,11 +387,7 @@ paths: schema: $ref: '#/components/schemas/UpuData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/subscribed-snssais: put: @@ -322,7 +401,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -337,11 +416,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the UPU acknowledgement information of a UE operationId: QueryNssaiAck @@ -353,7 +429,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supportedFeatures in: query description: Supported Features @@ -367,11 +443,7 @@ paths: schema: $ref: '#/components/schemas/NssaiAckData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ue-update-confirmation-data/subscribed-cag: put: @@ -385,7 +457,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -400,11 +472,8 @@ paths: '204': description: Expected response to a valid request default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the CAG acknowledgement information of a UE operationId: QueryCagAck @@ -416,7 +485,7 @@ paths: description: UE id required: true schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' - name: supported-features in: query description: Supported Features @@ -430,11 +499,7 @@ paths: schema: $ref: '#/components/schemas/CagAckData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data: get: @@ -470,12 +535,7 @@ paths: schema: $ref: '#/components/schemas/ProvisionedDataSets' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' - + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/am-data: get: @@ -543,11 +603,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/smf-selection-subscription-data: get: @@ -615,11 +671,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sm-data: get: @@ -704,11 +756,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/amf-3gpp-access: get: @@ -747,11 +795,8 @@ paths: schema: $ref: '#/components/schemas/Amf3GppAccessRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: summary: To store the AMF context data of a UE using 3gpp access in the UDR operationId: CreateAmfContext3gpp @@ -772,12 +817,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/Amf3GppAccessRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/amf-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: To modify the AMF context data of a UE using 3gpp access in the UDR operationId: AmfContext3gpp @@ -819,11 +873,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/amf-non-3gpp-access: get: @@ -862,11 +912,8 @@ paths: schema: $ref: '#/components/schemas/AmfNon3GppAccessRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: summary: To store the AMF context data of a UE using non-3gpp access in the UDR operationId: CreateAmfContextNon3gpp @@ -887,12 +934,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/Amf3GppAccessRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/amf-non-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: To modify the AMF context data of a UE using non 3gpp access in the UDR operationId: AmfContextNon3gpp @@ -934,11 +990,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smf-registrations: get: @@ -966,11 +1018,7 @@ paths: schema: $ref: '#/components/schemas/SmfRegList' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smf-registrations/{pduSessionId}: get: @@ -1015,11 +1063,8 @@ paths: schema: $ref: '#/components/schemas/SmfRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: summary: To create an individual SMF context data of a UE in the UDR operationId: CreateSmfContextNon3gpp @@ -1046,18 +1091,21 @@ paths: responses: '201': description: Upon success, a response body containing a representation of the created Individual SmfRegistration resource shall be returned - default: - description: Unexpected error content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SmfRegistration' headers: Location: description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/smf-registrations/{pduSessionId}' required: true schema: type: string + '204': + description: No content + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: To remove an individual SMF context data of a UE the UDR operationId: DeleteSmfContext @@ -1080,11 +1128,7 @@ paths: '204': description: Upon success, an empty response body shall be returned. default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/operator-specific-data: get: @@ -1148,11 +1192,8 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: To modify operator specific data of a UE operationId: ModifyOperSpecData @@ -1194,11 +1235,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smsf-3gpp-access: put: @@ -1221,12 +1258,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SmsfRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/smsf-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: To remove the SMSF context data of a UE via 3GPP access operationId: DeleteSmsfContext3gpp @@ -1243,11 +1289,8 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the SMSF context data of a UE using 3gpp access operationId: QuerySmsfContext3gpp @@ -1284,11 +1327,7 @@ paths: schema: $ref: '#/components/schemas/SmsfRegistration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/smsf-non-3gpp-access: put: @@ -1311,12 +1350,21 @@ paths: responses: '204': description: Upon success, an empty response body shall be returned - default: - description: Unexpected error + '201': + description: Created content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SmsfRegistration' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/{ueId}/context-data/smsf-non-3gpp-access' + required: true + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: To remove the SMSF context data of a UE via non-3GPP access operationId: DeleteSmsfContextNon3gpp @@ -1333,11 +1381,8 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieves the SMSF context data of a UE using non-3gpp access operationId: QuerySmsfContextNon3gpp @@ -1374,11 +1419,228 @@ paths: schema: $ref: '#/components/schemas/SmsfRegistration' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/context-data/ip-sm-gw: + put: + summary: Create the IP-SM-GW context data of a UE + operationId: CreateIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IpSmGwRegistration' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + delete: + summary: To remove the IP-SM-GW context data of a UE + operationId: DeleteIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + patch: + summary: Modify the IP-SM-GW context data of a UE + operationId: ModifyIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + minItems: 1 + required: true + responses: + '204': + description: Successful response + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + get: + summary: Retrieves the IP-SM-GW context data of a UE + operationId: QueryIpSmGwContext + tags: + - IP-SM-GW Registration (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request content: - application/problem+json: + application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/IpSmGwRegistration' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/context-data/mwd: + put: + summary: Create the Message Waiting Data of the UE + operationId: CreateMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MessageWaitingData' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + description: Unexpected error + delete: + summary: To remove the Message Waiting Data of the UE + operationId: DeleteMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + responses: + '204': + description: Upon success, an empty response body shall be returned + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + patch: + summary: Modify the Message Waiting Data of the UE + operationId: ModifyMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + minItems: 1 + required: true + responses: + '204': + description: Successful response + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + get: + summary: Retrieves the Message Waiting Data of the UE + operationId: QueryMessageWaitingData + tags: + - Message Waiting Data (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/MessageWaitingData' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-mng-data: get: @@ -1435,11 +1697,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/sms-data: get: @@ -1496,11 +1754,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/pp-data: get: @@ -1557,11 +1811,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the provisioned parameter data operationId: ModifyPpData @@ -1595,7 +1846,7 @@ paths: content: application/json: schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' '403': description: modification is rejected content: @@ -1603,11 +1854,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/ee-subscriptions: get: @@ -1637,11 +1884,8 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + post: summary: Create individual EE subscription operationId: CreateEeSubscriptions @@ -1674,11 +1918,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/ee-subscriptions/{subsId}: put: @@ -1712,11 +1952,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes a eeSubscription operationId: RemoveeeSubscriptions @@ -1737,6 +1974,8 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual ee subscription of a UE @@ -1783,7 +2022,7 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieve a eeSubscription @@ -1811,11 +2050,7 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/ee-subscriptions/{subsId}/amf-subscriptions: put: @@ -1847,11 +2082,8 @@ paths: '204': description: Upon success, an empty response body shall be returned default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes AMF Subscription Info for an eeSubscription operationId: RemoveAmfSubscriptionsInfo @@ -1871,6 +2103,9 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the AMF Subscription Info operationId: ModifyAmfSubscriptionInfo @@ -1916,11 +2151,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieve AMF subscription Info operationId: GetAmfSubscriptionInfo @@ -1948,11 +2180,7 @@ paths: $ref: '#/components/schemas/AmfSubscriptionInfo' minItems: 1 default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/{ueGroupId}/ee-subscriptions: get: @@ -1982,11 +2210,8 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + post: summary: Create individual EE subscription for a group of UEs or any UE operationId: CreateEeGroupSubscriptions @@ -2014,23 +2239,19 @@ paths: $ref: '#/components/schemas/EeSubscription' headers: Location: - description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/group-data/{ueGroupId}/ee-subscriptions ' + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr//subscription-data/group-data/{ueGroupId}/ee-subscriptions' required: true schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/{ueGroupId}/ee-subscriptions/{subsId}: put: summary: Update an individual ee subscription of a group of UEs or any UE operationId: UpdateEeGroupSubscriptions tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2057,16 +2278,13 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes a eeSubscription for a group of UEs or any UE operationId: RemoveEeGroupSubscriptions tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2082,12 +2300,14 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual ee subscription for a group of a UEs operationId: ModifyEeGroupSubscription tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2127,13 +2347,13 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieve a individual eeSubscription for a group of UEs or any UE operationId: QueryEeGroupSubscription tags: - - Event Exposure Subscription (Document) + - Event Exposure Group Subscription (Document) parameters: - name: ueGroupId in: path @@ -2155,11 +2375,7 @@ paths: items: $ref: '#/components/schemas/EeSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/ee-profile-data: get: @@ -2197,12 +2413,7 @@ paths: schema: $ref: '#/components/schemas/EeProfileData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' - + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/sdm-subscriptions: get: @@ -2232,11 +2443,8 @@ paths: items: $ref: '#/components/schemas/SdmSubscription' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + post: summary: Create individual sdm subscription operationId: CreateSdmSubscriptions @@ -2269,11 +2477,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data/sdm-subscriptions/{subsId}: put: @@ -2307,11 +2511,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes a sdmsubscriptions operationId: RemovesdmSubscriptions @@ -2334,6 +2535,8 @@ paths: description: Expected response to a successful subscription removal '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual sdm subscription @@ -2380,7 +2583,7 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieves a individual sdmSubscription identified by subsId @@ -2407,6 +2610,8 @@ paths: schema: items: $ref: '#/components/schemas/SdmSubscription' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/shared-data: get: @@ -2447,13 +2652,14 @@ paths: '503': $ref: 'TS29571_CommonData.yaml#/components/responses/503' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscription-data/subs-to-notify: post: summary: Subscription data subscriptions operationId: SubscriptionDataSubscriptions tags: - - Subs To Nofify (Collection) + - Subs To Notify (Collection) requestBody: content: application/json: @@ -2474,11 +2680,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' callbacks: onDataChange: '{request.body#/callbackReference}': @@ -2497,7 +2699,7 @@ paths: summary: Retrieves the list of subscriptions operationId: QuerySubsToNotify tags: - - Subs To Nofify (Collection) + - Subs To Notify (Collection) parameters: - name: ue-id in: query @@ -2520,11 +2722,8 @@ paths: items: $ref: '#/components/schemas/SubscriptionDataSubscriptions' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes subscriptions identified by a given ue-id parameter operationId: RemoveMultipleSubscriptionDataSubscriptions @@ -2558,6 +2757,8 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/subs-to-notify/{subsId}: delete: @@ -2575,6 +2776,8 @@ paths: responses: '204': description: Expected response to a successful subscription removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' patch: summary: Modify an individual subscriptionDataSubscription @@ -2615,7 +2818,7 @@ paths: '404': $ref: 'TS29571_CommonData.yaml#/components/responses/404' default: - description: Unexpected error + $ref: 'TS29571_CommonData.yaml#/components/responses/default' get: summary: Retrieves a individual subscriptionDataSubscription identified by subsId @@ -2637,6 +2840,8 @@ paths: schema: items: $ref: '#/components/schemas/SubscriptionDataSubscriptions' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/trace-data: get: @@ -2689,6 +2894,7 @@ paths: type: string default: $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscription-data/{ueId}/identity-data: get: summary: Retrieve identity data by SUPI or GPSI @@ -2740,11 +2946,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/operator-determined-barring-data: get: @@ -2767,11 +2969,7 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/OdbData' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/context-data: get: @@ -2802,11 +3000,7 @@ paths: schema: $ref: '#/components/schemas/ContextDataSets' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/group-identifiers: get: @@ -2846,6 +3040,8 @@ paths: application/json: schema: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/GroupIdentifiers' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/5g-vn-groups: get: @@ -2874,11 +3070,7 @@ paths: additionalProperties: $ref: 'TS29503_Nudm_PP.yaml#/components/schemas/5GVnGroupConfiguration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/group-data/5g-vn-groups/{externalGroupId}: put: @@ -2908,11 +3100,8 @@ paths: '403': $ref: 'TS29571_CommonData.yaml#/components/responses/403' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: summary: Deletes the 5GVnGroup operationId: Delete5GVnGroup @@ -2927,6 +3116,9 @@ paths: responses: '204': description: Expected response to a successful group removal + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: summary: modify the 5GVnGroup operationId: Modify5GVnGroup @@ -2967,11 +3159,8 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: summary: Retrieve a 5GVnGroup configuration operationId: Get5GVnGroupConfiguration @@ -2991,13 +3180,9 @@ paths: schema: $ref: 'TS29503_Nudm_PP.yaml#/components/schemas/5GVnGroupConfiguration' default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-privacy-data: + /subscription-data/{ueId}/lcs-privacy-data: get: summary: Retrieves the LCS Privacy subscription data of a UE operationId: QueryLcsPrivacyData @@ -3010,12 +3195,6 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' - - name: servingPlmnId - in: path - description: PLMN ID - required: true - schema: - $ref: '#/components/schemas/VarPlmnId' - name: fields in: query description: attributes to be retrieved @@ -3048,10 +3227,7 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/LcsPrivacyData' - minItems: 1 + $ref: '#/components/schemas/LcsPrivacyData' headers: Cache-Control: description: Cache-Control containing max-age, as described in RFC 7234, 5.2 @@ -3066,13 +3242,9 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' - /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-mo-data: + /subscription-data/{ueId}/lcs-mo-data: get: summary: Retrieves the LCS Mobile Originated subscription data of a UE operationId: QueryLcsMoData @@ -3085,12 +3257,6 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' - - name: servingPlmnId - in: path - description: PLMN ID - required: true - schema: - $ref: '#/components/schemas/VarPlmnId' - name: fields in: query description: attributes to be retrieved @@ -3123,10 +3289,7 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/LcsMoData' - minItems: 1 + $ref: '#/components/schemas/LcsMoData' headers: Cache-Control: description: Cache-Control containing max-age, as described in RFC 7234, 5.2 @@ -3141,11 +3304,8 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscription-data/{ueId}/nidd-authorization-data: get: summary: Retrieve NIDD Authorization Data GPSI or External Group identifier @@ -3211,11 +3371,7 @@ paths: schema: type: string default: - description: Unexpected error - content: - application/problem+json: - schema: - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + $ref: 'TS29571_CommonData.yaml#/components/responses/default' /subscription-data/{ueId}/coverage-restriction-data: get: @@ -3265,6 +3421,142 @@ paths: description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 schema: type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/context-data/location: + get: + summary: Retrieves the UE's Location Information + operationId: QueryUeLocation + tags: + - UE's Location Information (Document) + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/LocationInfo' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/v2x-data: + get: + summary: Retrieves the subscribed V2X Data of a UE + operationId: QueryV2xData + tags: + - V2X Subscription Data + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V2xSubscriptionData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscription-data/{ueId}/{servingPlmnId}/provisioned-data/lcs-bca-data: + get: + summary: Retrieves the LCS Broadcast Assistance subscription data of a UE + operationId: QueryLcsBcaData + tags: + - LCS Broadcast Assistance Subscription Data + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: servingPlmnId + in: path + description: PLMN ID + required: true + schema: + $ref: '#/components/schemas/VarPlmnId' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + - name: If-Modified-Since + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.3 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' + headers: + Cache-Control: + description: Cache-Control containing max-age, as described in RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag, containing a strong validator, as described in RFC 7232, 2.3 + schema: + type: string + Last-Modified: + description: Timestamp for last modification of the resource, as described in RFC 7232, 2.2 + schema: + type: string default: description: Unexpected error content: @@ -3272,6 +3564,36 @@ paths: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + /subscription-data/group-data/5g-vn-groups/internal: + get: + summary: Retrieves the data of 5G VN Group + operationId: Query5GVnGroupInternal + tags: + - 5G-VN-Groups-Internal (Document) + parameters: + - name: internal-group-ids + in: query + description: List of Internal Group IDs + required: true + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + style: form + explode: false + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + type: object + description: A map (list of key-value pairs) where ExtGroupId serves as key + additionalProperties: + $ref: 'TS29503_Nudm_PP.yaml#/components/schemas/5GVnGroupConfiguration' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + components: schemas: AuthenticationSubscription: @@ -3299,6 +3621,13 @@ components: vectorGenerationInHss: type: boolean default: false + n5gcAuthMethod: + $ref: '#/components/schemas/AuthMethod' + rgAuthenticationInd: + type: boolean + default: false + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' SequenceNumber: type: object properties: @@ -3352,6 +3681,8 @@ components: - SMS_MNG - LCS_PRIVACY - LCS_MO + - LCS_BCA + - V2X - type: string ProvisionedDataSets: type: object @@ -3374,6 +3705,10 @@ components: $ref: '#/components/schemas/LcsPrivacyData' lcsMoData: $ref: '#/components/schemas/LcsMoData' + lcsBcaData: + $ref: '#/components/schemas/LcsBroadcastAssistanceTypesData' + v2xData: + $ref: '#/components/schemas/V2xSubscriptionData' AccessAndMobilitySubscriptionData: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/AccessAndMobilitySubscriptionData' SmfSelectionSubscriptionData: @@ -3392,6 +3727,8 @@ components: $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/SmfRegistration' SmsfRegistration: $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/SmsfRegistration' + LocationInfo: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/LocationInfo' SmsManagementSubscriptionData: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/SmsManagementSubscriptionData' SmsSubscriptionData: @@ -3404,6 +3741,10 @@ components: $ref: 'TS29503_Nudm_NIDDAU.yaml#/components/schemas/AuthorizationData' EnhancedCoverageRestrictionData: $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/EnhancedCoverageRestrictionData' + V2xSubscriptionData: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/V2xSubscriptionData' + LcsBroadcastAssistanceTypesData: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/LcsBroadcastAssistanceTypesData' OperatorSpecificDataContainer: type: object required: @@ -3600,7 +3941,7 @@ components: type: array items: $ref: '#/components/schemas/ContextDataSetName' - minItems: 1 + minItems: 2 uniqueItems: true ContextDataSetName: anyOf: @@ -3614,6 +3955,7 @@ components: - SMSF_NON_3GPP - SUBS_TO_NOTIFY - SMF_REG + - IP_SM_GW - type: string ContextDataSets: type: object @@ -3643,3 +3985,28 @@ components: minItems: 1 smfRegistrations: $ref: '#/components/schemas/SmfRegList' + ipSmGw: + $ref: '#/components/schemas/IpSmGwRegistration' + + IpSmGwRegistration: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/IpSmGwRegistration' + + MessageWaitingData: + type: object + properties: + mwdList: + type: array + items: + $ref: '#/components/schemas/SmscData' + minItems: 1 + + SmscData: + type: object + anyOf: + - required: [ smscMapAddress ] + - required: [ smscDiameterAddress ] + properties: + smscMapAddress: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/E164Number' + smscDiameterAddress: + $ref: 'TS29503_Nudm_UECM.yaml#/components/schemas/NetworkNodeDiameterAddress' diff --git a/lib/sbi/support/standard/TS29510_Nnrf_AccessToken.yaml b/lib/sbi/support/standard/TS29510_Nnrf_AccessToken.yaml index b9c80d628..c4f4b0aa0 100644 --- a/lib/sbi/support/standard/TS29510_Nnrf_AccessToken.yaml +++ b/lib/sbi/support/standard/TS29510_Nnrf_AccessToken.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-3' + version: '1.1.1' title: 'NRF OAuth2' description: | NRF OAuth2 Authorization. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.510 V16.3.0; 5G System; Network Function Repository Services; Stage 3 + description: 3GPP TS 29.510 V16.6.0; 5G System; Network Function Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' paths: @@ -58,6 +58,28 @@ paths: type: string '307': description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': description: Error in the Access Token Request content: @@ -126,11 +148,28 @@ components: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' scope: type: string - pattern: '^([a-zA-Z0-9_-]+)( [a-zA-Z0-9_-]+)*$' + pattern: '^([a-zA-Z0-9_:-]+)( [a-zA-Z0-9_:-]+)*$' targetNfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' requesterPlmn: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + requesterPlmnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 2 + requesterSnssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + requesterFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + requesterSnpnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + minItems: 1 targetPlmn: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' targetSnssaiList: @@ -145,6 +184,8 @@ components: minItems: 1 targetNfSetId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + targetNfServiceSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' AccessTokenRsp: description: Contains information related to the access token response type: object @@ -163,7 +204,7 @@ components: type: integer scope: type: string - pattern: '^([a-zA-Z0-9_-]+)( [a-zA-Z0-9_-]+)*$' + pattern: '^([a-zA-Z0-9_:-]+)( [a-zA-Z0-9_:-]+)*$' AccessTokenClaims: description: The claims data structure for the access token type: object @@ -187,7 +228,7 @@ components: minItems: 1 scope: type: string - pattern: '^([a-zA-Z0-9_-]+)( [a-zA-Z0-9_-]+)*$' + pattern: '^([a-zA-Z0-9_:-]+)( [a-zA-Z0-9_:-]+)*$' exp: type: integer consumerPlmnId: diff --git a/lib/sbi/support/standard/TS29510_Nnrf_Bootstrapping.yaml b/lib/sbi/support/standard/TS29510_Nnrf_Bootstrapping.yaml index f072f142f..23b0ae21a 100644 --- a/lib/sbi/support/standard/TS29510_Nnrf_Bootstrapping.yaml +++ b/lib/sbi/support/standard/TS29510_Nnrf_Bootstrapping.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.0.0.alpha-2' + version: '1.0.1' title: 'NRF Bootstrapping' description: | NRF Bootstrapping. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.510 V16.3.0; 5G System; Network Function Repository Services; Stage 3 + description: 3GPP TS 29.510 V16.6.0; 5G System; Network Function Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' paths: @@ -26,6 +26,30 @@ paths: application/3gppHal+json: schema: $ref: '#/components/schemas/BootstrappingInfo' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '500': diff --git a/lib/sbi/support/standard/TS29510_Nnrf_NFDiscovery.yaml b/lib/sbi/support/standard/TS29510_Nnrf_NFDiscovery.yaml index d4b28785c..60917c5b9 100644 --- a/lib/sbi/support/standard/TS29510_Nnrf_NFDiscovery.yaml +++ b/lib/sbi/support/standard/TS29510_Nnrf_NFDiscovery.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.2' title: 'NRF NFDiscovery Service' description: | NRF NFDiscovery Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.510 V16.3.0; 5G System; Network Function Repository Services; Stage 3 + description: 3GPP TS 29.510 V16.6.0; 5G System; Network Function Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' servers: @@ -135,6 +135,16 @@ paths: items: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' minItems: 1 + - name: requester-plmn-specific-snssai-list + in: query + description: PLMN-specific slice info of the NF issuing the Discovery request + content: + application/json: + schema: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' + minItems: 1 - name: dnn in: query description: Dnn supported by the BSF, SMF or UPF @@ -350,6 +360,13 @@ paths: type: integer maximum: 2000 default: 124 + - name: max-payload-size-ext + in: query + description: Extended query for maximum payload size of the response expressed in kilo octets + required: false + schema: + type: integer + default: 124 - name: atsss-capability in: query description: ATSSS Capability @@ -406,7 +423,7 @@ paths: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' minItems: 1 style: form - explode: false + explode: false - name: If-None-Match in: header description: Validator for conditional requests, as described in IETF RFC 7232, 3.2 @@ -419,6 +436,16 @@ paths: application/json: schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + - name: requester-snpn-list + in: query + description: SNPN ID(s) of the NF instance issuing the Discovery request + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + minItems: 1 - name: af-ee-data in: query description: NEF exposured by the AF @@ -467,6 +494,16 @@ paths: description: Notification Type schema: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NotificationType' + - name: n1-msg-class + in: query + description: N1 Message Class + schema: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N1MessageClass' + - name: n2-info-class + in: query + description: N2 Information Class + schema: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N2InformationClass' - name: serving-scope in: query description: areas that can be served by the target NF @@ -482,6 +519,21 @@ paths: description: IMSI of the requester UE to search for an appropriate NF (e.g. HSS) schema: type: string + - name: ims-private-identity + in: query + description: IMPI of the requester UE to search for a target HSS + schema: + type: string + - name: ims-public-identity + in: query + description: IMS Public Identity of the requester UE to search for a target HSS + schema: + type: string + - name: msisdn + in: query + description: MSISDN of the requester UE to search for a target HSS + schema: + type: string - name: preferred-api-versions in: query description: Preferred API version of the services to be discovered @@ -507,6 +559,78 @@ paths: description: UPF supports redundant transport path to be discovered schema: type: boolean + - name: ipups + in: query + description: UPF which is configured for IPUPS functionality to be discovered + schema: + type: boolean + - name: scp-domain-list + in: query + description: SCP domains the target SCP belongs to + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: address-domain + in: query + description: Address domain reachable through the SCP + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: ipv4-addr + in: query + description: IPv4 address reachable through the SCP + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + - name: ipv6-prefix + in: query + description: IPv6 prefix reachable through the SCP + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + - name: served-nf-set-id + in: query + description: NF Set ID served by the SCP + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + - name: remote-plmn-id + in: query + description: Id of the PLMN reachable through the SCP + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: data-forwarding + in: query + description: UPF Instance(s) configured for data forwarding are requested + schema: + type: boolean + - name: preferred-full-plmn + in: query + description: NF Instance(s) serving the full PLMN are preferred + schema: + type: boolean + - name: requester-features + in: query + description: Features supported by the NF Service Consumer that is invoking the Nnrf_NFDiscovery service + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: realm-id + in: query + description: realm-id to search for an appropriate UDSF + schema: + type: string + - name: storage-id + in: query + description: storage-id to search for an appropriate UDSF + schema: + type: string + - name: vsmf-support-ind + in: query + description: V-SMF capability supported by the target NF instance(s) + schema: + type: boolean responses: '200': description: Expected response to a valid request @@ -544,6 +668,22 @@ paths: type: string '307': description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' headers: Location: description: 'The URI pointing to the resource located on the redirect target NRF' @@ -592,6 +732,30 @@ paths: responses: '200': $ref: '#/components/responses/200' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string /searches/{searchId}/complete: get: @@ -608,6 +772,30 @@ paths: responses: '200': $ref: '#/components/responses/200' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string components: securitySchemes: @@ -646,6 +834,31 @@ components: description: Content-Encoding, described in IETF RFC 7231 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + schemas: SearchResult: description: Contains the list of NF Profiles returned in a Discovery response @@ -701,7 +914,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -743,88 +956,88 @@ components: maximum: 65535 udrInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' - udrInfoExt: - type: array - items: + udrInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' - minItems: 1 + minProperties: 1 udmInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' - udmInfoExt: - type: array - items: + udmInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' - minItems: 1 + minProperties: 1 ausfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' - ausfInfoExt: - type: array - items: + ausfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' - minItems: 1 + minProperties: 1 amfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' - amfInfoExt: - type: array - items: + amfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' - minItems: 1 + minProperties: 1 smfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' - smfInfoExt: - type: array - items: + smfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' - minItems: 1 + minProperties: 1 upfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' - upfInfoExt: - type: array - items: + upfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' - minItems: 1 + minProperties: 1 pcfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' - pcfInfoExt: - type: array - items: + pcfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' - minItems: 1 + minProperties: 1 bsfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' - bsfInfoExt: - type: array - items: + bsfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' - minItems: 1 + minProperties: 1 chfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' - chfInfoExt: - type: array - items: + chfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' - minItems: 1 + minProperties: 1 udsfInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdsfInfo' - udsfInfoExt: - type: array - items: + udsfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdsfInfo' - minItems: 1 + minProperties: 1 nwdafInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NwdafInfo' nefInfo: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NefInfo' - pcscfInfo: - type: array - items: + pcscfInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcscfInfo' - minItems: 1 - hssInfo: - type: array - items: + minProperties: 1 + hssInfoList: + type: object + additionalProperties: $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/HssInfo' - minItems: 1 + minProperties: 1 customInfo: type: object recoveryTime: @@ -833,10 +1046,16 @@ components: type: boolean default: false nfServices: + deprecated: true type: array items: $ref: '#/components/schemas/NFService' minItems: 1 + nfServiceList: + type: object + additionalProperties: + $ref: '#/components/schemas/NFService' + minProperties: 1 defaultNotificationSubscriptions: type: array items: @@ -866,6 +1085,23 @@ components: olcHSupportInd: type: boolean default: false + nfSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + serviceSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + scpDomains: + type: array + items: + type: string + minItems: 1 + scpInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ScpInfo' NFService: description: Information of a given NF Service Instance; it is part of the NFProfile of an NF Instance discovered by the NRF type: object @@ -931,7 +1167,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -949,6 +1185,20 @@ components: minProperties: 1 oauth2Required: type: boolean + allowedOperationsPerNfType: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 + allowedOperationsPerNfInstance: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 PreferredSearch: description: Contains information on whether the returned NFProfiles match the preferred query parameters type: object @@ -956,3 +1206,16 @@ components: preferredTaiMatchInd: type: boolean default: false + preferredFullPlmnMatchInd: + type: boolean + default: false + preferredApiVersionsMatchInd: + type: boolean + otherApiVersionsInd: + type: boolean + preferredLocalityMatchInd: + type: boolean + default: false + otherLocalityInd: + type: boolean + default: false diff --git a/lib/sbi/support/standard/TS29510_Nnrf_NFManagement.yaml b/lib/sbi/support/standard/TS29510_Nnrf_NFManagement.yaml index ec5be3f28..3b93b29ec 100644 --- a/lib/sbi/support/standard/TS29510_Nnrf_NFManagement.yaml +++ b/lib/sbi/support/standard/TS29510_Nnrf_NFManagement.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.1.0.alpha-4' + version: '1.1.2' title: 'NRF NFManagement Service' description: | NRF NFManagement Service. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.510 V16.3.0; 5G System; Network Function Repository Services; Stage 3 + description: 3GPP TS 29.510 V16.6.0; 5G System; Network Function Repository Services; Stage 3 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' servers: @@ -58,6 +58,30 @@ paths: additionalProperties: $ref: 'TS29571_CommonData.yaml#/components/schemas/LinksValueSchema' minProperties: 1 + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -92,11 +116,46 @@ paths: responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OptionsResponse' headers: Accept-Encoding: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '204': + description: No Content + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -130,6 +189,11 @@ paths: required: true schema: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: requester-features + in: query + description: Features supported by the NF Service Consumer + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' responses: '200': description: Expected response to a valid request @@ -137,6 +201,30 @@ paths: application/json: schema: $ref: '#/components/schemas/NFProfile' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -227,6 +315,30 @@ paths: description: Content-Encoding, described in IETF RFC 7231 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -305,6 +417,30 @@ paths: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -342,6 +478,30 @@ paths: responses: '204': description: Expected response to a successful deregistration + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -406,6 +566,30 @@ paths: description: Content-Encoding, described in IETF RFC 7231 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -454,6 +638,30 @@ paths: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on another NF service consumer instance' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on another NF service consumer instance' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -533,6 +741,30 @@ paths: description: Accept-Encoding, described in IETF RFC 7694 schema: type: string + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '403': @@ -571,6 +803,30 @@ paths: responses: '204': description: Expected response to a successful subscription removal + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string + '308': + description: Permanent Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI pointing to the resource located on the redirect target NRF' + required: true + schema: + type: string '400': $ref: 'TS29571_CommonData.yaml#/components/responses/400' '401': @@ -606,7 +862,7 @@ components: nnrf-nfm: Access to the Nnrf_NFManagement API schemas: NFProfile: - description: Information of an NF Instance registered in the NRF + description: Information of an NF Instance registered in the NRF type: object required: - nfInstanceId @@ -640,7 +896,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -689,7 +945,7 @@ components: allowedNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 priority: type: integer @@ -709,90 +965,90 @@ components: type: string udrInfo: $ref: '#/components/schemas/UdrInfo' - udrInfoExt: - type: array - items: + udrInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UdrInfo' - minItems: 1 + minProperties: 1 udmInfo: $ref: '#/components/schemas/UdmInfo' - udmInfoExt: - type: array - items: + udmInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UdmInfo' - minItems: 1 + minProperties: 1 ausfInfo: $ref: '#/components/schemas/AusfInfo' - ausfInfoExt: - type: array - items: + ausfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/AusfInfo' - minItems: 1 + minProperties: 1 amfInfo: $ref: '#/components/schemas/AmfInfo' - amfInfoExt: - type: array - items: + amfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/AmfInfo' - minItems: 1 + minProperties: 1 smfInfo: $ref: '#/components/schemas/SmfInfo' - smfInfoExt: - type: array - items: + smfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/SmfInfo' - minItems: 1 + minProperties: 1 upfInfo: $ref: '#/components/schemas/UpfInfo' - upfInfoExt: - type: array - items: + upfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UpfInfo' - minItems: 1 + minProperties: 1 pcfInfo: $ref: '#/components/schemas/PcfInfo' - pcfInfoExt: - type: array - items: + pcfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/PcfInfo' - minItems: 1 + minProperties: 1 bsfInfo: $ref: '#/components/schemas/BsfInfo' - bsfInfoExt: - type: array - items: + bsfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/BsfInfo' - minItems: 1 + minProperties: 1 chfInfo: $ref: '#/components/schemas/ChfInfo' - chfInfoExt: - type: array - items: + chfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/ChfInfo' - minItems: 1 + minProperties: 1 nefInfo: $ref: '#/components/schemas/NefInfo' nrfInfo: $ref: '#/components/schemas/NrfInfo' udsfInfo: $ref: '#/components/schemas/UdsfInfo' - udsfInfoExt: - type: array - items: + udsfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/UdsfInfo' - minItems: 1 + minProperties: 1 nwdafInfo: $ref: '#/components/schemas/NwdafInfo' - pcscfInfo: - type: array - items: + pcscfInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/PcscfInfo' - minItems: 1 - hssInfo: - type: array - items: + minProperties: 1 + hssInfoList: + type: object + additionalProperties: $ref: '#/components/schemas/HssInfo' - minItems: 1 + minProperties: 1 customInfo: type: object recoveryTime: @@ -801,10 +1057,16 @@ components: type: boolean default: false nfServices: + deprecated: true type: array items: $ref: '#/components/schemas/NFService' minItems: 1 + nfServiceList: + type: object + additionalProperties: + $ref: '#/components/schemas/NFService' + minProperties: 1 nfProfileChangesSupportInd: type: boolean default: false @@ -837,6 +1099,23 @@ components: olcHSupportInd: type: boolean default: false + nfSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + serviceSetRecoveryTimeList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + minProperties: 1 + scpDomains: + type: array + items: + type: string + minItems: 1 + scpInfo: + $ref: '#/components/schemas/ScpInfo' NFService: description: Information of a given NF Service Instance; it is part of the NFProfile of an NF Instance type: object @@ -899,8 +1178,22 @@ components: allowedNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 + allowedOperationsPerNfType: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 + allowedOperationsPerNfInstance: + type: object + additionalProperties: + type: array + items: + type: string + minItems: 1 priority: type: integer minimum: 0 @@ -929,7 +1222,7 @@ components: sNssais: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 perPlmnSnssaiList: type: array @@ -983,6 +1276,9 @@ components: - SCSAS - SCEF - SCP + - NSSAAF + - ICSCF + - SCSCF - type: string Fqdn: description: Fully Qualified Domain Name @@ -1018,6 +1314,7 @@ components: subscrCond: oneOf: - $ref: '#/components/schemas/NfInstanceIdCond' + - $ref: '#/components/schemas/NfInstanceIdListCond' - $ref: '#/components/schemas/NfTypeCond' - $ref: '#/components/schemas/ServiceNameCond' - $ref: '#/components/schemas/AmfCond' @@ -1027,6 +1324,9 @@ components: - $ref: '#/components/schemas/NfSetCond' - $ref: '#/components/schemas/NfServiceSetCond' - $ref: '#/components/schemas/UpfCond' + - $ref: '#/components/schemas/ScpDomainCond' + - $ref: '#/components/schemas/NwdafCond' + - $ref: '#/components/schemas/NefCond' subscriptionId: type: string pattern: '^([0-9]{5,6}-)?[^-]+$' @@ -1053,11 +1353,34 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' minItems: 1 + reqPerPlmnSnssais: + type: array + items: + $ref: '#/components/schemas/PlmnSnssai' + minItems: 1 reqPlmnList: type: array items: $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' minItems: 1 + reqSnpnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + minItems: 1 + servingScope: + type: array + items: + type: string + minItems: 1 + requesterFeatures: + writeOnly: true + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + nrfSupportedFeatures: + readOnly: true + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' NfInstanceIdCond: description: Subscription to a given NF Instance Id type: object @@ -1066,6 +1389,17 @@ components: properties: nfInstanceId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + NfInstanceIdListCond: + description: Subscription to a list of NF Instances + type: object + required: + - nfInstanceIdList + properties: + nfInstanceIdList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 NfTypeCond: description: Subscription to a set of NFs based on their NF Type type: object @@ -1179,7 +1513,7 @@ components: $ref: '#/components/schemas/DataSetId' minItems: 1 SupiRange: - description: A range of SUPIs (subscriber identities), either based on a numeric range, or based on regular-expression matching + description: A range of SUPIs (subscriber identities), either based on a numeric range, or based on regular-expression matching type: object properties: start: @@ -1342,6 +1676,9 @@ components: type: integer minimum: 0 maximum: 65535 + vsmfSupportInd: + type: boolean + default: false SnssaiSmfInfoItem: description: Set of parameters supported by SMF for a given S-NSSAI type: object @@ -1416,6 +1753,12 @@ components: redundantGtpu: type: boolean default: false + ipups: + type: boolean + default: false + dataForwarding: + type: boolean + default: false SnssaiUpfInfoItem: description: Set of parameters supported by UPF for a given S-NSSAI type: object @@ -1491,6 +1834,7 @@ components: - N3 - N6 - N9 + - DATA_FORWARDING - type: string WAgfInfo: description: Information of the W-AGF end-points @@ -1633,6 +1977,8 @@ components: items: type: string minItems: 1 + binding: + type: string NfSetCond: description: Subscription to a set of NFs based on their Set Id type: object @@ -1650,6 +1996,7 @@ components: nfServiceSetId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfServiceSetId' UpfCond: + description: Subscription to a set of NF Instances (UPFs), able to serve a certain service area (i.e. SMF serving area or TAI list) type: object properties: smfServingArea: @@ -1662,6 +2009,24 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' minItems: 1 + NwdafCond: + description: Subscription to a set of NF Instances (NWDAFs), identified by Analytics ID(s). + type: object + properties: + analyticsIds: + type: array + items: + type: string + minItems: 1 + NefCond: + description: Subscription to a set of NF Instances (NEFs), identified by Event ID(s) provided by AF. + type: object + properties: + eventIds: + type: array + items: + $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/EventId' + minItems: 1 NotificationType: description: Types of notifications used in Default Notification URIs in the NF Profile of an NF Instance anyOf: @@ -1673,6 +2038,8 @@ components: - DATA_REMOVAL_NOTIFICATION - DATA_CHANGE_NOTIFICATION - LOCATION_UPDATE_NOTIFICATION + - NSSAA_REAUTH_NOTIFICATION + - NSSAA_REVOC_NOTIFICATION - type: string TransportProtocol: description: Types of transport protocol used in a given IP endpoint of an NF Service Instance @@ -1735,6 +2102,8 @@ components: required: [ interPlmnFqdn ] - not: required: [ allowedPlmns ] + - not: + required: [ allowedSnpns ] - not: required: [ allowedNfTypes ] - not: @@ -1751,6 +2120,8 @@ components: required: [ interPlmnFqdn ] - not: required: [ allowedPlmns ] + - not: + required: [ allowedSnpns ] - not: required: [ allowedNfTypes ] - not: @@ -1762,6 +2133,8 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/ChangeItem' minItems: 1 + conditionEvent: + $ref: '#/components/schemas/ConditionEventType' NFStatus: description: Status of a given NF Instance stored in NRF anyOf: @@ -1770,7 +2143,7 @@ components: - REGISTERED - SUSPENDED - UNDISCOVERABLE - type: string + - type: string NFServiceVersion: description: Contains the version details of an NF service type: object @@ -1805,6 +2178,7 @@ components: - namf-loc - nsmf-pdusession - nsmf-event-exposure + - nsmf-nidd - nausf-auth - nausf-sorprotection - nausf-upuprotection @@ -1836,12 +2210,15 @@ components: - nhss-sdm - nhss-uecm - nhss-ueau + - nhss-ee - nhss-ims-sdm - nhss-ims-uecm - nhss-ims-ueau - nsepp-telescopic - nsoraf-sor - nspaf-secured-packet + - nudsf-dr + - nnssaaf-nssaa - type: string N2InterfaceAmfInfo: description: AMF N2 interface information @@ -1927,46 +2304,118 @@ components: additionalProperties: $ref: '#/components/schemas/UdrInfo' minProperties: 1 + servedUdrInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UdrInfo' + minProperties: 1 + minProperties: 1 servedUdmInfo: type: object additionalProperties: $ref: '#/components/schemas/UdmInfo' minProperties: 1 + servedUdmInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UdmInfo' + minProperties: 1 + minProperties: 1 servedAusfInfo: type: object additionalProperties: $ref: '#/components/schemas/AusfInfo' minProperties: 1 + servedAusfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/AusfInfo' + minProperties: 1 + minProperties: 1 servedAmfInfo: type: object additionalProperties: $ref: '#/components/schemas/AmfInfo' minProperties: 1 + servedAmfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/AmfInfo' + minProperties: 1 + minProperties: 1 servedSmfInfo: type: object additionalProperties: $ref: '#/components/schemas/SmfInfo' minProperties: 1 + servedSmfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/SmfInfo' + minProperties: 1 + minProperties: 1 servedUpfInfo: type: object additionalProperties: $ref: '#/components/schemas/UpfInfo' minProperties: 1 + servedUpfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UpfInfo' + minProperties: 1 + minProperties: 1 servedPcfInfo: type: object additionalProperties: $ref: '#/components/schemas/PcfInfo' minProperties: 1 + servedPcfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/PcfInfo' + minProperties: 1 + minProperties: 1 servedBsfInfo: type: object additionalProperties: $ref: '#/components/schemas/BsfInfo' minProperties: 1 + servedBsfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/BsfInfo' + minProperties: 1 + minProperties: 1 servedChfInfo: type: object additionalProperties: $ref: '#/components/schemas/ChfInfo' minProperties: 1 + servedChfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/ChfInfo' + minProperties: 1 + minProperties: 1 servedNefInfo: type: object additionalProperties: @@ -1977,10 +2426,13 @@ components: additionalProperties: $ref: '#/components/schemas/NwdafInfo' minProperties: 1 - servedPcscfInfo: + servedPcscfInfoList: type: object additionalProperties: - $ref: '#/components/schemas/PcscfInfo' + type: object + additionalProperties: + $ref: '#/components/schemas/PcscfInfo' + minProperties: 1 minProperties: 1 servedGmlcInfo: type: object @@ -1997,10 +2449,31 @@ components: additionalProperties: $ref: '#/components/schemas/NfInfo' minProperties: 1 - servedHssInfo: + servedHssInfoList: type: object additionalProperties: - $ref: '#/components/schemas/HssInfo' + type: object + additionalProperties: + $ref: '#/components/schemas/HssInfo' + minProperties: 1 + minProperties: 1 + servedUdsfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UdsfInfo' + minProperties: 1 + servedUdsfInfoList: + type: object + additionalProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/UdsfInfo' + minProperties: 1 + minProperties: 1 + servedScpInfoList: + type: object + additionalProperties: + $ref: '#/components/schemas/ScpInfo' minProperties: 1 PlmnSnssai: description: List of network slices (S-NSSAIs) for a given PLMN ID @@ -2014,7 +2487,7 @@ components: sNssaiList: type: array items: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtSnssai' minItems: 1 nid: $ref: 'TS29571_CommonData.yaml#/components/schemas/Nid' @@ -2028,6 +2501,21 @@ components: $ref: '#/components/schemas/PfdData' afEeData: $ref: '#/components/schemas/AfEventExposureData' + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + externalGroupIdentifiersRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + servedFqdnList: + type: array + items: + type: string + minItems: 1 PfdData: description: List of Application IDs and/or AF IDs managed by a given NEF Instance type: object @@ -2067,6 +2555,7 @@ components: $ref: '#/components/schemas/TaiRange' minItems: 1 LmfInfo: + description: Information of an LMF NF Instance type: object properties: servingClientTypes: @@ -2092,6 +2581,7 @@ components: $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' minItems: 1 GmlcInfo: + description: Information of a GMLC NF Instance type: object properties: servingClientTypes: @@ -2134,6 +2624,18 @@ components: items: $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' minItems: 1 + gmFqdn: + $ref: '#/components/schemas/Fqdn' + gmIpv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + gmIpv6Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 NfInfo: description: Information of a generic NF Instance type: object @@ -2146,11 +2648,26 @@ components: properties: groupId: $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' - imsRanges: + imsiRanges: type: array items: $ref: '#/components/schemas/ImsiRange' minItems: 1 + imsPrivateIdentityRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + imsPublicIdentityRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + msisdnRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 ImsiRange: description: A range of IMSIs (subscriber identities), either based on a numeric range, or based on regular-expression matching type: object @@ -2164,6 +2681,7 @@ components: pattern: type: string TwifInfo: + description: Addressing information (IP addresses, FQDN) of the TWIF type: object properties: ipv4EndpointAddresses: @@ -2194,6 +2712,7 @@ components: featureVersion: type: string AnNodeType: + description: Access Network Node Type (gNB, ng-eNB...) anyOf: - type: string enum: @@ -2201,6 +2720,7 @@ components: - NG_ENB - type: string UdsfInfo: + description: Information related to UDSF type: object properties: groupId: @@ -2210,3 +2730,113 @@ components: items: $ref: '#/components/schemas/SupiRange' minItems: 1 + storageIdRanges: + description: A map (list of key-value pairs) where realmId serves as key and each value in the map is an array of IdentityRanges. Each IdentityRange is a range of storageIds. + type: object + additionalProperties: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + minProperties: 1 + ScpInfo: + description: Information of an SCP Instance + type: object + properties: + scpDomainInfoList: + type: object + additionalProperties: + items: + $ref: '#/components/schemas/ScpDomainInfo' + minProperties: 1 + scpPrefix: + type: string + scpPorts: + type: object + additionalProperties: + type: integer + minimum: 0 + maximum: 65535 + minProperties: 1 + addressDomains: + type: array + items: + type: string + minItems: 1 + ipv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6Prefixes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + minItems: 1 + ipv4AddrRanges: + type: array + items: + $ref: '#/components/schemas/Ipv4AddressRange' + minItems: 1 + ipv6PrefixRanges: + type: array + items: + $ref: '#/components/schemas/Ipv6PrefixRange' + minItems: 1 + servedNfSetIdList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + minItems: 1 + remotePlmnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + + ScpDomainInfo: + description: SCP Domain specific information + type: object + properties: + scpFqdn: + $ref: '#/components/schemas/Fqdn' + scpIpEndPoints: + type: array + items: + $ref: '#/components/schemas/IpEndPoint' + minItems: 1 + scpPrefix: + type: string + scpPorts: + type: object + additionalProperties: + type: integer + minimum: 0 + maximum: 65535 + minProperties: 1 + + ScpDomainCond: + description: Subscription to a set of NF or SCP instances belonging to certain SCP domains + type: object + properties: + scpDomains: + type: array + items: + type: string + minItems: 1 + + OptionsResponse: + description: Communication options of the NRF sent in response payload of OPTIONS method + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + ConditionEventType: + description: Indicates whether a notification is due to the NF Instance to start or stop being part of a condition for a subscription to a set of NFs + anyOf: + - type: string + enum: + - NF_ADDED + - NF_REMOVED + - type: string diff --git a/lib/sbi/support/standard/TS29571_CommonData.yaml b/lib/sbi/support/standard/TS29571_CommonData.yaml index aadfb1261..df35bfee1 100644 --- a/lib/sbi/support/standard/TS29571_CommonData.yaml +++ b/lib/sbi/support/standard/TS29571_CommonData.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: - version: '1.2.0.alpha-4' + version: '1.2.2' title: 'Common Data Types' description: | Common Data Types for Service Based Interfaces. @@ -9,7 +9,7 @@ info: All rights reserved. externalDocs: - description: 3GPP TS 29.571 Common Data Types for Service Based Interfaces, version 16.3.0 + description: 3GPP TS 29.571 Common Data Types for Service Based Interfaces, version 16.6.0 url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.571/' paths: {} @@ -161,22 +161,23 @@ components: maximum: 65535 nullable: true Uint32: - format: int32 type: integer minimum: 0 + maximum: 4294967295 #(2^32)-1 Uint32Rm: format: int32 type: integer minimum: 0 + maximum: 4294967295 #(2^32)-1 nullable: true Uint64: - format: int64 type: integer minimum: 0 + maximum: 18446744073709551615 #(2^64)-1 Uint64Rm: - format: int64 type: integer minimum: 0 + maximum: 18446744073709551615 #(2^64)-1 nullable: true Uri: type: string @@ -290,6 +291,8 @@ components: minItems: 1 supportedFeatures: $ref: '#/components/schemas/SupportedFeatures' + targetScp: + $ref: '#/components/schemas/Uri' Link: type: object properties: @@ -562,23 +565,16 @@ components: type: object properties: plmnId: - $ref: '#/components/schemas/PlmnId' + $ref: '#/components/schemas/PlmnIdNid' amfId: $ref: '#/components/schemas/AmfId' required: - plmnId - amfId GuamiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - amfId: - $ref: '#/components/schemas/AmfId' - required: - - plmnId - - amfId - nullable: true + anyOf: + - $ref: '#/components/schemas/Guami' + - $ref: '#/components/schemas/NullValue' NetworkId: type: object properties: @@ -656,6 +652,12 @@ components: N3IwfId: type: string pattern: '^[A-Fa-f0-9]+$' + WAgfId: + type: string + pattern: '^[A-Fa-f0-9]+$' + TngfId: + type: string + pattern: '^[A-Fa-f0-9]+$' NgeNbId: type: string pattern: '^(MacroNGeNB-[A-Fa-f0-9]{5}|LMacroNGeNB-[A-Fa-f0-9]{6}|SMacroNGeNB-[A-Fa-f0-9]{5})$' @@ -689,6 +691,8 @@ components: pattern: '^(MacroeNB-[A-Fa-f0-9]{5}|LMacroeNB-[A-Fa-f0-9]{6}|SMacroeNB-[A-Fa-f0-9]{5}|HomeeNB-[A-Fa-f0-9]{7})$' Gli: $ref: '#/components/schemas/Bytes' + Gci: + type: string # # ENUMERATED DATA TYPES @@ -714,8 +718,7 @@ components: - NBIOT - WIRELINE - WIRELINE_CABLE - - WIRELINE_DSL - - WIRELINE_PON + - WIRELINE_BBF - LTE-M - NR_U - EUTRA_U @@ -725,9 +728,9 @@ components: - GERA - type: string RatTypeRm: - allOf: + anyOf: - $ref: '#/components/schemas/RatType' - nullable: true + - $ref: '#/components/schemas/NullValue' PduSessionType: anyOf: - type: string @@ -889,7 +892,6 @@ components: anyOf: - type: string enum: - - "LOCATION_NOT_ALLOWED" - "LOCATION_ALLOWED_WITH_NOTIFICATION" - "LOCATION_ALLOWED_WITHOUT_NOTIFICATION" - "LOCATION_ALLOWED_WITHOUT_RESPONSE" @@ -903,9 +905,6 @@ components: content defined in the present version of this API. description: > Possible values are - - "LOCATION_NOT_ALLOWED": Indicates the start of MO Exception Data delivery. - - "STOP": Indicates the stop of MO Exception Data delivery. - - "LOCATION_NOT_ALLOWED": Location not allowed - "LOCATION_ALLOWED_WITH_NOTIFICATION": Location allowed with notification - "LOCATION_ALLOWED_WITHOUT_NOTIFICATION": Location allowed without notification - "LOCATION_ALLOWED_WITHOUT_RESPONSE": Location with notification and privacy verification; location allowed if no response @@ -940,12 +939,13 @@ components: anyOf: - $ref: '#/components/schemas/DlDataDeliveryStatus' - $ref: '#/components/schemas/NullValue' - MoExceptionDataFlag: + AuthStatus: anyOf: - type: string enum: - - START - - STOP + - EAP_SUCCESS + - EAP_FAILURE + - PENDING - type: string description: > This string provides forward-compatibility with future @@ -953,8 +953,9 @@ components: content defined in the present version of this API. description: > Possible values are - - "START": Indicates the start of MO Exception Data delivery. - - "STOP": Indicates the stop of MO Exception Data delivery. + - "EAP_SUCCESS": The NSSAA status is EAP-Success. + - "EAP_FAILURE": The NSSAA status is EAP-Failure. + - "PENDING": The NSSAA status is Pending. # # STRUCTURED DATA TYPES @@ -972,6 +973,7 @@ components: pattern: '^[A-Fa-f0-9]{6}$' required: - sst + PlmnId: type: object properties: @@ -983,16 +985,9 @@ components: - mcc - mnc PlmnIdRm: - type: object - properties: - mcc: - $ref: '#/components/schemas/Mcc' - mnc: - $ref: '#/components/schemas/Mnc' - required: - - mcc - - mnc - nullable: true + anyOf: + - $ref: '#/components/schemas/PlmnId' + - $ref: '#/components/schemas/NullValue' Tai: type: object properties: @@ -1006,18 +1001,9 @@ components: - plmnId - tac TaiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - tac: - $ref: '#/components/schemas/Tac' - nid: - $ref: '#/components/schemas/Nid' - required: - - plmnId - - tac - nullable: true + anyOf: + - $ref: '#/components/schemas/Tai' + - $ref: '#/components/schemas/NullValue' Ecgi: type: object properties: @@ -1032,19 +1018,9 @@ components: - plmnId - eutraCellId EcgiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - # PLMN Identity - eutraCellId: - $ref: '#/components/schemas/EutraCellId' - nid: - $ref: '#/components/schemas/Nid' - required: - - plmnId - - eutraCellId - nullable: true + anyOf: + - $ref: '#/components/schemas/Ecgi' + - $ref: '#/components/schemas/NullValue' Ncgi: type: object properties: @@ -1058,18 +1034,9 @@ components: - plmnId - nrCellId NcgiRm: - type: object - properties: - plmnId: - $ref: '#/components/schemas/PlmnId' - nrCellId: - $ref: '#/components/schemas/NrCellId' - nid: - $ref: '#/components/schemas/Nid' - required: - - plmnId - - nrCellId - nullable: true + anyOf: + - $ref: '#/components/schemas/Ncgi' + - $ref: '#/components/schemas/NullValue' UserLocation: type: object properties: @@ -1109,32 +1076,9 @@ components: - tai - ecgi EutraLocationRm: - type: object - properties: - tai: - $ref: '#/components/schemas/Tai' - ecgi: - $ref: '#/components/schemas/Ecgi' - ageOfLocationInformation: - type: integer - minimum: 0 - maximum: 32767 - ueLocationTimestamp: - $ref: '#/components/schemas/DateTime' - geographicalInformation: - type: string - pattern: '^[0-9A-F]{16}$' - geodeticInformation: - type: string - pattern: '^[0-9A-F]{20}$' - globalNgenbId: - $ref: '#/components/schemas/GlobalRanNodeId' - globalENbId: - $ref: '#/components/schemas/GlobalRanNodeId' - required: - - tai - - ecgi - nullable: true + anyOf: + - $ref: '#/components/schemas/EutraLocation' + - $ref: '#/components/schemas/NullValue' NrLocation: type: object properties: @@ -1160,33 +1104,9 @@ components: - tai - ncgi NrLocationRm: - type: object - properties: - tai: - $ref: '#/components/schemas/Tai' - ncgi: - $ref: '#/components/schemas/Ncgi' - ignoreNcgi: - type: boolean - default: false - ageOfLocationInformation: - type: integer - minimum: 0 - maximum: 32767 - ueLocationTimestamp: - $ref: '#/components/schemas/DateTime' - geographicalInformation: - type: string - pattern: '^[0-9A-F]{16}$' - geodeticInformation: - type: string - pattern: '^[0-9A-F]{20}$' - globalGnbId: - $ref: '#/components/schemas/GlobalRanNodeId' - required: - - tai - - ncgi - nullable: true + anyOf: + - $ref: '#/components/schemas/NrLocation' + - $ref: '#/components/schemas/NullValue' N3gaLocation: type: object properties: @@ -1201,16 +1121,18 @@ components: $ref: '#/components/schemas/Ipv6Addr' portNumber: $ref: '#/components/schemas/Uinteger' - ssId: - type: string - bssId: - type: string - civicAddress: - $ref: '#/components/schemas/Bytes' + tnapId: + $ref: '#/components/schemas/TnapId' + twapId: + $ref: '#/components/schemas/TwapId' hfcNodeId: $ref: '#/components/schemas/HfcNodeId' gli: $ref: '#/components/schemas/Gli' + w5gbanLineType: + $ref: '#/components/schemas/LineType' + gci: + $ref: '#/components/schemas/Gci' UpSecurity: type: object properties: @@ -1222,16 +1144,9 @@ components: - upIntegr - upConfid UpSecurityRm: - type: object - properties: - upIntegr: - $ref: '#/components/schemas/UpIntegrity' - upConfid: - $ref: '#/components/schemas/UpConfidentiality' - required: - - upIntegr - - upConfid - nullable: true + anyOf: + - $ref: '#/components/schemas/UpSecurity' + - $ref: '#/components/schemas/NullValue' NgApCause: type: object properties: @@ -1262,13 +1177,9 @@ components: required: - contentId RefToBinaryDataRm: - type: object - properties: - contentId: - type: string - required: - - contentId - nullable: true + anyOf: + - $ref: '#/components/schemas/RefToBinaryData' + - $ref: '#/components/schemas/NullValue' RouteToLocation: type: object properties: @@ -1403,6 +1314,8 @@ components: properties: praId: type: string + additionalPraId: + type: string presenceState: $ref: '#/components/schemas/PresenceState' trackingAreaList: @@ -1435,6 +1348,8 @@ components: properties: praId: type: string + additionalPraId: + type: string presenceState: $ref: '#/components/schemas/PresenceState' trackingAreaList: @@ -1473,6 +1388,10 @@ components: $ref: '#/components/schemas/GNbId' ngeNbId: $ref: '#/components/schemas/NgeNbId' + wagfId: + $ref: '#/components/schemas/WAgfId' + tngfId: + $ref: '#/components/schemas/TngfId' nid: $ref: '#/components/schemas/Nid' eNbId: @@ -1481,6 +1400,8 @@ components: - required: [ n3IwfId ] - required: [ gNbId ] - required: [ ngeNbId ] + - required: [ wagfId ] + - required: [ tngfId ] - required: [ eNbId ] required: - plmnId @@ -1506,6 +1427,9 @@ components: mptcp: type: boolean default: false + rttWithoutPmf: + type: boolean + default: false PlmnIdNid: type: object required: @@ -1560,13 +1484,9 @@ components: hfcNId: $ref: '#/components/schemas/HfcNId' HfcNodeIdRm: - type: object - required: - - hfcNId - properties: - hfcNId: - $ref: '#/components/schemas/HfcNId' - nullable: true + anyOf: + - $ref: '#/components/schemas/HfcNodeId' + - $ref: '#/components/schemas/NullValue' ScheduledCommunicationTime: type: object properties: @@ -1793,7 +1713,99 @@ components: type: integer timeStamp: $ref: '#/components/schemas/DateTime' + NssaaStatus: + type: object + required: + - snssai + - status + properties: + snssai: + $ref: '#/components/schemas/Snssai' + status: + $ref: '#/components/schemas/AuthStatus' + NssaaStatusRm: + anyOf: + - $ref: '#/components/schemas/NssaaStatus' + - $ref: '#/components/schemas/NullValue' + TnapId: + type: object + properties: + ssId: + type: string + bssId: + type: string + civicAddress: + $ref: '#/components/schemas/Bytes' + TnapIdRm: + anyOf: + - $ref: '#/components/schemas/TnapId' + - $ref: '#/components/schemas/NullValue' + TwapId: + type: object + required: + - ssId + properties: + ssId: + type: string + bssId: + type: string + civicAddress: + $ref: '#/components/schemas/Bytes' + TwapIdRm: + anyOf: + - $ref: '#/components/schemas/TwapId' + - $ref: '#/components/schemas/NullValue' + LineType: + anyOf: + - type: string + enum: + - DSL + - PON + - type: string + description: > + This string provides forward-compatibility with future + extensions to the enumeration but is not used to encode + content defined in the present version of this API. + description: > + Possible values are + - DSL: Identifies a DSL line + - PON: Identifies a PON line + LineTypeRm: + anyOf: + - $ref: '#/components/schemas/LineType' + - $ref: '#/components/schemas/NullValue' + SnssaiExtension: + description: Extensions to the Snssai data type + type: object + properties: + sdRanges: + type: array + items: + $ref: '#/components/schemas/SdRange' + minItems: 1 + wildcardSd: + type: boolean + default: false + + SdRange: + description: A range of SDs (Slice Differentiators) + type: object + properties: + start: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + end: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + +# +# Data types describing alternative data types or combinations of data types +# + ExtSnssai: + allOf: + - $ref: '#/components/schemas/Snssai' + - $ref: '#/components/schemas/SnssaiExtension' # # Data Types related to 5G QoS as defined in clause 5.5 @@ -1903,9 +1915,9 @@ components: RgWirelineCharacteristics: $ref: '#/components/schemas/Bytes' RgWirelineCharacteristicsRm: - allOf: + anyOf: - $ref: '#/components/schemas/RgWirelineCharacteristics' - - nullable: true + - $ref: '#/components/schemas/NullValue' ExtMaxDataBurstVol: type: integer minimum: 4096 @@ -1915,6 +1927,13 @@ components: minimum: 4096 maximum: 2000000 nullable: true + ExtPacketDelBudget: + type: integer + minimum: 1 + ExtPacketDelBudgetRm: + type: integer + minimum: 1 + nullable: true # # ENUMERATED DATA TYPES @@ -1977,7 +1996,7 @@ components: - $ref: '#/components/schemas/QosResourceType' - $ref: '#/components/schemas/NullValue' AdditionalQosFlowInfo: - anyOf: + anyOf: - anyOf: - type: string enum: @@ -2004,19 +2023,9 @@ components: - preemptCap - preemptVuln ArpRm: - type: object - properties: - priorityLevel: - $ref: '#/components/schemas/ArpPriorityLevel' - preemptCap: - $ref: '#/components/schemas/PreemptionCapability' - preemptVuln: - $ref: '#/components/schemas/PreemptionVulnerability' - required: - - priorityLevel - - preemptCap - - preemptVuln - nullable: true + anyOf: + - $ref: '#/components/schemas/Arp' + - $ref: '#/components/schemas/NullValue' Ambr: type: object properties: @@ -2028,16 +2037,9 @@ components: - uplink - downlink AmbrRm: - type: object - properties: - uplink: - $ref: '#/components/schemas/BitRate' - downlink: - $ref: '#/components/schemas/BitRate' - required: - - uplink - - downlink - nullable: true + anyOf: + - $ref: '#/components/schemas/Ambr' + - $ref: '#/components/schemas/NullValue' Dynamic5Qi: type: object properties: @@ -2055,6 +2057,12 @@ components: $ref: '#/components/schemas/MaxDataBurstVol' extMaxDataBurstVol: $ref: '#/components/schemas/ExtMaxDataBurstVol' + extPacketDelBudget: + $ref: '#/components/schemas/ExtPacketDelBudget' + cnPacketDelayBudgetDl: + $ref: '#/components/schemas/ExtPacketDelBudget' + cnPacketDelayBudgetUl: + $ref: '#/components/schemas/ExtPacketDelBudget' required: - resourceType - priorityLevel @@ -2071,21 +2079,11 @@ components: $ref: '#/components/schemas/MaxDataBurstVol' extMaxDataBurstVol: $ref: '#/components/schemas/ExtMaxDataBurstVol' + cnPacketDelayBudgetDl: + $ref: '#/components/schemas/ExtPacketDelBudget' + cnPacketDelayBudgetUl: + $ref: '#/components/schemas/ExtPacketDelBudget' minProperties: 0 - Tmbr: - type: object - properties: - uplink: - $ref: '#/components/schemas/BitRate' - downlink: - $ref: '#/components/schemas/BitRate' - required: - - uplink - - downlink - TmbrRm: - anyOf: - - $ref: '#/components/schemas/Tmbr' - - $ref: '#/components/schemas/NullValue' # # Data Types related to 5G Trace as defined in clause 5.6 @@ -2094,6 +2092,14 @@ components: # # SIMPLE DATA TYPES # + PhysCellId: + type: integer + minimum: 0 + maximum: 1007 + ArfcnValueNR: + type: integer + minimum: 0 + maximum: 3279165 # # # Enumerations @@ -2113,6 +2119,232 @@ components: anyOf: - $ref: '#/components/schemas/TraceDepth' - $ref: '#/components/schemas/NullValue' + JobType: + anyOf: + - type: string + enum: + - IMMEDIATE_MDT_ONLY + - LOGGED_MDT_ONLY + - TRACE_ONLY + - IMMEDIATE_MDT_AND_TRACE + - RLF_REPORTS_ONLY + - RCEF_REPORTS_ONLY + - LOGGED_MBSFN_MDT + - type: string + ReportTypeMdt: + anyOf: + - type: string + enum: + - PERIODICAL + - EVENT_TRIGGED + - type: string + MeasurementLteForMdt: + anyOf: + - type: string + enum: + - M1 + - M2 + - M3 + - M4_DL + - M4_UL + - M5_DL + - M5_UL + - M6_DL + - M6_UL + - M7_DL + - M7_UL + - M8 + - M9 + - type: string + MeasurementNrForMdt: + anyOf: + - type: string + enum: + - M1 + - M2 + - M3 + - M4_DL + - M4_UL + - M5_DL + - M5_UL + - M6_DL + - M6_UL + - M7_DL + - M7_UL + - M8 + - M9 + - type: string + SensorMeasurement: + anyOf: + - type: string + enum: + - BAROMETRIC_PRESSURE + - UE_SPEED + - UE_ORIENTATION + - type: string + ReportingTrigger: + anyOf: + - type: string + enum: + - PERIODICAL + - EVENT_A2 + - EVENT_A2_PERIODIC + - ALL_RRM_EVENT_TRIGGERS + - type: string + ReportIntervalMdt: + anyOf: + - type: string + enum: + - 120 + - 240 + - 480 + - 640 + - 1024 + - 2048 + - 5120 + - 10240 + - 60000 + - 360000 + - 720000 + - 1800000 + - 3600000 + - type: string + ReportAmountMdt: + anyOf: + - type: string + enum: + - 1 + - 2 + - 4 + - 8 + - 16 + - 32 + - 64 + - infinity + - type: string + EventForMdt: + anyOf: + - type: string + enum: + - OUT_OF_COVERAG + - A2_EVENT + - type: string + LoggingIntervalMdt: + anyOf: + - type: string + enum: + - 128 + - 256 + - 512 + - 1024 + - 2048 + - 3072 + - 4096 + - 6144 + - type: string + LoggingDurationMdt: + anyOf: + - type: string + enum: + - 600 + - 1200 + - 2400 + - 3600 + - 5400 + - 7200 + - type: string + PositioningMethodMdt: + anyOf: + - type: string + enum: + - GNSS + - E_CELL_ID + - type: string + CollectionPeriodRmmLteMdt: + anyOf: + - type: string + enum: + - 1024 + - 1280 + - 2048 + - 2560 + - 5120 + - 10240 + - 60000 + - type: string + MeasurementPeriodLteMdt: + anyOf: + - type: string + enum: + - 1024 + - 1280 + - 2048 + - 2560 + - 5120 + - 10240 + - 60000 + - type: string + + ReportIntervalNrMdt: + anyOf: + - type: string + enum: + - 120 + - 240 + - 480 + - 640 + - 1024 + - 2048 + - 5120 + - 10240 + - 20480 + - 40960 + - 60000 + - 360000 + - 720000 + - 1800000 + - 3600000 + - type: string + + LoggingIntervalNrMdt: + anyOf: + - type: string + enum: + - 128 + - 256 + - 512 + - 1024 + - 2048 + - 3072 + - 4096 + - 6144 + - 320 + - 640 + - infinity + - type: string + + CollectionPeriodRmmNrMdt: + anyOf: + - type: string + enum: + - 1024 + - 2048 + - 5120 + - 10240 + - 60000 + - type: string + + LoggingDurationNrMdt: + anyOf: + - type: string + enum: + - 600 + - 1200 + - 2400 + - 3600 + - 5400 + - 7200 + - type: string # # STRUCTURED DATA TYPES # @@ -2143,6 +2375,154 @@ components: - traceDepth - neTypeList - eventList + MdtConfiguration: + type: object + required: + - jobType + properties: + jobType: + $ref: '#/components/schemas/JobType' + reportType: + $ref: '#/components/schemas/ReportTypeMdt' + areaScope: + $ref: '#/components/schemas/AreaScope' + measurementLteList: + type: array + items: + $ref: '#/components/schemas/MeasurementLteForMdt' + measurementNrList: + type: array + items: + $ref: '#/components/schemas/MeasurementNrForMdt' + minItems: 1 + sensorMeasurementList: + type: array + items: + $ref: '#/components/schemas/SensorMeasurement' + minItems: 1 + reportingTriggerList: + type: array + items: + $ref: '#/components/schemas/ReportingTrigger' + minItems: 1 + reportInterval: + $ref: '#/components/schemas/ReportIntervalMdt' + reportIntervalNr: + $ref: '#/components/schemas/ReportIntervalNrMdt' + reportAmount: + $ref: '#/components/schemas/ReportAmountMdt' + eventThresholdRsrp: + type: integer + minimum: 0 + maximum: 97 + eventThresholdRsrpNr: + type: integer + minimum: 0 + maximum: 127 + eventThresholdRsrq: + type: integer + minimum: 0 + maximum: 34 + eventThresholdRsrqNr: + type: integer + minimum: 0 + maximum: 127 + eventList: + type: array + items: + $ref: '#/components/schemas/EventForMdt' + minItems: 1 + loggingInterval: + $ref: '#/components/schemas/LoggingIntervalMdt' + loggingIntervalNr: + $ref: '#/components/schemas/LoggingIntervalNrMdt' + loggingDuration: + $ref: '#/components/schemas/LoggingDurationMdt' + loggingDurationNr: + $ref: '#/components/schemas/LoggingDurationNrMdt' + positioningMethod: + $ref: '#/components/schemas/PositioningMethodMdt' + collectionPeriodRmmLte: + $ref: '#/components/schemas/CollectionPeriodRmmLteMdt' + collectionPeriodRmmNr: + $ref: '#/components/schemas/CollectionPeriodRmmNrMdt' + measurementPeriodLte: + $ref: '#/components/schemas/MeasurementPeriodLteMdt' + mdtAllowedPlmnIdList: + type: array + items: + $ref: '#/components/schemas/PlmnId' + minItems: 1 + maxItems: 16 + mbsfnAreaList: + type: array + items: + $ref: '#/components/schemas/MbsfnArea' + minItems: 1 + maxItems: 8 + interFreqTargetList: + type: array + items: + $ref: '#/components/schemas/InterFreqTargetInfo' + minItems: 1 + maxItems: 8 + AreaScope: + type: object + properties: + eutraCellIdList: + type: array + items: + $ref: '#/components/schemas/EutraCellId' + minItems: 1 + nrCellIdList: + type: array + items: + $ref: '#/components/schemas/NrCellId' + minItems: 1 + tacList: + type: array + items: + $ref: '#/components/schemas/Tac' + minItems: 1 + tacInfoPerPlmn: + type: object + additionalProperties: + $ref: '#/components/schemas/TacInfo' + TacInfo: + type: object + required: + - tacList + properties: + tacList: + type: array + items: + $ref: '#/components/schemas/Tac' + minItems: 1 + MbsfnArea: + type: object + properties: + mbsfnAreaId: + type: integer + minimum: 0 + maximum: 255 + carrierFrequency: + type: integer + minimum: 0 + maximum: 262143 + + InterFreqTargetInfo: + required: + - dlCarrierFreq + type: object + properties: + dlCarrierFreq: + $ref: '#/components/schemas/ArfcnValueNR' + cellIdList: + type: array + items: + $ref: '#/components/schemas/PhysCellId' + minItems: 1 + maxItems: 32 # Data Types related to 5G ODB as defined in clause 5.7 diff --git a/meson.build b/meson.build index 945aa073f..cb257163c 100644 --- a/meson.build +++ b/meson.build @@ -16,7 +16,7 @@ # along with this program. If not, see . project('open5gs', 'c', - version : '2.1.7', + version : '2.2.0', license : 'AGPL-3.0-or-later', meson_version : '>= 0.43.0', default_options : [ @@ -24,7 +24,7 @@ project('open5gs', 'c', ], ) -libogslib_version = '2.1.7' +libogslib_version = '2.2.0' prefix = get_option('prefix') bindir = join_paths(prefix, get_option('bindir')) diff --git a/src/amf/amf-sm.c b/src/amf/amf-sm.c index cabeb0404..f4b572118 100644 --- a/src/amf/amf-sm.c +++ b/src/amf/amf-sm.c @@ -24,6 +24,7 @@ #include "nnrf-handler.h" #include "namf-handler.h" #include "nsmf-handler.h" +#include "nnssf-handler.h" #include "nas-security.h" void amf_state_initial(ogs_fsm_t *s, amf_event_t *e) @@ -253,6 +254,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) SWITCH(sbi_message.h.service.name) CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM) + CASE(OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION) api_version = OGS_SBI_API_V2; break; DEFAULT @@ -465,6 +467,33 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e) END break; + CASE(OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION) + sbi_xact = e->sbi.data; + ogs_assert(sbi_xact); + + sess = (amf_sess_t *)sbi_xact->sbi_object; + ogs_assert(sess); + sess = amf_sess_cycle(sess); + ogs_assert(sess); + + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + amf_ue = amf_ue_cycle(amf_ue); + ogs_assert(amf_ue); + + ogs_assert(OGS_FSM_STATE(&amf_ue->sm)); + + e->amf_ue = amf_ue; + e->sess = sess; + e->sbi.message = &sbi_message;; + + state = sbi_xact->state; + + ogs_sbi_xact_remove(sbi_xact); + + amf_nnssf_nsselection_handle_get(sess, &sbi_message); + break; + DEFAULT ogs_error("Invalid service name [%s]", sbi_message.h.service.name); ogs_assert_if_reached(); diff --git a/src/amf/context.c b/src/amf/context.c index 9ee19fadc..e6cc3d522 100644 --- a/src/amf/context.c +++ b/src/amf/context.c @@ -253,7 +253,7 @@ int amf_context_parse_config(void) 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 ( @@ -315,7 +315,7 @@ int amf_context_parse_config(void) const char *mcc = NULL, *mnc = NULL; const char *region = NULL, *set = NULL; const char *pointer = NULL; - ogs_assert(self.num_of_served_guami <= + ogs_assert(self.num_of_served_guami < MAX_NUM_OF_SERVED_GUAMI); if (ogs_yaml_iter_type(&guami_array) == @@ -410,7 +410,7 @@ int amf_context_parse_config(void) ogs_5gs_tai0_list_t *list0 = NULL; ogs_5gs_tai2_list_t *list2 = NULL; - ogs_assert(self.num_of_served_tai <= + ogs_assert(self.num_of_served_tai < OGS_MAX_NUM_OF_SERVED_TAI); list0 = &self.served_tai[self.num_of_served_tai].list0; ogs_assert(list0); @@ -468,7 +468,7 @@ int amf_context_parse_config(void) 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) { @@ -530,7 +530,7 @@ int amf_context_parse_config(void) ogs_yaml_iter_recurse(&amf_iter, &plmn_support_array); do { const char *mnc = NULL, *mcc = NULL; - ogs_assert(self.num_of_plmn_support <= + ogs_assert(self.num_of_plmn_support < OGS_MAX_NUM_OF_PLMN); if (ogs_yaml_iter_type(&plmn_support_array) == @@ -588,8 +588,8 @@ int amf_context_parse_config(void) ogs_assert( self.plmn_support[ self.num_of_plmn_support]. - num_of_s_nssai <= - OGS_MAX_NUM_OF_S_NSSAI); + num_of_s_nssai < + OGS_MAX_NUM_OF_SLICE); s_nssai = &self.plmn_support[ self.num_of_plmn_support].s_nssai[ self.plmn_support[ @@ -639,10 +639,6 @@ int amf_context_parse_config(void) s_nssai->sd.v = OGS_S_NSSAI_NO_SD_VALUE; - s_nssai->mapped_hplmn_sst = 0; - s_nssai->mapped_hplmn_sd.v = - OGS_S_NSSAI_NO_SD_VALUE; - self.plmn_support[ self.num_of_plmn_support]. num_of_s_nssai++; @@ -872,7 +868,7 @@ amf_gnb_t *amf_gnb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr) return gnb; } -int amf_gnb_remove(amf_gnb_t *gnb) +void amf_gnb_remove(amf_gnb_t *gnb) { amf_event_t e; @@ -896,18 +892,14 @@ int amf_gnb_remove(amf_gnb_t *gnb) ogs_info("[Removed] Number of gNBs is now %d", ogs_list_count(&self.gnb_list)); - - return OGS_OK; } -int amf_gnb_remove_all() +void amf_gnb_remove_all() { amf_gnb_t *gnb = NULL, *next_gnb = NULL; ogs_list_for_each_safe(&self.gnb_list, next_gnb, gnb) amf_gnb_remove(gnb); - - return OGS_OK; } amf_gnb_t *amf_gnb_find_by_addr(ogs_sockaddr_t *addr) @@ -1169,10 +1161,8 @@ void amf_ue_remove(amf_ue_t *amf_ue) ogs_free(amf_ue->msisdn[i]); } - for (i = 0; i < amf_ue->num_of_subscribed_dnn; i++) { - ogs_assert(amf_ue->subscribed_dnn[i]); - ogs_free(amf_ue->subscribed_dnn[i]); - } + /* Clear SubscribedInfo */ + amf_clear_subscribed_info(amf_ue); if (amf_ue->policy_association_id) ogs_free(amf_ue->policy_association_id); @@ -1497,8 +1487,8 @@ amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t psi) sess->s_nssai.sst = 0; sess->s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE; - sess->s_nssai.mapped_hplmn_sst = 0; - sess->s_nssai.mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE; + sess->mapped_hplmn.sst = 0; + sess->mapped_hplmn.sd.v = OGS_S_NSSAI_NO_SD_VALUE; ogs_list_add(&amf_ue->sess_list, sess); @@ -1536,6 +1526,13 @@ void amf_sess_remove(amf_sess_t *sess) if (sess->paging.client) ogs_sbi_client_remove(sess->paging.client); + if (sess->nssf.nsi_id) + ogs_free(sess->nssf.nsi_id); + if (sess->nssf.nrf.id) + ogs_free(sess->nssf.nrf.id); + if (sess->nssf.nrf.client) + ogs_sbi_client_remove(sess->nssf.nrf.client); + OGS_NAS_CLEAR_DATA(&sess->ue_pco); OGS_TLV_CLEAR_DATA(&sess->pgw_pco); @@ -1574,6 +1571,48 @@ amf_sess_t *amf_sess_cycle(amf_sess_t *sess) return ogs_pool_cycle(&amf_sess_pool, sess); } +void amf_ue_select_nf(amf_ue_t *amf_ue, OpenAPI_nf_type_e nf_type) +{ + ogs_assert(amf_ue); + ogs_assert(nf_type); + + if (nf_type == OpenAPI_nf_type_NRF) + ogs_sbi_select_nrf(&amf_ue->sbi, amf_nf_state_registered); + else + ogs_sbi_select_first_nf(&amf_ue->sbi, nf_type, amf_nf_state_registered); +} + +void amf_sess_select_nf(amf_sess_t *sess, OpenAPI_nf_type_e nf_type) +{ + ogs_assert(sess); + ogs_assert(nf_type); + + if (nf_type == OpenAPI_nf_type_NRF) + ogs_sbi_select_nrf(&sess->sbi, amf_nf_state_registered); + else if (nf_type == OpenAPI_nf_type_SMF) + amf_sess_select_smf(sess); + else + ogs_sbi_select_first_nf(&sess->sbi, nf_type, amf_nf_state_registered); +} + +static bool check_smf_info(amf_sess_t *sess, ogs_list_t *nf_info_list); + +void amf_sess_select_smf(amf_sess_t *sess) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(sess); + + ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) { + if (OGS_FSM_CHECK(&nf_instance->sm, amf_nf_state_registered) && + nf_instance->nf_type == OpenAPI_nf_type_SMF && + check_smf_info(sess, &nf_instance->nf_info_list) == true) { + OGS_SBI_SETUP_NF(&sess->sbi, OpenAPI_nf_type_SMF, nf_instance); + break; + } + } +} + int amf_sess_xact_count(amf_ue_t *amf_ue) { amf_sess_t *sess = NULL; @@ -1617,11 +1656,11 @@ bool amf_pdu_res_setup_req_transfer_needed(amf_ue_t *amf_ue) return false; } -int amf_find_served_tai(ogs_5gs_tai_t *tai) +int amf_find_served_tai(ogs_5gs_tai_t *nr_tai) { int i = 0, j = 0, k = 0; - ogs_assert(tai); + ogs_assert(nr_tai); for (i = 0; i < self.num_of_served_tai; i++) { ogs_5gs_tai0_list_t *list0 = &self.served_tai[i].list0; @@ -1635,8 +1674,8 @@ int amf_find_served_tai(ogs_5gs_tai_t *tai) for (k = 0; k < list0->tai[j].num; k++) { if (memcmp(&list0->tai[j].plmn_id, - &tai->plmn_id, OGS_PLMN_ID_LEN) == 0 && - list0->tai[j].tac[k].v == tai->tac.v) { + &nr_tai->plmn_id, OGS_PLMN_ID_LEN) == 0 && + list0->tai[j].tac[k].v == nr_tai->tac.v) { return i; } } @@ -1649,8 +1688,8 @@ int amf_find_served_tai(ogs_5gs_tai_t *tai) for (j = 0; j < list2->num; j++) { if (memcmp(&list2->tai[j].plmn_id, - &tai->plmn_id, OGS_PLMN_ID_LEN) == 0 && - list2->tai[j].tac.v == tai->tac.v) { + &nr_tai->plmn_id, OGS_PLMN_ID_LEN) == 0 && + list2->tai[j].tac.v == nr_tai->tac.v) { return i; } } @@ -1674,18 +1713,11 @@ ogs_s_nssai_t *amf_find_s_nssai( continue; for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { - if (amf_self()->plmn_support[i].s_nssai[j].sst != s_nssai->sst) - continue; - - if (amf_self()->plmn_support[i].s_nssai[j].sd.v != - OGS_S_NSSAI_NO_SD_VALUE && - s_nssai->sd.v != OGS_S_NSSAI_NO_SD_VALUE) { - if (amf_self()->plmn_support[i].s_nssai[j].sd.v != - s_nssai->sd.v) - continue; + /* Compare S-NSSAI */ + if (amf_self()->plmn_support[i].s_nssai[j].sst == s_nssai->sst && + amf_self()->plmn_support[i].s_nssai[j].sd.v == s_nssai->sd.v) { + return &amf_self()->plmn_support[i].s_nssai[j]; } - - return &amf_self()->plmn_support[i].s_nssai[j]; } } @@ -1780,6 +1812,22 @@ uint8_t amf_selected_enc_algorithm(amf_ue_t *amf_ue) return 0; } +void amf_clear_subscribed_info(amf_ue_t *amf_ue) +{ + int i, j; + + ogs_assert(amf_ue); + + for (i = 0; i < amf_ue->num_of_slice; i++) { + for (j = 0; j < amf_ue->slice[i].num_of_session; j++) { + ogs_assert(amf_ue->slice[i].session[j].name); + ogs_free(amf_ue->slice[i].session[j].name); + } + amf_ue->slice[i].num_of_session = 0; + } + amf_ue->num_of_slice = 0; +} + static void stats_add_ran_ue(void) { num_of_ran_ue = num_of_ran_ue + 1; @@ -1803,3 +1851,93 @@ static void stats_remove_amf_session(void) num_of_amf_sess = num_of_amf_sess - 1; ogs_info("[Removed] Number of AMF-Sessions is now %d", num_of_amf_sess); } + +static bool check_smf_info_s_nssai( + amf_sess_t *sess, ogs_sbi_smf_info_t *smf_info); +static bool check_smf_info_nr_tai( + amf_sess_t *sess, ogs_sbi_smf_info_t *smf_info); + +static bool check_smf_info(amf_sess_t *sess, ogs_list_t *nf_info_list) +{ + ogs_sbi_nf_info_t *nf_info = NULL; + + ogs_assert(sess); + ogs_assert(nf_info_list); + + if (ogs_list_count(nf_info_list) == 0) { + return true; + } + + ogs_list_for_each(nf_info_list, nf_info) { + ogs_sbi_smf_info_t *smf_info = &nf_info->smf; + ogs_assert(smf_info); + + if (check_smf_info_s_nssai(sess, smf_info) == true && + check_smf_info_nr_tai(sess, smf_info) == true) + return true; + } + + return false; +} + +static bool check_smf_info_s_nssai( + amf_sess_t *sess, ogs_sbi_smf_info_t *smf_info) +{ + int i, j; + + ogs_assert(sess); + ogs_assert(sess->dnn); + ogs_assert(smf_info); + + for (i = 0; i < smf_info->num_of_slice; i++) { + if (sess->s_nssai.sst == smf_info->slice[i].s_nssai.sst && + sess->s_nssai.sd.v == smf_info->slice[i].s_nssai.sd.v) { + + for (j = 0; j < smf_info->slice[i].num_of_dnn; j++) { + if (strcmp(sess->dnn, smf_info->slice[i].dnn[j]) == 0) + return true; + } + } + } + + return false; +} + +static bool check_smf_info_nr_tai( + amf_sess_t *sess, ogs_sbi_smf_info_t *smf_info) +{ + amf_ue_t *amf_ue = NULL; + int i, j; + + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + ogs_assert(smf_info); + + if (smf_info->num_of_nr_tai == 0 && smf_info->num_of_nr_tai_range == 0) + return true; + + for (i = 0; i < smf_info->num_of_nr_tai; i++) { + if (memcmp(&amf_ue->nr_tai.plmn_id, + &smf_info->nr_tai[i].plmn_id, OGS_PLMN_ID_LEN) == 0) { + if (amf_ue->nr_tai.tac.v == smf_info->nr_tai[i].tac.v) + return true; + } + } + + for (i = 0; i < smf_info->num_of_nr_tai_range; i++) { + if (memcmp(&amf_ue->nr_tai.plmn_id, + &smf_info->nr_tai_range[i].plmn_id, OGS_PLMN_ID_LEN) == 0) { + for (j = 0; j < smf_info->nr_tai_range[i].num_of_tac_range; j++) { + if (amf_ue->nr_tai.tac.v >= + smf_info->nr_tai_range[i].start[j].v && + amf_ue->nr_tai.tac.v <= + smf_info->nr_tai_range[i].end[j].v) { + return true; + } + } + } + } + + return false; +} diff --git a/src/amf/context.h b/src/amf/context.h index 53f7635f4..dcb601921 100644 --- a/src/amf/context.h +++ b/src/amf/context.h @@ -65,7 +65,7 @@ typedef struct amf_context_s { struct { ogs_plmn_id_t plmn_id; int num_of_s_nssai; - ogs_s_nssai_t s_nssai[OGS_MAX_NUM_OF_S_NSSAI]; + ogs_s_nssai_t s_nssai[OGS_MAX_NUM_OF_SLICE]; } plmn_support[OGS_MAX_NUM_OF_PLMN]; /* defined in 'nas_ies.h' @@ -136,7 +136,7 @@ typedef struct amf_gnb_s { struct { ogs_plmn_id_t plmn_id; uint8_t num_of_s_nssai; - ogs_s_nssai_t s_nssai[OGS_MAX_NUM_OF_S_NSSAI]; + ogs_s_nssai_t s_nssai[OGS_MAX_NUM_OF_SLICE]; } bplmn_list[OGS_MAX_NUM_OF_BPLMN]; } supported_ta_list[OGS_MAX_NUM_OF_TAI]; @@ -167,12 +167,12 @@ struct ran_ue_s { ran_ue_t *source_ue; ran_ue_t *target_ue; - /* Use amf_ue->tai, amf_ue->nr_cgi. + /* Use amf_ue->nr_tai, amf_ue->nr_cgi. * Do not access ran_ue->saved.tai ran_ue->saved.nr_cgi. * - * Save TAI and ECGI. And then, this will copy 'amf_ue_t' context later */ + * Save TAI and CGI. And then, this will copy 'amf_ue_t' context later */ struct { - ogs_5gs_tai_t tai; + ogs_5gs_tai_t nr_tai; ogs_nr_cgi_t nr_cgi; } saved; @@ -268,14 +268,23 @@ struct amf_ue_s { /* UE Info */ ogs_guami_t *guami; uint16_t gnb_ostream_id; - ogs_5gs_tai_t tai; + ogs_5gs_tai_t nr_tai; ogs_nr_cgi_t nr_cgi; ogs_time_t ue_location_timestamp; ogs_plmn_id_t last_visited_plmn_id; ogs_nas_ue_usage_setting_t ue_usage_setting; - int num_of_requested_nssai; - ogs_s_nssai_t requested_nssai[OGS_MAX_NUM_OF_S_NSSAI]; + struct { + int num_of_s_nssai; + ogs_nas_s_nssai_ie_t s_nssai[OGS_MAX_NUM_OF_SLICE]; + } requested_nssai, allowed_nssai; + + bool allowed_nssai_present; + + struct { + int num_of_s_nssai; + ogs_nas_rejected_s_nssai_t s_nssai[OGS_MAX_NUM_OF_SLICE]; + } rejected_nssai; /* PCF sends the RESPONSE * of [POST] /npcf-am-polocy-control/v1/policies */ @@ -351,9 +360,10 @@ struct amf_ue_s { * #define OGS_NAS_SECURITY_ALGORITHMS_128_NIA3 3 */ uint8_t selected_int_algorithm; - ogs_bitrate_t ue_ambr; /* UE-AMBR */ - int num_of_subscribed_dnn; - char *subscribed_dnn[OGS_MAX_NUM_OF_DNN]; + /* SubscribedInfo */ + ogs_bitrate_t ue_ambr; + int num_of_slice; + ogs_slice_data_t slice[OGS_MAX_NUM_OF_SLICE]; uint64_t am_policy_control_features; /* SBI Features */ @@ -535,6 +545,14 @@ typedef struct amf_sess_s { } \ } while(0); + struct { + char *nsi_id; + struct { + char *id; + ogs_sbi_client_t *client; + } nrf; + } nssf; + /* last payload for sending back to the UE */ uint8_t payload_container_type; ogs_pkbuf_t *payload_container; @@ -545,8 +563,9 @@ typedef struct amf_sess_s { /* Related Context */ amf_ue_t *amf_ue; - ogs_s_nssai_t s_nssai; - char *dnn; + ogs_s_nssai_t s_nssai; + ogs_s_nssai_t mapped_hplmn; + char *dnn; /* Save Protocol Configuration Options from UE */ struct { @@ -566,8 +585,8 @@ amf_context_t *amf_self(void); int amf_context_parse_config(void); amf_gnb_t *amf_gnb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr); -int amf_gnb_remove(amf_gnb_t *gnb); -int amf_gnb_remove_all(void); +void amf_gnb_remove(amf_gnb_t *gnb); +void amf_gnb_remove_all(void); amf_gnb_t *amf_gnb_find_by_addr(ogs_sockaddr_t *addr); amf_gnb_t *amf_gnb_find_by_gnb_id(uint32_t gnb_id); int amf_gnb_set_gnb_id(amf_gnb_t *gnb, uint32_t gnb_id); @@ -664,6 +683,11 @@ amf_sess_t *amf_sess_find_by_dnn(amf_ue_t *amf_ue, char *dnn); amf_ue_t *amf_ue_cycle(amf_ue_t *amf_ue); amf_sess_t *amf_sess_cycle(amf_sess_t *sess); +void amf_ue_select_nf(amf_ue_t *amf_ue, OpenAPI_nf_type_e nf_type); +void amf_sess_select_nf(amf_sess_t *sess, OpenAPI_nf_type_e nf_type); + +void amf_sess_select_smf(amf_sess_t *sess); + #define SESSION_SYNC_DONE(__aMF, __sTATE) \ (amf_sess_xact_state_count(__aMF, __sTATE) == 0) int amf_sess_xact_count(amf_ue_t *amf_ue); @@ -673,7 +697,7 @@ int amf_sess_xact_state_count(amf_ue_t *amf_ue, int state); (amf_pdu_res_setup_req_transfer_needed(__aMF) == true) bool amf_pdu_res_setup_req_transfer_needed(amf_ue_t *amf_ue); -int amf_find_served_tai(ogs_5gs_tai_t *tai); +int amf_find_served_tai(ogs_5gs_tai_t *nr_tai); ogs_s_nssai_t *amf_find_s_nssai( ogs_plmn_id_t *served_plmn_id, ogs_s_nssai_t *s_nssai); @@ -684,6 +708,8 @@ int amf_m_tmsi_free(amf_m_tmsi_t *tmsi); uint8_t amf_selected_int_algorithm(amf_ue_t *amf_ue); uint8_t amf_selected_enc_algorithm(amf_ue_t *amf_ue); +void amf_clear_subscribed_info(amf_ue_t *amf_ue); + #ifdef __cplusplus } #endif diff --git a/src/amf/event.c b/src/amf/event.c index b0f78eb68..8a53d70ee 100644 --- a/src/amf/event.c +++ b/src/amf/event.c @@ -20,7 +20,6 @@ #include "event.h" #include "context.h" -#define EVENT_POOL 32 /* FIXME : 32 */ static OGS_POOL(pool, amf_event_t); void amf_event_init(void) diff --git a/src/amf/gmm-build.c b/src/amf/gmm-build.c index 444ae425b..cccf45f0d 100644 --- a/src/amf/gmm-build.c +++ b/src/amf/gmm-build.c @@ -29,7 +29,6 @@ static uint16_t get_pdu_session_reactivation_result(amf_ue_t *amf_ue); ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue) { - int i; int served_tai_index = 0; ogs_pkbuf_t *pkbuf = NULL; @@ -42,6 +41,8 @@ ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue) ®istration_accept->guti; ogs_nas_5gs_mobile_identity_guti_t mobile_identity_guti; ogs_nas_nssai_t *allowed_nssai = ®istration_accept->allowed_nssai; + ogs_nas_rejected_nssai_t *rejected_nssai = + ®istration_accept->rejected_nssai; ogs_nas_5gs_network_feature_support_t *network_feature_support = ®istration_accept->network_feature_support; ogs_nas_pdu_session_status_t *pdu_session_status = @@ -87,12 +88,12 @@ ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue) registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_TAI_LIST_PRESENT; ogs_debug("[%s] TAI[PLMN_ID:%06x,TAC:%d]", amf_ue->supi, - ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v); + ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), amf_ue->nr_tai.tac.v); ogs_debug("[%s] NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]", amf_ue->supi, ogs_plmn_id_hexdump(&amf_ue->nr_cgi.plmn_id), (long long)amf_ue->nr_cgi.cell_id); - served_tai_index = amf_find_served_tai(&amf_ue->tai); + served_tai_index = amf_find_served_tai(&amf_ue->nr_tai); ogs_debug("[%s] SERVED_TAI_INDEX[%d]", amf_ue->supi, served_tai_index); ogs_assert(served_tai_index >= 0 && served_tai_index < OGS_MAX_NUM_OF_SERVED_TAI); @@ -102,23 +103,25 @@ ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue) &amf_self()->served_tai[served_tai_index].list2); /* Set Allowed NSSAI */ - allowed_nssai->length = 0; - - for (i = 0; i < amf_self()->num_of_plmn_support; i++) { - if (memcmp(&amf_ue->tai.plmn_id, - &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) - continue; - - ogs_debug("[%s] NSSAI[PLMN_ID:%06x]", amf_ue->supi, - ogs_plmn_id_hexdump(&amf_self()->plmn_support[i].plmn_id)); + if (amf_ue->allowed_nssai_present == true) { + ogs_assert(amf_ue->allowed_nssai.num_of_s_nssai); ogs_nas_build_nssai(allowed_nssai, - amf_self()->plmn_support[i].s_nssai, - amf_self()->plmn_support[i].num_of_s_nssai); - } + amf_ue->allowed_nssai.s_nssai, + amf_ue->allowed_nssai.num_of_s_nssai); - if (allowed_nssai->length) { - registration_accept->presencemask |= OGS_NAS_5GS_REGISTRATION_ACCEPT_ALLOWED_NSSAI_PRESENT; + registration_accept->presencemask |= + OGS_NAS_5GS_REGISTRATION_ACCEPT_ALLOWED_NSSAI_PRESENT; + + if (amf_ue->rejected_nssai.num_of_s_nssai) { + ogs_nas_build_rejected_nssai(rejected_nssai, + amf_ue->rejected_nssai.s_nssai, + amf_ue->rejected_nssai.num_of_s_nssai); + registration_accept->presencemask |= + OGS_NAS_5GS_REGISTRATION_ACCEPT_REJECTED_NSSAI_PRESENT; + } + + amf_ue->allowed_nssai_present = false; } /* 5GS network feature support */ @@ -649,12 +652,12 @@ ogs_pkbuf_t *gmm_build_tau_accept(amf_ue_t *amf_ue) OGS_NAS_5GS_TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT; ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), - amf_ue->tai.tac); + ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), + amf_ue->nr_tai.tac); ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]", ogs_plmn_id_hexdump(&amf_ue->e_cgi.plmn_id), amf_ue->e_cgi.cell_id); - served_tai_index = amf_find_served_tai(&amf_ue->tai); + served_tai_index = amf_find_served_tai(&amf_ue->nr_tai); ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); ogs_assert(served_tai_index >= 0 && served_tai_index < OGS_MAX_NUM_OF_SERVED_TAI); diff --git a/src/amf/gmm-handler.c b/src/amf/gmm-handler.c index 953919780..e86a9c8d3 100644 --- a/src/amf/gmm-handler.c +++ b/src/amf/gmm-handler.c @@ -118,29 +118,29 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, } ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v); + ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), amf_ue->nr_tai.tac.v); ogs_debug(" OLD NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]", ogs_plmn_id_hexdump(&amf_ue->nr_cgi.plmn_id), (long long)amf_ue->nr_cgi.cell_id); ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&ran_ue->saved.tai.plmn_id), - ran_ue->saved.tai.tac.v); + ogs_plmn_id_hexdump(&ran_ue->saved.nr_tai.plmn_id), + ran_ue->saved.nr_tai.tac.v); ogs_debug(" NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]", ogs_plmn_id_hexdump(&ran_ue->saved.nr_cgi.plmn_id), (long long)ran_ue->saved.nr_cgi.cell_id); /* Copy Stream-No/NR-TAI/NR-CGI from ran_ue */ amf_ue->gnb_ostream_id = ran_ue->gnb_ostream_id; - memcpy(&amf_ue->tai, &ran_ue->saved.tai, sizeof(ogs_5gs_tai_t)); + memcpy(&amf_ue->nr_tai, &ran_ue->saved.nr_tai, sizeof(ogs_5gs_tai_t)); memcpy(&amf_ue->nr_cgi, &ran_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t)); amf_ue->ue_location_timestamp = ogs_time_now(); /* Check TAI */ - served_tai_index = amf_find_served_tai(&amf_ue->tai); + served_tai_index = amf_find_served_tai(&amf_ue->nr_tai); if (served_tai_index < 0) { /* Send Registration Reject */ ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v); + ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), amf_ue->nr_tai.tac.v); nas_5gs_send_registration_reject(amf_ue, OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED); return OGS_ERROR; @@ -226,24 +226,27 @@ int gmm_handle_registration_update(amf_ue_t *amf_ue, if (registration_request->presencemask & OGS_NAS_5GS_REGISTRATION_REQUEST_REQUESTED_NSSAI_PRESENT) { - amf_ue->num_of_requested_nssai = ogs_nas_parse_nssai( - amf_ue->requested_nssai, ®istration_request->requested_nssai); + amf_ue->requested_nssai.num_of_s_nssai = + ogs_nas_parse_nssai( + amf_ue->requested_nssai.s_nssai, + ®istration_request->requested_nssai); - for (i = 0; i < amf_ue->num_of_requested_nssai; i++) { + for (i = 0; i < amf_ue->requested_nssai.num_of_s_nssai; i++) { if (amf_find_s_nssai( - &amf_ue->tai.plmn_id, &amf_ue->requested_nssai[i])) + &amf_ue->nr_tai.plmn_id, + (ogs_s_nssai_t *)&amf_ue->requested_nssai.s_nssai[i])) break; } - if (i == amf_ue->num_of_requested_nssai) { + if (i == amf_ue->requested_nssai.num_of_s_nssai) { ogs_error("CHECK CONFIGURATION: Cannot find Requested NSSAI"); - for (i = 0; i < amf_ue->num_of_requested_nssai; i++) { + for (i = 0; i < amf_ue->requested_nssai.num_of_s_nssai; i++) { ogs_error(" PLMN_ID[MCC:%d MNC:%d]", - ogs_plmn_id_mcc(&amf_ue->tai.plmn_id), - ogs_plmn_id_mnc(&amf_ue->tai.plmn_id)); + ogs_plmn_id_mcc(&amf_ue->nr_tai.plmn_id), + ogs_plmn_id_mnc(&amf_ue->nr_tai.plmn_id)); ogs_error(" S_NSSAI[SST:%d SD:0x%x]", - amf_ue->requested_nssai[i].sst, - amf_ue->requested_nssai[i].sd.v); + amf_ue->requested_nssai.s_nssai[i].sst, + amf_ue->requested_nssai.s_nssai[i].sd.v); } return OGS_ERROR; } @@ -354,29 +357,29 @@ int gmm_handle_service_request(amf_ue_t *amf_ue, } ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v); + ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), amf_ue->nr_tai.tac.v); ogs_debug(" OLD NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]", ogs_plmn_id_hexdump(&amf_ue->nr_cgi.plmn_id), (long long)amf_ue->nr_cgi.cell_id); ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&ran_ue->saved.tai.plmn_id), - ran_ue->saved.tai.tac.v); + ogs_plmn_id_hexdump(&ran_ue->saved.nr_tai.plmn_id), + ran_ue->saved.nr_tai.tac.v); ogs_debug(" NR_CGI[PLMN_ID:%06x,CELL_ID:0x%llx]", ogs_plmn_id_hexdump(&ran_ue->saved.nr_cgi.plmn_id), (long long)ran_ue->saved.nr_cgi.cell_id); /* Copy Stream-No/NR-TAI/NR-CGI from ran_ue */ amf_ue->gnb_ostream_id = ran_ue->gnb_ostream_id; - memcpy(&amf_ue->tai, &ran_ue->saved.tai, sizeof(ogs_5gs_tai_t)); + memcpy(&amf_ue->nr_tai, &ran_ue->saved.nr_tai, sizeof(ogs_5gs_tai_t)); memcpy(&amf_ue->nr_cgi, &ran_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t)); amf_ue->ue_location_timestamp = ogs_time_now(); /* Check TAI */ - served_tai_index = amf_find_served_tai(&amf_ue->tai); + served_tai_index = amf_find_served_tai(&amf_ue->nr_tai); if (served_tai_index < 0) { /* Send Registration Reject */ ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", - ogs_plmn_id_hexdump(&amf_ue->tai.plmn_id), amf_ue->tai.tac.v); + ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), amf_ue->nr_tai.tac.v); nas_5gs_send_registration_reject(amf_ue, OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED); return OGS_ERROR; @@ -668,6 +671,7 @@ int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, ogs_nas_5gs_ul_nas_transport_t *ul_nas_transport) { + ogs_slice_data_t *selected_slice = NULL; amf_sess_t *sess = NULL; amf_nsmf_pdusession_update_sm_context_param_t param; @@ -675,7 +679,6 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, ogs_nas_payload_container_t *payload_container = NULL; ogs_nas_pdu_session_identity_2_t *pdu_session_id = NULL; ogs_nas_s_nssai_t *nas_s_nssai = NULL; - ogs_s_nssai_t *selected_s_nssai = NULL; ogs_nas_dnn_t *dnn = NULL; ogs_nas_5gsm_header_t *gsm_header = NULL; @@ -768,26 +771,24 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, if (ul_nas_transport->presencemask & OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT) { - ogs_s_nssai_t s_nssai; - if (ogs_nas_parse_s_nssai(&s_nssai, nas_s_nssai) != 0) { - selected_s_nssai = - amf_find_s_nssai(&amf_ue->tai.plmn_id, &s_nssai); + ogs_nas_s_nssai_ie_t ie; + if (ogs_nas_parse_s_nssai(&ie, nas_s_nssai) != 0) { + selected_slice = ogs_slice_find_by_s_nssai( + amf_ue->slice, amf_ue->num_of_slice, + (ogs_s_nssai_t *)&ie); } } - if (!selected_s_nssai) { - if (amf_ue->num_of_requested_nssai) { - selected_s_nssai = &amf_ue->requested_nssai[0]; - } + if (!selected_slice) { + ogs_error("[%s] No S-NSSAI", amf_ue->supi); + nas_5gs_send_gmm_status(amf_ue, + OGS_5GMM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE); + return OGS_ERROR; } - if (!selected_s_nssai) { - ogs_warn("No S_NSSAI : Set default S_NSSAI using AMF config"); - selected_s_nssai = &amf_self()->plmn_support[0].s_nssai[0]; - ogs_assert(selected_s_nssai); - } - - memcpy(&sess->s_nssai, selected_s_nssai, sizeof(ogs_s_nssai_t)); + /* Store S-NSSAI */ + sess->s_nssai.sst = selected_slice->s_nssai.sst; + sess->s_nssai.sd.v = selected_slice->s_nssai.sd.v; if (ul_nas_transport->presencemask & OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_PRESENT) { @@ -797,24 +798,43 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, } if (!sess->dnn) { - if (amf_ue->num_of_subscribed_dnn) { - sess->dnn = ogs_strdup(amf_ue->subscribed_dnn[0]); + if (selected_slice->num_of_session) { + sess->dnn = ogs_strdup(selected_slice->session[0].name); } } if (!sess->dnn) { - ogs_fatal("No DNN : Set default DNN using WebUI"); - ogs_assert_if_reached(); + ogs_error("[%s] No DNN", amf_ue->supi); + nas_5gs_send_gmm_status(amf_ue, OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE); + return OGS_ERROR; } ogs_info("UE SUPI[%s] DNN[%s] S_NSSAI[SST:%d SD:0x%x]", amf_ue->supi, sess->dnn, sess->s_nssai.sst, sess->s_nssai.sd.v); + if (!SESSION_CONTEXT_IN_SMF(sess)) { - amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF, - sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL, - amf_nsmf_pdusession_build_create_sm_context); + ogs_sbi_nf_instance_t *nf_instance = NULL; + + nf_instance = OGS_SBI_NF_INSTANCE( + &sess->sbi, OpenAPI_nf_type_SMF); + if (!nf_instance) { + amf_sess_select_smf(sess); + nf_instance = OGS_SBI_NF_INSTANCE( + &sess->sbi, OpenAPI_nf_type_SMF); + } + + if (nf_instance) { + amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF, + sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL, + amf_nsmf_pdusession_build_create_sm_context); + } else { + amf_sess_sbi_discover_and_send(OpenAPI_nf_type_NSSF, + sess, 0, NULL, amf_nnssf_nsselection_build_get); + } + } else { + memset(¶m, 0, sizeof(param)); param.release = 1; param.cause = OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID; diff --git a/src/amf/gmm-sm.c b/src/amf/gmm-sm.c index 405718498..cac63249a 100644 --- a/src/amf/gmm-sm.c +++ b/src/amf/gmm-sm.c @@ -891,7 +891,15 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) break; } - amf_nudm_sdm_handle_provisioned(amf_ue, sbi_message); + rv = amf_nudm_sdm_handle_provisioned(amf_ue, sbi_message); + if (rv != OGS_OK) { + ogs_error("[%s] amf_nudm_sdm_handle_provisioned(%s) failed", + amf_ue->supi, sbi_message->h.resource.component[1]); + nas_5gs_send_gmm_reject( + amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED); + OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception); + break; + } break; DEFAULT @@ -907,8 +915,8 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) rv = amf_npcf_am_policy_control_handle_create( amf_ue, sbi_message); if (rv != OGS_OK) { - ogs_error("amf_npcf_am_policy_control_handle_create() " - "failed"); + ogs_error("[%s] amf_npcf_am_policy_control_handle_create() " + "failed", amf_ue->supi); OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception); break; } diff --git a/src/amf/meson.build b/src/amf/meson.build index 571c8fe54..8a80d8eeb 100644 --- a/src/amf/meson.build +++ b/src/amf/meson.build @@ -32,7 +32,12 @@ libamf_sources = files(''' npcf-build.c npcf-handler.c + nnssf-build.c + nnssf-handler.c + + nnrf-build.c nnrf-handler.c + namf-handler.c sbi-path.c diff --git a/src/amf/nausf-build.c b/src/amf/nausf-build.c index 0df1a3966..be90485bb 100644 --- a/src/amf/nausf-build.c +++ b/src/amf/nausf-build.c @@ -49,7 +49,7 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate( ogs_assert(amf_ue->suci); AuthenticationInfo.supi_or_suci = amf_ue->suci; AuthenticationInfo.serving_network_name = - ogs_serving_network_name_from_plmn_id(&amf_ue->tai.plmn_id); + ogs_serving_network_name_from_plmn_id(&amf_ue->nr_tai.plmn_id); if (auts) { memset(&ResynchronizationInfo, 0, sizeof(ResynchronizationInfo)); diff --git a/src/amf/nf-sm.c b/src/amf/nf-sm.c index 7aa2c0726..453f43119 100644 --- a/src/amf/nf-sm.c +++ b/src/amf/nf-sm.c @@ -109,7 +109,7 @@ void amf_nf_state_will_register(ogs_fsm_t *s, amf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + amf_nnrf_nfm_send_nf_register(nf_instance); break; case OGS_FSM_EXIT_SIG: @@ -164,7 +164,7 @@ void amf_nf_state_will_register(ogs_fsm_t *s, amf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + amf_nnrf_nfm_send_nf_register(nf_instance); break; default: @@ -218,6 +218,8 @@ void amf_nf_state_registered(ogs_fsm_t *s, amf_event_t *e) amf_self()->nf_type, nf_instance->id, OpenAPI_nf_type_PCF); ogs_nnrf_nfm_send_nf_status_subscribe(client, amf_self()->nf_type, nf_instance->id, OpenAPI_nf_type_SMF); + ogs_nnrf_nfm_send_nf_status_subscribe(client, + amf_self()->nf_type, nf_instance->id, OpenAPI_nf_type_NSSF); } break; diff --git a/src/amf/ngap-build.c b/src/amf/ngap-build.c index a0376bcfd..aede4ae56 100644 --- a/src/amf/ngap-build.c +++ b/src/amf/ngap-build.c @@ -313,7 +313,7 @@ ogs_pkbuf_t *ngap_build_downlink_nas_transport( } if (allowed_nssai) { - int i, j; + int i; ogs_assert(amf_ue); ie = CALLOC(1, sizeof(NGAP_DownlinkNASTransport_IEs_t)); @@ -326,31 +326,26 @@ ogs_pkbuf_t *ngap_build_downlink_nas_transport( AllowedNSSAI = &ie->value.choice.AllowedNSSAI; - for (i = 0; i < amf_self()->num_of_plmn_support; i++) { - if (memcmp(&amf_ue->tai.plmn_id, - &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) - continue; - for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { - NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; - NGAP_S_NSSAI_t *s_NSSAI = NULL; - NGAP_SST_t *sST = NULL; + for (i = 0; i < amf_ue->allowed_nssai.num_of_s_nssai; i++) { + NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; + NGAP_S_NSSAI_t *s_NSSAI = NULL; + NGAP_SST_t *sST = NULL; - NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) - CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); - s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; - sST = &s_NSSAI->sST; + NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) + CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); + s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; + sST = &s_NSSAI->sST; - ogs_asn_uint8_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sst, sST); - if (amf_self()->plmn_support[i].s_nssai[j].sd.v != - OGS_S_NSSAI_NO_SD_VALUE) { - s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); - ogs_asn_uint24_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sd, s_NSSAI->sD); - } - - ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); + ogs_asn_uint8_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sst, sST); + if (amf_ue->allowed_nssai.s_nssai[i].sd.v != + OGS_S_NSSAI_NO_SD_VALUE) { + s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); + ogs_asn_uint24_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sd, s_NSSAI->sD); } + + ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); } } @@ -360,7 +355,7 @@ ogs_pkbuf_t *ngap_build_downlink_nas_transport( ogs_pkbuf_t *ngap_ue_build_initial_context_setup_request( amf_ue_t *amf_ue, ogs_pkbuf_t *gmmbuf) { - int i, j; + int i; ran_ue_t *ran_ue = NULL; amf_sess_t *sess = NULL; @@ -537,31 +532,26 @@ ogs_pkbuf_t *ngap_ue_build_initial_context_setup_request( ogs_ngap_uint8_to_AMFPointer(ogs_amf_pointer(&amf_ue->guami->amf_id), &GUAMI->aMFPointer); - for (i = 0; i < amf_self()->num_of_plmn_support; i++) { - if (memcmp(&amf_ue->tai.plmn_id, - &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) - continue; - for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { - NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; - NGAP_S_NSSAI_t *s_NSSAI = NULL; - NGAP_SST_t *sST = NULL; + for (i = 0; i < amf_ue->allowed_nssai.num_of_s_nssai; i++) { + NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; + NGAP_S_NSSAI_t *s_NSSAI = NULL; + NGAP_SST_t *sST = NULL; - NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) - CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); - s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; - sST = &s_NSSAI->sST; + NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) + CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); + s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; + sST = &s_NSSAI->sST; - ogs_asn_uint8_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sst, sST); - if (amf_self()->plmn_support[i].s_nssai[j].sd.v != - OGS_S_NSSAI_NO_SD_VALUE) { - s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); - ogs_asn_uint24_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sd, s_NSSAI->sD); - } - - ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); + ogs_asn_uint8_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sst, sST); + if (amf_ue->allowed_nssai.s_nssai[i].sd.v != + OGS_S_NSSAI_NO_SD_VALUE) { + s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); + ogs_asn_uint24_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sd, s_NSSAI->sD); } + + ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); } UESecurityCapabilities->nRencryptionAlgorithms.size = 2; @@ -669,7 +659,7 @@ ogs_pkbuf_t *ngap_ue_build_initial_context_setup_request( ogs_pkbuf_t *ngap_sess_build_initial_context_setup_request( amf_sess_t *sess, ogs_pkbuf_t *gmmbuf, ogs_pkbuf_t *n2smbuf) { - int i, j; + int i; ran_ue_t *ran_ue = NULL; amf_ue_t *amf_ue = NULL; @@ -855,31 +845,26 @@ ogs_pkbuf_t *ngap_sess_build_initial_context_setup_request( ogs_ngap_uint8_to_AMFPointer(ogs_amf_pointer(&amf_ue->guami->amf_id), &GUAMI->aMFPointer); - for (i = 0; i < amf_self()->num_of_plmn_support; i++) { - if (memcmp(&amf_ue->tai.plmn_id, - &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) - continue; - for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { - NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; - NGAP_S_NSSAI_t *s_NSSAI = NULL; - NGAP_SST_t *sST = NULL; + for (i = 0; i < amf_ue->allowed_nssai.num_of_s_nssai; i++) { + NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; + NGAP_S_NSSAI_t *s_NSSAI = NULL; + NGAP_SST_t *sST = NULL; - NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) - CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); - s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; - sST = &s_NSSAI->sST; + NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) + CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); + s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; + sST = &s_NSSAI->sST; - ogs_asn_uint8_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sst, sST); - if (amf_self()->plmn_support[i].s_nssai[j].sd.v != - OGS_S_NSSAI_NO_SD_VALUE) { - s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); - ogs_asn_uint24_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sd, s_NSSAI->sD); - } - - ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); + ogs_asn_uint8_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sst, sST); + if (amf_ue->allowed_nssai.s_nssai[i].sd.v != + OGS_S_NSSAI_NO_SD_VALUE) { + s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); + ogs_asn_uint24_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sd, s_NSSAI->sD); } + + ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); } UESecurityCapabilities->nRencryptionAlgorithms.size = 2; @@ -1050,7 +1035,7 @@ ogs_pkbuf_t *ngap_build_ue_context_modification_request(amf_ue_t *amf_ue) ogs_assert(LAI); ogs_asn_buffer_to_OCTET_STRING( - &amf_ue->tai.plmn_id, sizeof(ogs_plmn_id_t), &LAI->pLMNidentity); + &amf_ue->nr_tai.plmn_id, sizeof(ogs_plmn_id_t), &LAI->pLMNidentity); ogs_assert(amf_ue->csmap); ogs_assert(amf_ue->p_tmsi); ogs_asn_uint16_to_OCTET_STRING(amf_ue->csmap->lai.lac, &LAI->lAC); @@ -1687,7 +1672,7 @@ ogs_pkbuf_t *ngap_build_paging(amf_ue_t *amf_ue) ASN_SEQUENCE_ADD(&TAIList->list, TAIItem); tAI = &TAIItem->tAI; - ogs_ngap_5gs_tai_to_ASN(&amf_ue->tai, tAI); + ogs_ngap_5gs_tai_to_ASN(&amf_ue->nr_tai, tAI); return ogs_ngap_encode(&pdu); } @@ -1742,7 +1727,7 @@ ogs_pkbuf_t *ngap_build_downlink_ran_configuration_transfer( ogs_pkbuf_t *ngap_build_path_switch_ack(amf_ue_t *amf_ue) { - int i, j; + int i; ran_ue_t *ran_ue = NULL; amf_sess_t *sess = NULL; @@ -1872,31 +1857,26 @@ ogs_pkbuf_t *ngap_build_path_switch_ack(amf_ue_t *amf_ue) AllowedNSSAI = &ie->value.choice.AllowedNSSAI; - for (i = 0; i < amf_self()->num_of_plmn_support; i++) { - if (memcmp(&amf_ue->tai.plmn_id, - &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) - continue; - for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { - NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; - NGAP_S_NSSAI_t *s_NSSAI = NULL; - NGAP_SST_t *sST = NULL; + for (i = 0; i < amf_ue->allowed_nssai.num_of_s_nssai; i++) { + NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; + NGAP_S_NSSAI_t *s_NSSAI = NULL; + NGAP_SST_t *sST = NULL; - NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) - CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); - s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; - sST = &s_NSSAI->sST; + NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) + CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); + s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; + sST = &s_NSSAI->sST; - ogs_asn_uint8_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sst, sST); - if (amf_self()->plmn_support[i].s_nssai[j].sd.v != - OGS_S_NSSAI_NO_SD_VALUE) { - s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); - ogs_asn_uint24_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sd, s_NSSAI->sD); - } - - ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); + ogs_asn_uint8_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sst, sST); + if (amf_ue->allowed_nssai.s_nssai[i].sd.v != + OGS_S_NSSAI_NO_SD_VALUE) { + s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); + ogs_asn_uint24_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sd, s_NSSAI->sD); } + + ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); } return ogs_ngap_encode(&pdu); @@ -1904,7 +1884,7 @@ ogs_pkbuf_t *ngap_build_path_switch_ack(amf_ue_t *amf_ue) ogs_pkbuf_t *ngap_build_handover_request(ran_ue_t *target_ue) { - int i, j; + int i; amf_ue_t *amf_ue = NULL; amf_sess_t *sess = NULL; @@ -2123,33 +2103,26 @@ ogs_pkbuf_t *ngap_build_handover_request(ran_ue_t *target_ue) AllowedNSSAI = &ie->value.choice.AllowedNSSAI; - for (i = 0; i < amf_self()->num_of_plmn_support; i++) { - if (memcmp(&amf_ue->tai.plmn_id, - &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) - continue; - for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { - NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; - NGAP_S_NSSAI_t *s_NSSAI = NULL; - NGAP_SST_t *sST = NULL; + for (i = 0; i < amf_ue->allowed_nssai.num_of_s_nssai; i++) { + NGAP_AllowedNSSAI_Item_t *NGAP_AllowedNSSAI_Item = NULL; + NGAP_S_NSSAI_t *s_NSSAI = NULL; + NGAP_SST_t *sST = NULL; - NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) - CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); - ogs_assert(NGAP_AllowedNSSAI_Item); - s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; - sST = &s_NSSAI->sST; + NGAP_AllowedNSSAI_Item = (NGAP_AllowedNSSAI_Item_t *) + CALLOC(1, sizeof(NGAP_AllowedNSSAI_Item_t)); + s_NSSAI = &NGAP_AllowedNSSAI_Item->s_NSSAI; + sST = &s_NSSAI->sST; - ogs_asn_uint8_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sst, sST); - if (amf_self()->plmn_support[i].s_nssai[j].sd.v != - OGS_S_NSSAI_NO_SD_VALUE) { - s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); - ogs_assert(s_NSSAI->sD); - ogs_asn_uint24_to_OCTET_STRING( - amf_self()->plmn_support[i].s_nssai[j].sd, s_NSSAI->sD); - } - - ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); + ogs_asn_uint8_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sst, sST); + if (amf_ue->allowed_nssai.s_nssai[i].sd.v != + OGS_S_NSSAI_NO_SD_VALUE) { + s_NSSAI->sD = CALLOC(1, sizeof(NGAP_SD_t)); + ogs_asn_uint24_to_OCTET_STRING( + amf_ue->allowed_nssai.s_nssai[i].sd, s_NSSAI->sD); } + + ASN_SEQUENCE_ADD(&AllowedNSSAI->list, NGAP_AllowedNSSAI_Item); } /* TS23.003 6.2.2 Composition of IMEISV diff --git a/src/amf/ngap-handler.c b/src/amf/ngap-handler.c index c7af3935e..c051abfa1 100644 --- a/src/amf/ngap-handler.c +++ b/src/amf/ngap-handler.c @@ -231,7 +231,7 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message) bplmn_list[j].num_of_s_nssai = 0; k < BroadcastPLMNItem->tAISliceSupportList.list.count && gnb->supported_ta_list[i].bplmn_list[j].num_of_s_nssai < - OGS_MAX_NUM_OF_S_NSSAI; + OGS_MAX_NUM_OF_SLICE; k++) { NGAP_SliceSupportItem_t *SliceSupportItem = NULL; NGAP_S_NSSAI_t *s_NSSAI = NULL; @@ -475,12 +475,12 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message) ogs_ngap_ASN_to_nr_cgi( &UserLocationInformationNR->nR_CGI, &ran_ue->saved.nr_cgi); ogs_ngap_ASN_to_5gs_tai( - &UserLocationInformationNR->tAI, &ran_ue->saved.tai); + &UserLocationInformationNR->tAI, &ran_ue->saved.nr_tai); ogs_info(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld] " "TAC[%d] CellID[0x%llx]", ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id, - ran_ue->saved.tai.tac.v, (long long)ran_ue->saved.nr_cgi.cell_id); + ran_ue->saved.nr_tai.tac.v, (long long)ran_ue->saved.nr_cgi.cell_id); if (UEContextRequest) { if (*UEContextRequest == NGAP_UEContextRequest_requested) { @@ -612,15 +612,15 @@ void ngap_handle_uplink_nas_transport( ogs_ngap_ASN_to_nr_cgi( &UserLocationInformationNR->nR_CGI, &ran_ue->saved.nr_cgi); ogs_ngap_ASN_to_5gs_tai( - &UserLocationInformationNR->tAI, &ran_ue->saved.tai); + &UserLocationInformationNR->tAI, &ran_ue->saved.nr_tai); ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld] " "TAC[%d] CellID[0x%llx]", ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id, - ran_ue->saved.tai.tac.v, (long long)ran_ue->saved.nr_cgi.cell_id); + ran_ue->saved.nr_tai.tac.v, (long long)ran_ue->saved.nr_cgi.cell_id); /* Copy NR-TAI/NR-CGI from ran_ue */ - memcpy(&amf_ue->tai, &ran_ue->saved.tai, sizeof(ogs_5gs_tai_t)); + memcpy(&amf_ue->nr_tai, &ran_ue->saved.nr_tai, sizeof(ogs_5gs_tai_t)); memcpy(&amf_ue->nr_cgi, &ran_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t)); ngap_send_to_nas(ran_ue, NGAP_ProcedureCode_id_UplinkNASTransport, NAS_PDU); @@ -2027,7 +2027,7 @@ void ngap_handle_path_switch_request( ogs_info(" [OLD] RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld] ", ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id); ogs_info(" [OLD] TAC[%d] CellID[0x%llx]", - amf_ue->tai.tac.v, (long long)amf_ue->nr_cgi.cell_id); + amf_ue->nr_tai.tac.v, (long long)amf_ue->nr_cgi.cell_id); /* Update RAN-UE-NGAP-ID */ ran_ue->ran_ue_ngap_id = *RAN_UE_NGAP_ID; @@ -2060,15 +2060,15 @@ void ngap_handle_path_switch_request( ogs_ngap_ASN_to_nr_cgi( &UserLocationInformationNR->nR_CGI, &ran_ue->saved.nr_cgi); ogs_ngap_ASN_to_5gs_tai( - &UserLocationInformationNR->tAI, &ran_ue->saved.tai); + &UserLocationInformationNR->tAI, &ran_ue->saved.nr_tai); /* Copy Stream-No/TAI/ECGI from ran_ue */ amf_ue->gnb_ostream_id = ran_ue->gnb_ostream_id; - memcpy(&amf_ue->tai, &ran_ue->saved.tai, sizeof(ogs_5gs_tai_t)); + memcpy(&amf_ue->nr_tai, &ran_ue->saved.nr_tai, sizeof(ogs_5gs_tai_t)); memcpy(&amf_ue->nr_cgi, &ran_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t)); ogs_info(" [NEW] TAC[%d] CellID[0x%llx]", - amf_ue->tai.tac.v, (long long)amf_ue->nr_cgi.cell_id); + amf_ue->nr_tai.tac.v, (long long)amf_ue->nr_cgi.cell_id); if (!UESecurityCapabilities) { ogs_error("No UESecurityCapabilities"); @@ -3141,20 +3141,22 @@ void ngap_handle_handover_notification( ogs_ngap_ASN_to_nr_cgi( &UserLocationInformationNR->nR_CGI, &target_ue->saved.nr_cgi); ogs_ngap_ASN_to_5gs_tai( - &UserLocationInformationNR->tAI, &target_ue->saved.tai); + &UserLocationInformationNR->tAI, &target_ue->saved.nr_tai); ogs_debug(" Source : RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld] ", source_ue->ran_ue_ngap_id, (long long)source_ue->amf_ue_ngap_id); ogs_debug(" Source : TAC[%d] CellID[0x%llx]", - source_ue->saved.tai.tac.v, (long long)source_ue->saved.nr_cgi.cell_id); + source_ue->saved.nr_tai.tac.v, + (long long)source_ue->saved.nr_cgi.cell_id); ogs_debug(" Target : RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld] ", target_ue->ran_ue_ngap_id, (long long)target_ue->amf_ue_ngap_id); ogs_debug(" Target : TAC[%d] CellID[0x%llx]", - target_ue->saved.tai.tac.v, (long long)target_ue->saved.nr_cgi.cell_id); + target_ue->saved.nr_tai.tac.v, + (long long)target_ue->saved.nr_cgi.cell_id); /* Copy Stream-No/TAI/ECGI from ran_ue */ amf_ue->gnb_ostream_id = target_ue->gnb_ostream_id; - memcpy(&amf_ue->tai, &target_ue->saved.tai, sizeof(ogs_5gs_tai_t)); + memcpy(&amf_ue->nr_tai, &target_ue->saved.nr_tai, sizeof(ogs_5gs_tai_t)); memcpy(&amf_ue->nr_cgi, &target_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t)); ngap_send_ran_ue_context_release_command(source_ue, diff --git a/src/amf/ngap-path.c b/src/amf/ngap-path.c index 4ccb2c0ce..1ed5455ee 100644 --- a/src/amf/ngap-path.c +++ b/src/amf/ngap-path.c @@ -336,8 +336,8 @@ void ngap_send_paging(amf_ue_t *amf_ue) for (i = 0; i < gnb->num_of_supported_ta_list; i++) { for (j = 0; j < gnb->supported_ta_list[i].num_of_bplmn_list; j++) { if (memcmp(&gnb->supported_ta_list[i].bplmn_list[j].plmn_id, - &amf_ue->tai.plmn_id, OGS_PLMN_ID_LEN) == 0 && - gnb->supported_ta_list[i].tac.v == amf_ue->tai.tac.v) { + &amf_ue->nr_tai.plmn_id, OGS_PLMN_ID_LEN) == 0 && + gnb->supported_ta_list[i].tac.v == amf_ue->nr_tai.tac.v) { if (amf_ue->t3513.pkbuf) { ngapbuf = amf_ue->t3513.pkbuf; diff --git a/src/amf/nnrf-build.c b/src/amf/nnrf-build.c new file mode 100644 index 000000000..3828ea05d --- /dev/null +++ b/src/amf/nnrf-build.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnrf-build.h" + +ogs_sbi_request_t *amf_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); + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return request; +} + +ogs_sbi_request_t *amf_nnrf_disc_build_discover( + char *nrf_id, + OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_assert(nrf_id); + ogs_assert(target_nf_type); + ogs_assert(requester_nf_type); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; + message.h.uri = nrf_id; + + message.param.target_nf_type = target_nf_type; + message.param.requester_nf_type = requester_nf_type; + + request = ogs_sbi_build_request(&message); + + return request; +} diff --git a/src/amf/nnrf-build.h b/src/amf/nnrf-build.h new file mode 100644 index 000000000..77d80ae57 --- /dev/null +++ b/src/amf/nnrf-build.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AMF_NNRF_BUILD_H +#define AMF_NNRF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *amf_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance); + +ogs_sbi_request_t *amf_nnrf_disc_build_discover( + char *nrf_id, + OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type); + +#ifdef __cplusplus +} +#endif + +#endif /* AMF_NNRF_BUILD_H */ diff --git a/src/amf/nnrf-handler.c b/src/amf/nnrf-handler.c index adb192de3..3ffb7ed44 100644 --- a/src/amf/nnrf-handler.c +++ b/src/amf/nnrf-handler.c @@ -245,15 +245,12 @@ bool amf_nnrf_handle_nf_status_notify( void amf_nnrf_handle_nf_discover( ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg) { - bool handled; - ogs_sbi_object_t *sbi_object = NULL; amf_ue_t *amf_ue = NULL; amf_sess_t *sess = NULL; ogs_sbi_nf_instance_t *nf_instance = NULL; OpenAPI_search_result_t *SearchResult = NULL; - OpenAPI_lnode_t *node = NULL; ogs_assert(xact); sbi_object = xact->sbi_object; @@ -266,71 +263,10 @@ void amf_nnrf_handle_nf_discover( return; } - OpenAPI_list_for_each(SearchResult->nf_instances, node) { - OpenAPI_nf_profile_t *NFProfile = NULL; - - if (!node->data) continue; - - NFProfile = node->data; - - nf_instance = ogs_sbi_nf_instance_find(NFProfile->nf_instance_id); - if (!nf_instance) { - nf_instance = ogs_sbi_nf_instance_add(NFProfile->nf_instance_id); - ogs_assert(nf_instance); - - amf_nf_fsm_init(nf_instance); - - ogs_info("[%s] (NF-discover) NF registered", nf_instance->id); - } else { - OGS_FSM_TRAN(&nf_instance->sm, amf_nf_state_registered); - ogs_fsm_dispatch(&nf_instance->sm, NULL); - - ogs_warn("[%s] (NF-discover) NF has already been added", - NFProfile->nf_instance_id); - } - - if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { - handled = ogs_sbi_nnrf_handle_nf_profile( - nf_instance, NFProfile, NULL, NULL); - if (!handled) { - ogs_error("ogs_sbi_nnrf_handle_nf_profile() failed [%s]", - nf_instance->id); - AMF_NF_INSTANCE_CLEAR("NRF-discover", nf_instance); - continue; - } - - handled = ogs_sbi_client_associate(nf_instance); - if (!handled) { - ogs_error("[%s] Cannot assciate NF EndPoint", nf_instance->id); - AMF_NF_INSTANCE_CLEAR("NRF-discover", nf_instance); - continue; - } - - if (!OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, nf_instance->nf_type)) - ogs_sbi_nf_instance_associate(sbi_object->nf_type_array, - nf_instance->nf_type, amf_nf_state_registered); - - /* TIME : Update validity from NRF */ - if (SearchResult->validity_period) { - nf_instance->time.validity_duration = - SearchResult->validity_period; - - ogs_assert(nf_instance->t_validity); - ogs_timer_start(nf_instance->t_validity, - ogs_time_from_sec(nf_instance->time.validity_duration)); - - } else - ogs_warn("[%s] NF Instance validity-time should not 0", - nf_instance->id); - - ogs_info("[%s] (NF-discover) NF Profile updated", nf_instance->id); - } - } + amf_nnrf_handle_nf_discover_search_result(sbi_object, SearchResult); ogs_assert(xact->target_nf_type); - nf_instance = OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, xact->target_nf_type); + nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, xact->target_nf_type); if (!nf_instance) { ogs_assert(sbi_object->type > OGS_SBI_OBJ_BASE && sbi_object->type < OGS_SBI_OBJ_TOP); @@ -367,3 +303,92 @@ void amf_nnrf_handle_nf_discover( amf_sbi_send(nf_instance, xact); } } + +void amf_nnrf_handle_nf_discover_search_result( + ogs_sbi_object_t *sbi_object, OpenAPI_search_result_t *SearchResult) +{ + bool handled; + + OpenAPI_lnode_t *node = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(sbi_object); + ogs_assert(SearchResult); + + OpenAPI_list_for_each(SearchResult->nf_instances, node) { + OpenAPI_nf_profile_t *NFProfile = NULL; + + if (!node->data) continue; + + NFProfile = node->data; + + nf_instance = ogs_sbi_nf_instance_find(NFProfile->nf_instance_id); + if (!nf_instance) { + nf_instance = ogs_sbi_nf_instance_add(NFProfile->nf_instance_id); + ogs_assert(nf_instance); + + amf_nf_fsm_init(nf_instance); + + ogs_info("[%s] (NF-discover) NF registered", nf_instance->id); + } else { + OGS_FSM_TRAN(&nf_instance->sm, amf_nf_state_registered); + ogs_fsm_dispatch(&nf_instance->sm, NULL); + + ogs_warn("[%s] (NF-discover) NF has already been added", + NFProfile->nf_instance_id); + } + + if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { + amf_ue_t *amf_ue = NULL; + amf_sess_t *sess = NULL; + + handled = ogs_sbi_nnrf_handle_nf_profile( + nf_instance, NFProfile, NULL, NULL); + if (!handled) { + ogs_error("ogs_sbi_nnrf_handle_nf_profile() failed [%s]", + nf_instance->id); + AMF_NF_INSTANCE_CLEAR("NRF-discover", nf_instance); + continue; + } + + handled = ogs_sbi_client_associate(nf_instance); + if (!handled) { + ogs_error("[%s] Cannot assciate NF EndPoint", nf_instance->id); + AMF_NF_INSTANCE_CLEAR("NRF-discover", nf_instance); + continue; + } + + switch(sbi_object->type) { + case OGS_SBI_OBJ_UE_TYPE: + amf_ue = (amf_ue_t *)sbi_object; + ogs_assert(amf_ue); + amf_ue_select_nf(amf_ue, nf_instance->nf_type); + break; + case OGS_SBI_OBJ_SESS_TYPE: + sess = (amf_sess_t *)sbi_object; + ogs_assert(sess); + amf_sess_select_nf(sess, nf_instance->nf_type); + break; + default: + ogs_fatal("(NF discover search result) Not implemented [%d]", + sbi_object->type); + ogs_assert_if_reached(); + } + + /* TIME : Update validity from NRF */ + if (SearchResult->validity_period) { + nf_instance->time.validity_duration = + SearchResult->validity_period; + + ogs_assert(nf_instance->t_validity); + ogs_timer_start(nf_instance->t_validity, + ogs_time_from_sec(nf_instance->time.validity_duration)); + + } else + ogs_warn("[%s] NF Instance validity-time should not 0", + nf_instance->id); + + ogs_info("[%s] (NF-discover) NF Profile updated", nf_instance->id); + } + } +} diff --git a/src/amf/nnrf-handler.h b/src/amf/nnrf-handler.h index 4bbf90e27..b51fc158a 100644 --- a/src/amf/nnrf-handler.h +++ b/src/amf/nnrf-handler.h @@ -36,6 +36,8 @@ bool amf_nnrf_handle_nf_status_notify( void amf_nnrf_handle_nf_discover( ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg); +void amf_nnrf_handle_nf_discover_search_result( + ogs_sbi_object_t *sbi_object, OpenAPI_search_result_t *SearchResult); #ifdef __cplusplus } diff --git a/src/amf/nnssf-build.c b/src/amf/nnssf-build.c new file mode 100644 index 000000000..3daa0f363 --- /dev/null +++ b/src/amf/nnssf-build.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnssf-build.h" + +ogs_sbi_request_t *amf_nnssf_nsselection_build_get( + amf_sess_t *sess, void *data) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_assert(sess); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION; + message.h.api.version = (char *)OGS_SBI_API_V2; + message.h.resource.component[0] = + (char *)OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION; + + message.param.nf_id = ogs_sbi_self()->nf_instance_id; + message.param.nf_type = amf_self()->nf_type; + + message.param.slice_info_request_for_pdu_session_presence = true; + message.param.roaming_indication = OpenAPI_roaming_indication_NON_ROAMING; + memcpy(&message.param.s_nssai, &sess->s_nssai, + sizeof(message.param.s_nssai)); + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + return request; +} diff --git a/src/amf/nnssf-build.h b/src/amf/nnssf-build.h new file mode 100644 index 000000000..d7a1ad363 --- /dev/null +++ b/src/amf/nnssf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AMF_NNSSF_BUILD_H +#define AMF_NNSSF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *amf_nnssf_nsselection_build_get( + amf_sess_t *sess, void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* AMF_NNSSF_BUILD_H */ diff --git a/src/amf/nnssf-handler.c b/src/amf/nnssf-handler.c new file mode 100644 index 000000000..a40e63d0d --- /dev/null +++ b/src/amf/nnssf-handler.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnssf-handler.h" +#include "nas-path.h" +#include "sbi-path.h" + +int amf_nnssf_nsselection_handle_get( + amf_sess_t *sess, ogs_sbi_message_t *recvmsg) +{ + amf_ue_t *amf_ue = NULL; + + ogs_sbi_client_t *client = NULL; + ogs_sockaddr_t *addr = NULL; + + OpenAPI_authorized_network_slice_info_t *AuthorizedNetworkSliceInfo = NULL; + OpenAPI_nsi_information_t *NsiInformation = NULL; + + ogs_assert(sess); + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + ogs_assert(recvmsg); + + ogs_assert(!SESSION_CONTEXT_IN_SMF(sess)); + + if (recvmsg->res_status != OGS_SBI_HTTP_STATUS_OK) { + ogs_error("[%s] HTTP response error [%d]", + amf_ue->supi, recvmsg->res_status); + nas_5gs_send_gmm_status(amf_ue, recvmsg->res_status); + return OGS_ERROR; + } + + AuthorizedNetworkSliceInfo = recvmsg->AuthorizedNetworkSliceInfo; + if (!AuthorizedNetworkSliceInfo) { + ogs_error("No AuthorizedNetworkSliceInfo"); + nas_5gs_send_gmm_reject_from_sbi( + amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR); + return OGS_ERROR; + } + + NsiInformation = AuthorizedNetworkSliceInfo->nsi_information; + if (!NsiInformation) { + ogs_error("No NsiInformation"); + nas_5gs_send_gmm_reject_from_sbi( + amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR); + return OGS_ERROR; + } + + if (!NsiInformation->nrf_id) { + ogs_error("No nrfId"); + nas_5gs_send_gmm_reject_from_sbi( + amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR); + return OGS_ERROR; + } + + if (sess->nssf.nrf.id) + ogs_free(sess->nssf.nrf.id); + sess->nssf.nrf.id = ogs_strdup(NsiInformation->nrf_id); + + addr = ogs_sbi_getaddr_from_uri(NsiInformation->nrf_id); + if (!addr) { + ogs_error("[%s:%d] Invalid URI [%s]", + amf_ue->supi, sess->psi, NsiInformation->nrf_id); + nas_5gs_send_gmm_reject_from_sbi( + amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR); + return OGS_ERROR;; + } + + client = ogs_sbi_client_find(addr); + if (!client) { + client = ogs_sbi_client_add(addr); + ogs_assert(client); + } + + if (sess->nssf.nrf.client && sess->nssf.nrf.client != client) { + ogs_warn("NSSF NRF URI Updated [%s]", sess->nssf.nrf.id); + ogs_sbi_client_remove(sess->nssf.nrf.client); + } + OGS_SETUP_SBI_CLIENT(&sess->nssf.nrf, client); + + ogs_freeaddrinfo(addr); + + if (NsiInformation->nsi_id) { + if (sess->nssf.nsi_id) + ogs_free(sess->nssf.nsi_id); + sess->nssf.nsi_id = ogs_strdup(NsiInformation->nsi_id); + } + + amf_sess_sbi_discover_by_nsi(OpenAPI_nf_type_SMF, sess); + + return OGS_OK; +} diff --git a/src/amf/nnssf-handler.h b/src/amf/nnssf-handler.h new file mode 100644 index 000000000..bf53700ba --- /dev/null +++ b/src/amf/nnssf-handler.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AMF_NNSSF_HANDLER_H +#define AMF_NNSSF_HANDLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "context.h" + +int amf_nnssf_nsselection_handle_get( + amf_sess_t *sess, ogs_sbi_message_t *message); + +#ifdef __cplusplus +} +#endif + +#endif /* AMF_NNSSF_HANDLER_H */ diff --git a/src/amf/npcf-build.c b/src/amf/npcf-build.c index 17ef3c292..0a8395303 100644 --- a/src/amf/npcf-build.c +++ b/src/amf/npcf-build.c @@ -29,7 +29,7 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create( OpenAPI_policy_association_request_t PolicyAssociationRequest; - int i, j; + int i; OpenAPI_lnode_t *node = NULL; OpenAPI_list_t *AllowedSnssais = NULL; @@ -75,7 +75,7 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create( memset(&ueLocation, 0, sizeof(ueLocation)); ueLocation.nr_location = ogs_sbi_build_nr_location( - &amf_ue->tai, &amf_ue->nr_cgi); + &amf_ue->nr_tai, &amf_ue->nr_cgi); ogs_assert(ueLocation.nr_location); ueLocation.nr_location->ue_location_timestamp = ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp); @@ -85,7 +85,7 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create( ogs_sbi_timezone_string(ogs_timezone()); PolicyAssociationRequest.serving_plmn = - ogs_sbi_build_plmn_id_nid(&amf_ue->tai.plmn_id); + ogs_sbi_build_plmn_id_nid(&amf_ue->nr_tai.plmn_id); PolicyAssociationRequest.rat_type = amf_ue_rat_type(amf_ue); @@ -108,20 +108,15 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create( AllowedSnssais = OpenAPI_list_create(); ogs_assert(AllowedSnssais); - for (i = 0; i < amf_self()->num_of_plmn_support; i++) { - if (memcmp(&amf_ue->tai.plmn_id, - &amf_self()->plmn_support[i].plmn_id, OGS_PLMN_ID_LEN) != 0) - continue; - for (j = 0; j < amf_self()->plmn_support[i].num_of_s_nssai; j++) { - struct OpenAPI_snssai_s *Snssai = ogs_calloc(1, sizeof(*Snssai)); - ogs_assert(Snssai); + for (i = 0; i < amf_ue->allowed_nssai.num_of_s_nssai; i++) { + struct OpenAPI_snssai_s *Snssai = ogs_calloc(1, sizeof(*Snssai)); + ogs_assert(Snssai); - Snssai->sst = amf_self()->plmn_support[i].s_nssai[j].sst; - Snssai->sd = ogs_s_nssai_sd_to_string( - amf_self()->plmn_support[i].s_nssai[j].sd); + Snssai->sst = amf_ue->allowed_nssai.s_nssai[i].sst; + Snssai->sd = ogs_s_nssai_sd_to_string( + amf_ue->allowed_nssai.s_nssai[i].sd); - OpenAPI_list_add(AllowedSnssais, Snssai); - } + OpenAPI_list_add(AllowedSnssais, Snssai); } if (AllowedSnssais->count) diff --git a/src/amf/nsmf-build.c b/src/amf/nsmf-build.c index 0f0b7b11f..db444981f 100644 --- a/src/amf/nsmf-build.c +++ b/src/amf/nsmf-build.c @@ -54,7 +54,7 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context( SmContextCreateData.serving_nf_id = ogs_sbi_self()->nf_instance_id; SmContextCreateData.serving_network = - ogs_sbi_build_plmn_id_nid(&amf_ue->tai.plmn_id); + ogs_sbi_build_plmn_id_nid(&amf_ue->nr_tai.plmn_id); SmContextCreateData.supi = amf_ue->supi; SmContextCreateData.pei = amf_ue->pei; @@ -74,10 +74,10 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context( SmContextCreateData.s_nssai = &sNssai; memset(&hplmnSnssai, 0, sizeof(hplmnSnssai)); - if (sess->s_nssai.mapped_hplmn_sst) { - hplmnSnssai.sst = sess->s_nssai.mapped_hplmn_sst; + if (sess->mapped_hplmn.sst) { + hplmnSnssai.sst = sess->mapped_hplmn.sst; hplmnSnssai.sd = ogs_s_nssai_sd_to_string( - sess->s_nssai.mapped_hplmn_sd); + sess->mapped_hplmn.sd); SmContextCreateData.hplmn_snssai = &hplmnSnssai; } @@ -104,7 +104,7 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context( memset(&ueLocation, 0, sizeof(ueLocation)); ueLocation.nr_location = ogs_sbi_build_nr_location( - &amf_ue->tai, &amf_ue->nr_cgi); + &amf_ue->nr_tai, &amf_ue->nr_cgi); ogs_assert(ueLocation.nr_location); ueLocation.nr_location->ue_location_timestamp = ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp); @@ -112,8 +112,7 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context( SmContextCreateData.ue_location = &ueLocation; SmContextCreateData.ue_time_zone = ogs_sbi_timezone_string(ogs_timezone()); - pcf_nf_instance = OGS_SBI_NF_INSTANCE_GET( - amf_ue->sbi.nf_type_array, OpenAPI_nf_type_PCF); + pcf_nf_instance = OGS_SBI_NF_INSTANCE(&amf_ue->sbi, OpenAPI_nf_type_PCF); ogs_assert(pcf_nf_instance); SmContextCreateData.pcf_id = pcf_nf_instance->id; @@ -240,7 +239,7 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_update_sm_context( memset(&ueLocation, 0, sizeof(ueLocation)); if (param->ue_location) { ueLocation.nr_location = ogs_sbi_build_nr_location( - &amf_ue->tai, &amf_ue->nr_cgi); + &amf_ue->nr_tai, &amf_ue->nr_cgi); ogs_assert(ueLocation.nr_location); ueLocation.nr_location->ue_location_timestamp = ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp); @@ -301,7 +300,7 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_release_sm_context( memset(&ueLocation, 0, sizeof(ueLocation)); ueLocation.nr_location = ogs_sbi_build_nr_location( - &amf_ue->tai, &amf_ue->nr_cgi); + &amf_ue->nr_tai, &amf_ue->nr_cgi); ogs_assert(ueLocation.nr_location); ueLocation.nr_location->ue_location_timestamp = ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp); diff --git a/src/amf/nudm-handler.c b/src/amf/nudm-handler.c index c964a797a..fb4b515a9 100644 --- a/src/amf/nudm-handler.c +++ b/src/amf/nudm-handler.c @@ -37,8 +37,9 @@ int amf_nudm_sdm_handle_provisioned( recvmsg->AccessAndMobilitySubscriptionData->gpsis; OpenAPI_ambr_rm_t *SubscribedUeAmbr = recvmsg->AccessAndMobilitySubscriptionData->subscribed_ue_ambr; - OpenAPI_list_t *SubscribedDnnList = - recvmsg->AccessAndMobilitySubscriptionData->subscribed_dnn_list; + OpenAPI_nssai_t *NSSAI = + recvmsg->AccessAndMobilitySubscriptionData->nssai; + OpenAPI_lnode_t *node = NULL; /* Clear MSISDN */ @@ -84,30 +85,180 @@ int amf_nudm_sdm_handle_provisioned( ogs_sbi_bitrate_from_string(SubscribedUeAmbr->downlink); } - /* Clear Subscribed-DNN */ - for (i = 0; i < amf_ue->num_of_subscribed_dnn; i++) { - ogs_assert(amf_ue->subscribed_dnn[i]); - ogs_free(amf_ue->subscribed_dnn[i]); - } - amf_ue->num_of_subscribed_dnn = 0; + if (NSSAI) { + OpenAPI_list_t *DefaultSingleNssaiList = NULL; + OpenAPI_list_t *SingleNssaiList = NULL; - if (SubscribedDnnList) { - OpenAPI_list_for_each(SubscribedDnnList, node) { - if (node->data) { - amf_ue->subscribed_dnn[amf_ue->num_of_subscribed_dnn] = - ogs_strdup(node->data); - amf_ue->num_of_subscribed_dnn++; + /* Clear SubscribedInfo */ + amf_clear_subscribed_info(amf_ue); + + DefaultSingleNssaiList = NSSAI->default_single_nssais; + if (DefaultSingleNssaiList) { + OpenAPI_list_for_each(DefaultSingleNssaiList, node) { + OpenAPI_snssai_t *Snssai = node->data; + + ogs_slice_data_t *slice = + &amf_ue->slice[amf_ue->num_of_slice]; + if (Snssai) { + slice->s_nssai.sst = Snssai->sst; + slice->s_nssai.sd = + ogs_s_nssai_sd_from_string(Snssai->sd); + } + + /* DEFAULT S-NSSAI */ + slice->default_indicator = true; + + amf_ue->num_of_slice++; + } + + SingleNssaiList = NSSAI->single_nssais; + if (SingleNssaiList) { + OpenAPI_list_for_each(SingleNssaiList, node) { + OpenAPI_snssai_t *Snssai = node->data; + + ogs_slice_data_t *slice = + &amf_ue->slice[amf_ue->num_of_slice]; + if (Snssai) { + slice->s_nssai.sst = Snssai->sst; + slice->s_nssai.sd = + ogs_s_nssai_sd_from_string(Snssai->sd); + } + + /* Non default S-NSSAI */ + slice->default_indicator = false; + + amf_ue->num_of_slice++; + } } } } } + if (amf_ue->requested_nssai.num_of_s_nssai) { + amf_ue->allowed_nssai.num_of_s_nssai = 0; + amf_ue->rejected_nssai.num_of_s_nssai = 0; + for (i = 0; i < amf_ue->requested_nssai.num_of_s_nssai; i++) { + ogs_slice_data_t *slice = NULL; + ogs_nas_s_nssai_ie_t *requested = + &amf_ue->requested_nssai.s_nssai[i]; + ogs_nas_s_nssai_ie_t *allowed = + &amf_ue->allowed_nssai. + s_nssai[amf_ue->allowed_nssai.num_of_s_nssai]; + ogs_nas_rejected_s_nssai_t *rejected = + &amf_ue->rejected_nssai. + s_nssai[amf_ue->rejected_nssai.num_of_s_nssai]; + slice = ogs_slice_find_by_s_nssai( + amf_ue->slice, amf_ue->num_of_slice, + (ogs_s_nssai_t *)requested); + if (slice) { + allowed->sst = requested->sst; + allowed->sd.v = requested->sd.v; + allowed->mapped_hplmn_sst = requested->mapped_hplmn_sst; + allowed->mapped_hplmn_sd.v = requested->mapped_hplmn_sd.v; + + amf_ue->allowed_nssai.num_of_s_nssai++; + + } else { + rejected->sst = requested->sst; + rejected->sd.v = requested->sd.v; + + if (rejected->sd.v != OGS_S_NSSAI_NO_SD_VALUE) + rejected->length_of_rejected_s_nssai = 4; + else + rejected->length_of_rejected_s_nssai = 1; + + rejected->cause_value = + OGS_NAS_REJECTED_S_NSSAI_NOT_AVIALABLE_IN_PLMN; + + amf_ue->rejected_nssai.num_of_s_nssai++; + } + + } + + if (amf_ue->allowed_nssai.num_of_s_nssai) { + amf_ue->allowed_nssai_present = true; + } else { + ogs_error("CHECK DATABASE: Cannot find Requested NSSAI"); + for (i = 0; i < amf_ue->requested_nssai.num_of_s_nssai; i++) { + ogs_error(" PLMN_ID[MCC:%d MNC:%d]", + ogs_plmn_id_mcc(&amf_ue->nr_tai.plmn_id), + ogs_plmn_id_mnc(&amf_ue->nr_tai.plmn_id)); + ogs_error(" S_NSSAI[SST:%d SD:0x%x]", + amf_ue->requested_nssai.s_nssai[i].sst, + amf_ue->requested_nssai.s_nssai[i].sd.v); + } + return OGS_ERROR; + } + } + amf_ue_sbi_discover_and_send(OpenAPI_nf_type_UDM, amf_ue, (char *)OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA, amf_nudm_sdm_build_get); break; CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) + if (recvmsg->SmfSelectionSubscriptionData) { + OpenAPI_list_t *SubscribedSnssaiInfoList = NULL; + OpenAPI_map_t *SubscribedSnssaiInfoMap = NULL; + OpenAPI_snssai_info_t *SubscribedSnssaiInfo = NULL; + + OpenAPI_list_t *DnnInfoList = NULL; + OpenAPI_dnn_info_t *DnnInfo = NULL; + + OpenAPI_lnode_t *node = NULL, *node2 = NULL; + + SubscribedSnssaiInfoList = recvmsg-> + SmfSelectionSubscriptionData->subscribed_snssai_infos; + if (SubscribedSnssaiInfoList) { + + OpenAPI_list_for_each(SubscribedSnssaiInfoList, node) { + SubscribedSnssaiInfoMap = node->data; + if (SubscribedSnssaiInfoMap && + SubscribedSnssaiInfoMap->key) { + ogs_slice_data_t *slice = NULL; + ogs_s_nssai_t s_nssai; + + bool rc = ogs_sbi_s_nssai_from_string( + &s_nssai, SubscribedSnssaiInfoMap->key); + if (rc == false) { + ogs_error("Invalid S-NSSAI format [%s]", + SubscribedSnssaiInfoMap->key); + continue; + } + + slice = ogs_slice_find_by_s_nssai( + amf_ue->slice, amf_ue->num_of_slice, + &s_nssai); + if (!slice) { + ogs_error("Cannt find S-NSSAI[SST:%d SD:0x%x]", + s_nssai.sst, s_nssai.sd.v); + continue; + } + + SubscribedSnssaiInfo = SubscribedSnssaiInfoMap->value; + if (SubscribedSnssaiInfo) { + DnnInfoList = SubscribedSnssaiInfo->dnn_infos; + if (DnnInfoList) { + OpenAPI_list_for_each(DnnInfoList, node2) { + DnnInfo = node2->data; + if (DnnInfo) { + ogs_session_t *session = + &slice->session + [slice->num_of_session]; + session->name = + ogs_strdup(DnnInfo->dnn); + ogs_assert(session->name); + session->default_dnn_indicator = + DnnInfo->default_dnn_indicator; + slice->num_of_session++; + } + } + } + } + } + } + } + } amf_ue_sbi_discover_and_send(OpenAPI_nf_type_UDM, amf_ue, (char *)OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA, amf_nudm_sdm_build_get); diff --git a/src/amf/sbi-path.c b/src/amf/sbi-path.c index 1b659e5fd..e80e5e73c 100644 --- a/src/amf/sbi-path.c +++ b/src/amf/sbi-path.c @@ -19,8 +19,7 @@ #include "sbi-path.h" #include "nas-path.h" -#include "nausf-build.h" -#include "nudm-build.h" +#include "nnrf-handler.h" static int server_cb(ogs_sbi_request_t *request, void *data) { @@ -114,6 +113,23 @@ void amf_sbi_close(void) ogs_sbi_server_stop_all(); } +void amf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + request = amf_nnrf_nfm_build_register(nf_instance); + if (!request) { + ogs_error("ogs_nnrf_nfm_send_nf_register() failed"); + return; + } + ogs_sbi_client_send_request(client, client->cb, request, nf_instance); +} + void amf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact) { ogs_sbi_send(nf_instance, client_cb, xact); @@ -178,6 +194,82 @@ void amf_sess_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type, return; } } +static int client_discover_cb(ogs_sbi_response_t *response, void *data) +{ + int rv; + + ogs_sbi_message_t message; + amf_sess_t *sess = data; + + ogs_assert(response); + ogs_assert(sess); + ogs_assert(sess->sbi.type == OGS_SBI_OBJ_SESS_TYPE); + + rv = ogs_sbi_parse_response(&message, response); + if (rv != OGS_OK) { + ogs_error("cannot parse HTTP response"); + nas_5gs_send_back_5gsm_message_from_sbi( + sess, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + + goto cleanup; + } + + if (message.res_status != OGS_SBI_HTTP_STATUS_OK) { + ogs_error("NF-Discover failed [%d]", message.res_status); + nas_5gs_send_back_5gsm_message_from_sbi( + sess, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + + goto cleanup; + } + + if (!message.SearchResult) { + ogs_error("No SearchResult"); + nas_5gs_send_back_5gsm_message_from_sbi( + sess, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + + goto cleanup; + } + + amf_nnrf_handle_nf_discover_search_result( + &sess->sbi, message.SearchResult); + + if (!OGS_SBI_NF_INSTANCE(&sess->sbi, OpenAPI_nf_type_SMF)) { + ogs_error("Cannot discover [%s]", + OpenAPI_nf_type_ToString(OpenAPI_nf_type_SMF)); + nas_5gs_send_back_5gsm_message_from_sbi( + sess, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); + + goto cleanup; + } + + amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF, + sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL, + amf_nsmf_pdusession_build_create_sm_context); + +cleanup: + ogs_sbi_message_free(&message); + ogs_sbi_response_free(response); + + return OGS_ERROR; +} + +void amf_sess_sbi_discover_by_nsi( + OpenAPI_nf_type_e target_nf_type, amf_sess_t *sess) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(target_nf_type); + ogs_assert(sess); + client = sess->nssf.nrf.client; + ogs_assert(client); + + request = amf_nnrf_disc_build_discover( + sess->nssf.nrf.id, target_nf_type, amf_self()->nf_type); + ogs_assert(request); + ogs_sbi_client_send_request( + client, client_discover_cb, request, sess); +} void amf_sbi_send_activating_session(amf_sess_t *sess, int state) { diff --git a/src/amf/sbi-path.h b/src/amf/sbi-path.h index 8f0cc7d56..083165ab3 100644 --- a/src/amf/sbi-path.h +++ b/src/amf/sbi-path.h @@ -24,6 +24,8 @@ #include "nudm-build.h" #include "nsmf-build.h" #include "npcf-build.h" +#include "nnssf-build.h" +#include "nnrf-build.h" #ifdef __cplusplus extern "C" { @@ -32,6 +34,8 @@ extern "C" { int amf_sbi_open(void); void amf_sbi_close(void); +void amf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); + void amf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact); void amf_ue_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type, amf_ue_t *amf_ue, void *data, @@ -62,6 +66,9 @@ void amf_sess_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type, amf_sess_t *sess, int state, void *data, ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data)); +void amf_sess_sbi_discover_by_nsi( + OpenAPI_nf_type_e target_nf_type, amf_sess_t *sess); + void amf_sbi_send_activating_session(amf_sess_t *sess, int state); void amf_sbi_send_deactivate_session( diff --git a/src/ausf/context.c b/src/ausf/context.c index 2f94bf544..4d1ca8045 100644 --- a/src/ausf/context.c +++ b/src/ausf/context.c @@ -222,3 +222,15 @@ ausf_ue_t *ausf_ue_cycle(ausf_ue_t *ausf_ue) { return ogs_pool_cycle(&ausf_ue_pool, ausf_ue); } + +void ausf_ue_select_nf(ausf_ue_t *ausf_ue, OpenAPI_nf_type_e nf_type) +{ + ogs_assert(ausf_ue); + ogs_assert(nf_type); + + if (nf_type == OpenAPI_nf_type_NRF) + ogs_sbi_select_nrf(&ausf_ue->sbi, ausf_nf_state_registered); + else + ogs_sbi_select_first_nf( + &ausf_ue->sbi, nf_type, ausf_nf_state_registered); +} diff --git a/src/ausf/context.h b/src/ausf/context.h index ebd66c589..b7a564826 100644 --- a/src/ausf/context.h +++ b/src/ausf/context.h @@ -99,6 +99,8 @@ ausf_ue_t *ausf_ue_find_by_ctx_id(char *ctx_id); ausf_ue_t *ausf_ue_cycle(ausf_ue_t *ausf_ue); +void ausf_ue_select_nf(ausf_ue_t *ausf_ue, OpenAPI_nf_type_e nf_type); + #ifdef __cplusplus } #endif diff --git a/src/ausf/meson.build b/src/ausf/meson.build index eb7a6fc5e..a96aafaa8 100644 --- a/src/ausf/meson.build +++ b/src/ausf/meson.build @@ -20,6 +20,7 @@ libausf_sources = files(''' event.c timer.c + nnrf-build.c nnrf-handler.c nf-sm.c diff --git a/src/ausf/nf-sm.c b/src/ausf/nf-sm.c index 676649c32..2f6353d63 100644 --- a/src/ausf/nf-sm.c +++ b/src/ausf/nf-sm.c @@ -109,7 +109,7 @@ void ausf_nf_state_will_register(ogs_fsm_t *s, ausf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + ausf_nnrf_nfm_send_nf_register(nf_instance); break; case OGS_FSM_EXIT_SIG: @@ -164,7 +164,7 @@ void ausf_nf_state_will_register(ogs_fsm_t *s, ausf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + ausf_nnrf_nfm_send_nf_register(nf_instance); break; default: diff --git a/src/ausf/nnrf-build.c b/src/ausf/nnrf-build.c new file mode 100644 index 000000000..71dfef97e --- /dev/null +++ b/src/ausf/nnrf-build.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnrf-build.h" + +ogs_sbi_request_t *ausf_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); + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return request; +} diff --git a/src/ausf/nnrf-build.h b/src/ausf/nnrf-build.h new file mode 100644 index 000000000..ae5465ad4 --- /dev/null +++ b/src/ausf/nnrf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AUSF_NNRF_BUILD_H +#define AUSF_NNRF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *ausf_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* AUSF_NNRF_BUILD_H */ diff --git a/src/ausf/nnrf-handler.c b/src/ausf/nnrf-handler.c index 1e1dacc77..814741d51 100644 --- a/src/ausf/nnrf-handler.c +++ b/src/ausf/nnrf-handler.c @@ -285,6 +285,8 @@ void ausf_nnrf_handle_nf_discover( } if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { + ausf_ue_t *ausf_ue = NULL; + handled = ogs_sbi_nnrf_handle_nf_profile( nf_instance, NFProfile, NULL, NULL); if (!handled) { @@ -301,10 +303,9 @@ void ausf_nnrf_handle_nf_discover( continue; } - if (!OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, nf_instance->nf_type)) - ogs_sbi_nf_instance_associate(sbi_object->nf_type_array, - nf_instance->nf_type, ausf_nf_state_registered); + ausf_ue = (ausf_ue_t *)sbi_object; + ogs_assert(ausf_ue); + ausf_ue_select_nf(ausf_ue, nf_instance->nf_type); /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -324,8 +325,7 @@ void ausf_nnrf_handle_nf_discover( } ogs_assert(xact->target_nf_type); - nf_instance = OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, xact->target_nf_type); + nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, xact->target_nf_type); if (!nf_instance) { ogs_error("(NF discover) No [%s]", OpenAPI_nf_type_ToString(xact->target_nf_type)); diff --git a/src/ausf/sbi-path.c b/src/ausf/sbi-path.c index 049d6cf95..6cba335af 100644 --- a/src/ausf/sbi-path.c +++ b/src/ausf/sbi-path.c @@ -112,6 +112,23 @@ void ausf_sbi_close(void) ogs_sbi_server_stop_all(); } +void ausf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + request = ausf_nnrf_nfm_build_register(nf_instance); + if (!request) { + ogs_error("ausf_nnrf_nfm_send_nf_register() failed"); + return; + } + ogs_sbi_client_send_request(client, client->cb, request, nf_instance); +} + void ausf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact) { ogs_sbi_send(nf_instance, client_cb, xact); diff --git a/src/ausf/sbi-path.h b/src/ausf/sbi-path.h index b4273c320..f47a47651 100644 --- a/src/ausf/sbi-path.h +++ b/src/ausf/sbi-path.h @@ -20,6 +20,7 @@ #ifndef AUSF_SBI_PATH_H #define AUSF_SBI_PATH_H +#include "nnrf-build.h" #include "nudm-build.h" #ifdef __cplusplus @@ -29,6 +30,8 @@ extern "C" { int ausf_sbi_open(void); void ausf_sbi_close(void); +void ausf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); + void ausf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact); void ausf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type, ausf_ue_t *ausf_ue, ogs_sbi_stream_t *stream, void *data, diff --git a/src/hss/hss-fd-path.c b/src/hss/hss-fd-path.c index 21fc9ff36..688ff5c92 100644 --- a/src/hss/hss-fd-path.c +++ b/src/hss/hss-fd-path.c @@ -277,17 +277,21 @@ static int hss_ogs_diam_s6a_ulr_cb( struct msg **msg, struct avp *avp, union avp_value val; char imsi_bcd[OGS_MAX_IMSI_BCD_LEN+1]; + ogs_s_nssai_t s_nssai; int rv; uint32_t result_code = 0; ogs_subscription_data_t subscription_data; + ogs_slice_data_t *slice_data = NULL; struct sockaddr_in sin; struct sockaddr_in6 sin6; ogs_assert(msg); ogs_debug("[HSS] Update-Location-Request\n"); - + + memset(&subscription_data, 0, sizeof(ogs_subscription_data_t)); + /* Create answer header */ qry = *msg; ret = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, msg, 0); @@ -348,6 +352,12 @@ static int hss_ogs_diam_s6a_ulr_cb( struct msg **msg, struct avp *avp, struct avp *avp_subscriber_status, *avp_network_access_mode; struct avp *avp_ambr, *avp_max_bandwidth_ul, *avp_max_bandwidth_dl; struct avp *avp_rau_tau_timer; + + /* Set the APN Configuration Profile */ + struct avp *apn_configuration_profile; + struct avp *context_identifier; + struct avp *all_apn_configuration_included_indicator; + int i; /* Set the Subscription Data */ @@ -410,7 +420,7 @@ static int hss_ogs_diam_s6a_ulr_cb( struct msg **msg, struct avp *avp, ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_subscriber_status); ogs_assert(ret == 0); - ret = fd_msg_avp_new(ogs_diam_s6a_network_access_mode, 0, + ret = fd_msg_avp_new(ogs_diam_s6a_network_access_mode, 0, &avp_network_access_mode); ogs_assert(ret == 0); val.i32 = subscription_data.network_access_mode; @@ -453,258 +463,273 @@ static int hss_ogs_diam_s6a_ulr_cb( struct msg **msg, struct avp *avp, ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_rau_tau_timer); ogs_assert(ret == 0); - if (subscription_data.num_of_pdn) { - /* Set the APN Configuration Profile */ - struct avp *apn_configuration_profile; - struct avp *context_identifier; - struct avp *all_apn_configuration_included_indicator; + /* For EPC, we'll use SST:1 */ + s_nssai.sst = 1; + s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE; - ret = fd_msg_avp_new(ogs_diam_s6a_apn_configuration_profile, 0, - &apn_configuration_profile); + slice_data = ogs_slice_find_by_s_nssai( + subscription_data.slice, subscription_data.num_of_slice, + &s_nssai); + if (!slice_data) { + ogs_error("[%s] Cannot find S-NSSAI", imsi_bcd); + result_code = OGS_DIAM_S6A_ERROR_UNKNOWN_EPS_SUBSCRIPTION; + goto out; + } + + if (!slice_data->num_of_session) { + ogs_error("[%s] No PDN", imsi_bcd); + result_code = OGS_DIAM_S6A_ERROR_UNKNOWN_EPS_SUBSCRIPTION; + goto out; + } + + ret = fd_msg_avp_new(ogs_diam_s6a_apn_configuration_profile, 0, + &apn_configuration_profile); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_context_identifier, 0, + &context_identifier); + ogs_assert(ret == 0); + val.i32 = 1; /* Context Identifier : 1 */ + ret = fd_msg_avp_setvalue(context_identifier, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(apn_configuration_profile, + MSG_BRW_LAST_CHILD, context_identifier); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new( + ogs_diam_s6a_all_apn_configuration_included_indicator, 0, + &all_apn_configuration_included_indicator); + ogs_assert(ret == 0); + val.i32 = 0; + ret = fd_msg_avp_setvalue( + all_apn_configuration_included_indicator, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(apn_configuration_profile, MSG_BRW_LAST_CHILD, + all_apn_configuration_included_indicator); + ogs_assert(ret == 0); + + for (i = 0; i < slice_data->num_of_session; i++) { + /* Set the APN Configuration */ + struct avp *apn_configuration, *context_identifier, *pdn_type; + struct avp *served_party_ip_address, *service_selection; + struct avp *eps_subscribed_qos_profile, *qos_class_identifier; + struct avp *allocation_retention_priority, *priority_level; + struct avp *pre_emption_capability, *pre_emption_vulnerability; + struct avp *mip6_agent_info, *mip_home_agent_address; + + ogs_session_t *session = &slice_data->session[i]; + ogs_assert(session); + session->context_identifier = i+1; + + ret = fd_msg_avp_new(ogs_diam_s6a_apn_configuration, 0, + &apn_configuration); ogs_assert(ret == 0); - ret = fd_msg_avp_new(ogs_diam_s6a_context_identifier, 0, + /* Set Context-Identifier */ + ret = fd_msg_avp_new(ogs_diam_s6a_context_identifier, 0, &context_identifier); ogs_assert(ret == 0); - val.i32 = 1; /* Context Identifier : 1 */ + val.i32 = session->context_identifier; ret = fd_msg_avp_setvalue(context_identifier, &val); ogs_assert(ret == 0); - ret = fd_msg_avp_add(apn_configuration_profile, + ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, context_identifier); ogs_assert(ret == 0); - ret = fd_msg_avp_new( - ogs_diam_s6a_all_apn_configuration_included_indicator, 0, - &all_apn_configuration_included_indicator); + /* Set PDN-Type */ + ret = fd_msg_avp_new(ogs_diam_s6a_pdn_type, 0, &pdn_type); ogs_assert(ret == 0); - val.i32 = 0; - ret = fd_msg_avp_setvalue( - all_apn_configuration_included_indicator, &val); + val.i32 = OGS_PDU_SESSION_TYPE_TO_DIAMETER(session->session_type); + ret = fd_msg_avp_setvalue(pdn_type, &val); ogs_assert(ret == 0); - ret = fd_msg_avp_add(apn_configuration_profile, - MSG_BRW_LAST_CHILD, - all_apn_configuration_included_indicator); + ret = fd_msg_avp_add(apn_configuration, + MSG_BRW_LAST_CHILD, pdn_type); ogs_assert(ret == 0); - for (i = 0; i < subscription_data.num_of_pdn; i++) { - /* Set the APN Configuration */ - struct avp *apn_configuration, *context_identifier, *pdn_type; - struct avp *served_party_ip_address, *service_selection; - struct avp *eps_subscribed_qos_profile, *qos_class_identifier; - struct avp *allocation_retention_priority, *priority_level; - struct avp *pre_emption_capability, *pre_emption_vulnerability; - struct avp *mip6_agent_info, *mip_home_agent_address; - - ogs_pdn_t *pdn = &subscription_data.pdn[i]; - ogs_assert(pdn); - pdn->context_identifier = i+1; - - ret = fd_msg_avp_new(ogs_diam_s6a_apn_configuration, 0, - &apn_configuration); + /* Set Served-Party-IP-Address */ + if ((session->session_type == OGS_PDU_SESSION_TYPE_IPV4 || + session->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) && + session->ue_ip.ipv4) { + ret = fd_msg_avp_new(ogs_diam_s6a_served_party_ip_address, + 0, &served_party_ip_address); ogs_assert(ret == 0); - - /* Set Context-Identifier */ - ret = fd_msg_avp_new(ogs_diam_s6a_context_identifier, 0, - &context_identifier); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = session->ue_ip.addr; + ret = fd_msg_avp_value_encode(&sin, served_party_ip_address); ogs_assert(ret == 0); - val.i32 = pdn->context_identifier; - ret = fd_msg_avp_setvalue(context_identifier, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(apn_configuration, - MSG_BRW_LAST_CHILD, context_identifier); - ogs_assert(ret == 0); - - /* Set PDN-Type */ - ret = fd_msg_avp_new(ogs_diam_s6a_pdn_type, 0, &pdn_type); - ogs_assert(ret == 0); - val.i32 = pdn->pdn_type; - ret = fd_msg_avp_setvalue(pdn_type, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(apn_configuration, - MSG_BRW_LAST_CHILD, pdn_type); - ogs_assert(ret == 0); - - /* Set Served-Party-IP-Address */ - if ((pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4 || - pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4V6) && - pdn->ue_ip.ipv4) { - ret = fd_msg_avp_new(ogs_diam_s6a_served_party_ip_address, - 0, &served_party_ip_address); - ogs_assert(ret == 0); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = pdn->ue_ip.addr; - ret = fd_msg_avp_value_encode( - &sin, served_party_ip_address); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, - served_party_ip_address); - ogs_assert(ret == 0); - } - - if ((pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV6 || - pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4V6) && - pdn->ue_ip.ipv6) { - ret = fd_msg_avp_new(ogs_diam_s6a_served_party_ip_address, - 0, &served_party_ip_address); - ogs_assert(ret == 0); - sin6.sin6_family = AF_INET6; - memcpy(sin6.sin6_addr.s6_addr, - pdn->ue_ip.addr6, OGS_IPV6_LEN); - ret = fd_msg_avp_value_encode( - &sin6, served_party_ip_address); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, - served_party_ip_address); - ogs_assert(ret == 0); - } - - /* Set Service-Selection */ - ret = fd_msg_avp_new(ogs_diam_s6a_service_selection, 0, - &service_selection); - ogs_assert(ret == 0); - val.os.data = (uint8_t *)pdn->apn; - val.os.len = strlen(pdn->apn); - ret = fd_msg_avp_setvalue(service_selection, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(apn_configuration, - MSG_BRW_LAST_CHILD, service_selection); - ogs_assert(ret == 0); - - /* Set the EPS Subscribed QoS Profile */ - ret = fd_msg_avp_new(ogs_diam_s6a_eps_subscribed_qos_profile, 0, - &eps_subscribed_qos_profile); - ogs_assert(ret == 0); - - ret = fd_msg_avp_new(ogs_diam_s6a_qos_class_identifier, 0, - &qos_class_identifier); - ogs_assert(ret == 0); - val.i32 = pdn->qos.qci; - ret = fd_msg_avp_setvalue(qos_class_identifier, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(eps_subscribed_qos_profile, - MSG_BRW_LAST_CHILD, qos_class_identifier); - ogs_assert(ret == 0); - - /* Set Allocation retention priority */ - ret = fd_msg_avp_new( - ogs_diam_s6a_allocation_retention_priority, 0, - &allocation_retention_priority); - ogs_assert(ret == 0); - - ret = fd_msg_avp_new( - ogs_diam_s6a_priority_level, 0, &priority_level); - ogs_assert(ret == 0); - val.u32 = pdn->qos.arp.priority_level; - ret = fd_msg_avp_setvalue(priority_level, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(allocation_retention_priority, - MSG_BRW_LAST_CHILD, priority_level); - ogs_assert(ret == 0); - - ret = fd_msg_avp_new(ogs_diam_s6a_pre_emption_capability, 0, - &pre_emption_capability); - ogs_assert(ret == 0); - val.u32 = pdn->qos.arp.pre_emption_capability; - ret = fd_msg_avp_setvalue(pre_emption_capability, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(allocation_retention_priority, - MSG_BRW_LAST_CHILD, pre_emption_capability); - ogs_assert(ret == 0); - - ret = fd_msg_avp_new(ogs_diam_s6a_pre_emption_vulnerability, 0, - &pre_emption_vulnerability); - ogs_assert(ret == 0); - val.u32 = pdn->qos.arp.pre_emption_vulnerability; - ret = fd_msg_avp_setvalue(pre_emption_vulnerability, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(allocation_retention_priority, - MSG_BRW_LAST_CHILD, pre_emption_vulnerability); - ogs_assert(ret == 0); - - ret = fd_msg_avp_add(eps_subscribed_qos_profile, - MSG_BRW_LAST_CHILD, allocation_retention_priority); - ogs_assert(ret == 0); - - ret = fd_msg_avp_add(apn_configuration, - MSG_BRW_LAST_CHILD, eps_subscribed_qos_profile); - ogs_assert(ret == 0); - - /* Set MIP6-Agent-Info */ - if (pdn->pgw_ip.ipv4 || pdn->pgw_ip.ipv6) { - ret = fd_msg_avp_new(ogs_diam_mip6_agent_info, 0, - &mip6_agent_info); - ogs_assert(ret == 0); - - if (pdn->pgw_ip.ipv4) { - ret = fd_msg_avp_new(ogs_diam_mip_home_agent_address, 0, - &mip_home_agent_address); - ogs_assert(ret == 0); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = pdn->pgw_ip.addr; - ret = fd_msg_avp_value_encode ( - &sin, mip_home_agent_address ); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(mip6_agent_info, - MSG_BRW_LAST_CHILD, mip_home_agent_address); - ogs_assert(ret == 0); - } - - if (pdn->pgw_ip.ipv6) { - ret = fd_msg_avp_new(ogs_diam_mip_home_agent_address, 0, - &mip_home_agent_address); - ogs_assert(ret == 0); - sin6.sin6_family = AF_INET6; - memcpy(sin6.sin6_addr.s6_addr, pdn->pgw_ip.addr6, - sizeof pdn->pgw_ip.addr6); - ret = fd_msg_avp_value_encode ( - &sin6, mip_home_agent_address ); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(mip6_agent_info, - MSG_BRW_LAST_CHILD, mip_home_agent_address); - ogs_assert(ret == 0); - } - - ret = fd_msg_avp_add(apn_configuration, - MSG_BRW_LAST_CHILD, mip6_agent_info); - ogs_assert(ret == 0); - } - - /* Set AMBR */ - if (pdn->ambr.downlink || pdn->ambr.uplink) { - ret = fd_msg_avp_new(ogs_diam_s6a_ambr, 0, &avp_ambr); - ogs_assert(ret == 0); - ret = fd_msg_avp_new(ogs_diam_s6a_max_bandwidth_ul, 0, - &avp_max_bandwidth_ul); - ogs_assert(ret == 0); - val.u32 = pdn->ambr.uplink; - ret = fd_msg_avp_setvalue(avp_max_bandwidth_ul, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, - avp_max_bandwidth_ul); - ogs_assert(ret == 0); - ret = fd_msg_avp_new(ogs_diam_s6a_max_bandwidth_dl, 0, - &avp_max_bandwidth_dl); - ogs_assert(ret == 0); - val.u32 = pdn->ambr.downlink; - ret = fd_msg_avp_setvalue(avp_max_bandwidth_dl, &val); - ogs_assert(ret == 0); - ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, - avp_max_bandwidth_dl); - ogs_assert(ret == 0); - - ret = fd_msg_avp_add(apn_configuration, - MSG_BRW_LAST_CHILD, avp_ambr); - ogs_assert(ret == 0); - } - - ret = fd_msg_avp_add(apn_configuration_profile, - MSG_BRW_LAST_CHILD, apn_configuration); + ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, + served_party_ip_address); ogs_assert(ret == 0); } - ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, - apn_configuration_profile); + + if ((session->session_type == OGS_PDU_SESSION_TYPE_IPV6 || + session->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) && + session->ue_ip.ipv6) { + ret = fd_msg_avp_new(ogs_diam_s6a_served_party_ip_address, + 0, &served_party_ip_address); + ogs_assert(ret == 0); + sin6.sin6_family = AF_INET6; + memcpy(sin6.sin6_addr.s6_addr, + session->ue_ip.addr6, OGS_IPV6_LEN); + ret = fd_msg_avp_value_encode(&sin6, served_party_ip_address); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(apn_configuration, MSG_BRW_LAST_CHILD, + served_party_ip_address); + ogs_assert(ret == 0); + } + + /* Set Service-Selection */ + ret = fd_msg_avp_new(ogs_diam_s6a_service_selection, 0, + &service_selection); + ogs_assert(ret == 0); + ogs_assert(session->name); + val.os.data = (uint8_t *)session->name; + val.os.len = strlen(session->name); + ret = fd_msg_avp_setvalue(service_selection, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(apn_configuration, + MSG_BRW_LAST_CHILD, service_selection); + ogs_assert(ret == 0); + + /* Set the EPS Subscribed QoS Profile */ + ret = fd_msg_avp_new(ogs_diam_s6a_eps_subscribed_qos_profile, 0, + &eps_subscribed_qos_profile); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_qos_class_identifier, 0, + &qos_class_identifier); + ogs_assert(ret == 0); + val.i32 = session->qos.index; + ret = fd_msg_avp_setvalue(qos_class_identifier, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(eps_subscribed_qos_profile, + MSG_BRW_LAST_CHILD, qos_class_identifier); + ogs_assert(ret == 0); + + /* Set Allocation retention priority */ + ret = fd_msg_avp_new(ogs_diam_s6a_allocation_retention_priority, 0, + &allocation_retention_priority); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new( + ogs_diam_s6a_priority_level, 0, &priority_level); + ogs_assert(ret == 0); + val.u32 = session->qos.arp.priority_level; + ret = fd_msg_avp_setvalue(priority_level, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(allocation_retention_priority, + MSG_BRW_LAST_CHILD, priority_level); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_pre_emption_capability, 0, + &pre_emption_capability); + ogs_assert(ret == 0); + val.u32 = OGS_EPC_PRE_EMPTION_DISABLED; + if (session->qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_ENABLED) + val.u32 = OGS_EPC_PRE_EMPTION_ENABLED; + ret = fd_msg_avp_setvalue(pre_emption_capability, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(allocation_retention_priority, + MSG_BRW_LAST_CHILD, pre_emption_capability); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_pre_emption_vulnerability, 0, + &pre_emption_vulnerability); + ogs_assert(ret == 0); + val.u32 = OGS_EPC_PRE_EMPTION_DISABLED; + if (session->qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_ENABLED) + val.u32 = OGS_EPC_PRE_EMPTION_ENABLED; + ret = fd_msg_avp_setvalue(pre_emption_vulnerability, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(allocation_retention_priority, + MSG_BRW_LAST_CHILD, pre_emption_vulnerability); + ogs_assert(ret == 0); + + ret = fd_msg_avp_add(eps_subscribed_qos_profile, + MSG_BRW_LAST_CHILD, allocation_retention_priority); + ogs_assert(ret == 0); + + ret = fd_msg_avp_add(apn_configuration, + MSG_BRW_LAST_CHILD, eps_subscribed_qos_profile); + ogs_assert(ret == 0); + + /* Set MIP6-Agent-Info */ + if (session->smf_ip.ipv4 || session->smf_ip.ipv6) { + ret = fd_msg_avp_new(ogs_diam_mip6_agent_info, 0, + &mip6_agent_info); + ogs_assert(ret == 0); + + if (session->smf_ip.ipv4) { + ret = fd_msg_avp_new(ogs_diam_mip_home_agent_address, 0, + &mip_home_agent_address); + ogs_assert(ret == 0); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = session->smf_ip.addr; + ret = fd_msg_avp_value_encode ( + &sin, mip_home_agent_address ); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(mip6_agent_info, + MSG_BRW_LAST_CHILD, mip_home_agent_address); + ogs_assert(ret == 0); + } + + if (session->smf_ip.ipv6) { + ret = fd_msg_avp_new(ogs_diam_mip_home_agent_address, 0, + &mip_home_agent_address); + ogs_assert(ret == 0); + sin6.sin6_family = AF_INET6; + memcpy(sin6.sin6_addr.s6_addr, session->smf_ip.addr6, + sizeof session->smf_ip.addr6); + ret = fd_msg_avp_value_encode ( + &sin6, mip_home_agent_address ); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(mip6_agent_info, + MSG_BRW_LAST_CHILD, mip_home_agent_address); + ogs_assert(ret == 0); + } + + ret = fd_msg_avp_add(apn_configuration, + MSG_BRW_LAST_CHILD, mip6_agent_info); + ogs_assert(ret == 0); + } + + /* Set AMBR */ + if (session->ambr.downlink || session->ambr.uplink) { + ret = fd_msg_avp_new(ogs_diam_s6a_ambr, 0, &avp_ambr); + ogs_assert(ret == 0); + ret = fd_msg_avp_new(ogs_diam_s6a_max_bandwidth_ul, 0, + &avp_max_bandwidth_ul); + ogs_assert(ret == 0); + val.u32 = session->ambr.uplink; + ret = fd_msg_avp_setvalue(avp_max_bandwidth_ul, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, + avp_max_bandwidth_ul); + ogs_assert(ret == 0); + ret = fd_msg_avp_new(ogs_diam_s6a_max_bandwidth_dl, 0, + &avp_max_bandwidth_dl); + ogs_assert(ret == 0); + val.u32 = session->ambr.downlink; + ret = fd_msg_avp_setvalue(avp_max_bandwidth_dl, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add(avp_ambr, MSG_BRW_LAST_CHILD, + avp_max_bandwidth_dl); + ogs_assert(ret == 0); + + ret = fd_msg_avp_add(apn_configuration, + MSG_BRW_LAST_CHILD, avp_ambr); + ogs_assert(ret == 0); + } + + ret = fd_msg_avp_add(apn_configuration_profile, + MSG_BRW_LAST_CHILD, apn_configuration); ogs_assert(ret == 0); } + ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, + apn_configuration_profile); + ogs_assert(ret == 0); ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); ogs_assert(ret == 0); @@ -726,6 +751,8 @@ static int hss_ogs_diam_s6a_ulr_cb( struct msg **msg, struct avp *avp, ogs_diam_logger_self()->stats.nb_echoed++; ogs_assert( pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + ogs_subscription_data_free(&subscription_data); + return 0; out: @@ -749,6 +776,8 @@ out: ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); + ogs_subscription_data_free(&subscription_data); + return 0; } diff --git a/src/meson.build b/src/meson.build index a69b462ce..3d6a6a8b3 100644 --- a/src/meson.build +++ b/src/meson.build @@ -39,6 +39,7 @@ subdir('nrf') subdir('udr') subdir('udm') subdir('pcf') +subdir('nssf') subdir('ausf') subdir('upf') subdir('smf') diff --git a/src/mme/esm-build.c b/src/mme/esm-build.c index fd47203aa..e8186fb5c 100644 --- a/src/mme/esm-build.c +++ b/src/mme/esm-build.c @@ -112,13 +112,14 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( mme_ue_t *mme_ue = NULL; mme_bearer_t *bearer = NULL; - ogs_pdn_t *pdn = NULL; + ogs_session_t *session = NULL; ogs_assert(sess); mme_ue = sess->mme_ue; ogs_assert(mme_ue); - pdn = sess->pdn; - ogs_assert(pdn); + session = sess->session; + ogs_assert(session); + ogs_assert(session->name); bearer = mme_default_bearer_in_sess(sess); ogs_assert(bearer); ogs_assert(mme_bearer_next(bearer) == NULL); @@ -139,16 +140,16 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( message.esm.h.message_type = OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST; - memcpy(&bearer->qos, &pdn->qos, sizeof(ogs_qos_t)); + memcpy(&bearer->qos, &session->qos, sizeof(ogs_qos_t)); - eps_qos_build(eps_qos, bearer->qos.qci, + eps_qos_build(eps_qos, bearer->qos.index, bearer->qos.mbr.downlink, bearer->qos.mbr.uplink, bearer->qos.gbr.downlink, bearer->qos.gbr.uplink); - access_point_name->length = strlen(pdn->apn); - ogs_cpystrn(access_point_name->apn, pdn->apn, + access_point_name->length = strlen(session->name); + ogs_cpystrn(access_point_name->apn, session->name, ogs_min(access_point_name->length, OGS_MAX_APN_LEN) + 1); - ogs_debug(" APN[%s]", pdn->apn); + ogs_debug(" APN[%s]", session->name); /* * In TS24.301 V15.6.0 @@ -164,32 +165,32 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( * included in the ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message. */ - pdn_address->pdn_type = pdn->paa.pdn_type; + pdn_address->pdn_type = session->paa.session_type; if (sess->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV4V6) { - if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { - pdn_address->pdn_type = OGS_GTP_PDN_TYPE_IPV4; + if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV4) { + pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV4; activate_default_eps_bearer_context_request->esm_cause = ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; - } else if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { - pdn_address->pdn_type = OGS_GTP_PDN_TYPE_IPV6; + } else if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV6) { + pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV6; activate_default_eps_bearer_context_request->esm_cause = ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; } - } else if (sess->request_type.type == OGS_GTP_PDN_TYPE_IPV4) { - if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { - pdn_address->pdn_type = OGS_GTP_PDN_TYPE_IPV6; + } else if (sess->request_type.type == OGS_PDU_SESSION_TYPE_IPV4) { + if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV6) { + pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV6; activate_default_eps_bearer_context_request->esm_cause = ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; } - } else if (sess->request_type.type == OGS_GTP_PDN_TYPE_IPV6) { - if (pdn->paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { - pdn_address->pdn_type = OGS_GTP_PDN_TYPE_IPV4; + } else if (sess->request_type.type == OGS_PDU_SESSION_TYPE_IPV6) { + if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV4) { + pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV4; activate_default_eps_bearer_context_request->esm_cause = ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= @@ -197,19 +198,19 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( } } - if (pdn_address->pdn_type == OGS_GTP_PDN_TYPE_IPV4) { - pdn_address->addr = pdn->paa.addr; + if (pdn_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV4) { + pdn_address->addr = session->paa.addr; pdn_address->length = OGS_NAS_PDU_ADDRESS_IPV4_LEN; ogs_debug(" IPv4"); - } else if (pdn_address->pdn_type == OGS_GTP_PDN_TYPE_IPV6) { + } else if (pdn_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV6) { memcpy(pdn_address->addr6, - pdn->paa.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); + session->paa.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); pdn_address->length = OGS_NAS_PDU_ADDRESS_IPV6_LEN; ogs_debug(" IPv6"); - } else if (pdn_address->pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { - pdn_address->both.addr = pdn->paa.both.addr; + } else if (pdn_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV4V6) { + pdn_address->both.addr = session->paa.both.addr; memcpy(pdn_address->both.addr6, - pdn->paa.both.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); + session->paa.both.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); pdn_address->length = OGS_NAS_PDU_ADDRESS_IPV4V6_LEN; ogs_debug(" IPv4v6"); } else { @@ -217,10 +218,10 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( ogs_assert_if_reached(); } - if (pdn->ambr.downlink || pdn->ambr.uplink) { + if (session->ambr.downlink || session->ambr.uplink) { activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APN_AMBR_PRESENT; - apn_ambr_build(apn_ambr, pdn->ambr.downlink, pdn->ambr.uplink); + apn_ambr_build(apn_ambr, session->ambr.downlink, session->ambr.uplink); } if (sess->pgw_pco.presence && sess->pgw_pco.len && sess->pgw_pco.data) { @@ -285,7 +286,7 @@ ogs_pkbuf_t *esm_build_activate_dedicated_bearer_context_request( OGS_NAS_EPS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST; linked_ebi->eps_bearer_identity = linked_bearer->ebi; - eps_qos_build(eps_qos, bearer->qos.qci, + eps_qos_build(eps_qos, bearer->qos.index, bearer->qos.mbr.downlink, bearer->qos.mbr.uplink, bearer->qos.gbr.downlink, bearer->qos.gbr.uplink); @@ -334,7 +335,7 @@ ogs_pkbuf_t *esm_build_modify_bearer_context_request( if (qos_presence == 1) { modify_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT; - eps_qos_build(new_eps_qos, bearer->qos.qci, + eps_qos_build(new_eps_qos, bearer->qos.index, bearer->qos.mbr.downlink, bearer->qos.mbr.uplink, bearer->qos.gbr.downlink, bearer->qos.gbr.uplink); } diff --git a/src/mme/esm-handler.c b/src/mme/esm-handler.c index e6914666b..0949dcfd8 100644 --- a/src/mme/esm-handler.c +++ b/src/mme/esm-handler.c @@ -61,8 +61,9 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, if (req->presencemask & OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) { - sess->pdn = mme_pdn_find_by_apn(mme_ue, req->access_point_name.apn); - if (!sess->pdn) { + sess->session = mme_session_find_by_apn( + mme_ue, req->access_point_name.apn); + if (!sess->session) { /* Invalid APN */ nas_eps_send_pdn_connectivity_reject( sess, ESM_CAUSE_MISSING_OR_UNKNOWN_APN); @@ -87,16 +88,17 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, return OGS_OK; } - if (!sess->pdn) { + if (!sess->session) { /* Default APN */ - sess->pdn = mme_default_pdn(mme_ue); + sess->session = mme_default_session(mme_ue); } - if (sess->pdn) { + if (sess->session) { mme_bearer_t *default_bearer = NULL; mme_bearer_t *dedicated_bearer = NULL, *next_dedicated_bearer = NULL; - ogs_debug(" APN[%s]", sess->pdn->apn); + ogs_assert(sess->session->name); + ogs_debug(" APN[%s]", sess->session->name); default_bearer = mme_default_bearer_in_sess(sess); if (default_bearer) { @@ -136,7 +138,8 @@ int esm_handle_information_response(mme_sess_t *sess, if (rsp->presencemask & OGS_NAS_EPS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT) { - sess->pdn = mme_pdn_find_by_apn(mme_ue, rsp->access_point_name.apn); + sess->session = mme_session_find_by_apn( + mme_ue, rsp->access_point_name.apn); } if (rsp->presencemask & @@ -147,11 +150,12 @@ int esm_handle_information_response(mme_sess_t *sess, OGS_NAS_STORE_DATA(&sess->ue_pco, protocol_configuration_options); } - if (sess->pdn) { - ogs_debug(" APN[%s]", sess->pdn->apn); + if (sess->session) { + ogs_assert(sess->session->name); + ogs_debug(" APN[%s]", sess->session->name); if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue) && - OGS_GTP_PDN_TYPE_IS_VALID(sess->pdn->paa.pdn_type)) { + OGS_PDU_SESSION_TYPE_IS_VALID(sess->session->paa.session_type)) { mme_csmap_t *csmap = mme_csmap_find_by_tai(&mme_ue->tai); mme_ue->csmap = csmap; diff --git a/src/mme/mme-context.c b/src/mme/mme-context.c index 451994def..a76dc006a 100644 --- a/src/mme/mme-context.c +++ b/src/mme/mme-context.c @@ -468,7 +468,7 @@ int mme_context_parse_config() 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 ( @@ -579,7 +579,7 @@ int mme_context_parse_config() 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 ( @@ -638,7 +638,7 @@ int mme_context_parse_config() ogs_yaml_iter_recurse(&mme_iter, &gummei_array); do { served_gummei_t *gummei = NULL; - ogs_assert(self.max_num_of_served_gummei <= + ogs_assert(self.max_num_of_served_gummei < MAX_NUM_OF_SERVED_GUMMEI); gummei = &self.served_gummei[ self.max_num_of_served_gummei]; @@ -671,7 +671,7 @@ int mme_context_parse_config() do { ogs_plmn_id_t *plmn_id = NULL; const char *mcc = NULL, *mnc = NULL; - ogs_assert(gummei->num_of_plmn_id <= + ogs_assert(gummei->num_of_plmn_id < OGS_MAX_NUM_OF_PLMN); plmn_id = &gummei->plmn_id[ gummei->num_of_plmn_id]; @@ -729,7 +729,7 @@ int mme_context_parse_config() uint16_t *mme_gid = NULL; const char *v = NULL; - ogs_assert(gummei->num_of_mme_gid <= + ogs_assert(gummei->num_of_mme_gid < GRP_PER_MME); mme_gid = &gummei->mme_gid[ gummei->num_of_mme_gid]; @@ -760,7 +760,7 @@ int mme_context_parse_config() uint8_t *mme_code = NULL; const char *v = NULL; - ogs_assert(gummei->num_of_mme_code <= + ogs_assert(gummei->num_of_mme_code < CODE_PER_MME); mme_code = &gummei->mme_code[ gummei->num_of_mme_code]; @@ -804,7 +804,7 @@ int mme_context_parse_config() ogs_eps_tai0_list_t *list0 = NULL; ogs_eps_tai2_list_t *list2 = NULL; - ogs_assert(self.num_of_served_tai <= + ogs_assert(self.num_of_served_tai < OGS_MAX_NUM_OF_SERVED_TAI); list0 = &self.served_tai[self.num_of_served_tai].list0; ogs_assert(list0); @@ -862,7 +862,7 @@ int mme_context_parse_config() 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) { @@ -1119,7 +1119,7 @@ int mme_context_parse_config() break; } - ogs_assert(hostname_num <= + ogs_assert(hostname_num < OGS_MAX_NUM_OF_HOSTNAME); hostname[hostname_num++] = ogs_yaml_iter_value(&hostname_iter); @@ -1364,9 +1364,9 @@ int mme_context_parse_config() ogs_yaml_iter_t sgw_iter; ogs_yaml_iter_recurse(&root_iter, &sgw_iter); while (ogs_yaml_iter_next(&sgw_iter)) { - const char *mme_key = ogs_yaml_iter_key(&sgw_iter); - ogs_assert(mme_key); - if (!strcmp(mme_key, "gtpc")) { + const char *sgw_key = ogs_yaml_iter_key(&sgw_iter); + ogs_assert(sgw_key); + if (!strcmp(sgw_key, "gtpc")) { ogs_yaml_iter_t gtpc_array, gtpc_iter; ogs_yaml_iter_recurse(&sgw_iter, >pc_array); do { @@ -1426,7 +1426,7 @@ int mme_context_parse_config() 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 ( @@ -1444,7 +1444,7 @@ int mme_context_parse_config() 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) { @@ -1470,7 +1470,7 @@ int mme_context_parse_config() do { const char *v = NULL; - ogs_assert(num_of_e_cell_id <= + ogs_assert(num_of_e_cell_id < OGS_MAX_NUM_OF_CELL_ID); if (ogs_yaml_iter_type(&e_cell_id_iter) == YAML_SEQUENCE_NODE) { @@ -1525,9 +1525,9 @@ int mme_context_parse_config() ogs_yaml_iter_t pgw_iter; ogs_yaml_iter_recurse(&root_iter, &pgw_iter); while (ogs_yaml_iter_next(&pgw_iter)) { - const char *mme_key = ogs_yaml_iter_key(&pgw_iter); - ogs_assert(mme_key); - if (!strcmp(mme_key, "gtpc")) { + const char *pgw_key = ogs_yaml_iter_key(&pgw_iter); + ogs_assert(pgw_key); + if (!strcmp(pgw_key, "gtpc")) { ogs_yaml_iter_t gtpc_array, gtpc_iter; ogs_yaml_iter_recurse(&pgw_iter, >pc_array); do { @@ -1584,7 +1584,7 @@ int mme_context_parse_config() 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 ( @@ -2286,7 +2286,7 @@ void mme_ue_remove(mme_ue_t *mme_ue) mme_ue_deassociate(mme_ue); mme_sess_remove_all(mme_ue); - mme_pdn_remove_all(mme_ue); + mme_session_remove_all(mme_ue); mme_ebi_pool_final(mme_ue); @@ -2743,7 +2743,8 @@ mme_sess_t *mme_sess_find_by_apn(mme_ue_t *mme_ue, char *apn) sess = mme_sess_first(mme_ue); while (sess) { - if (sess->pdn && ogs_strcasecmp(sess->pdn->apn, apn) == 0) + ogs_assert(sess->session->name); + if (sess->session && ogs_strcasecmp(sess->session->name, apn) == 0) return sess; sess = mme_sess_next(sess); @@ -3075,52 +3076,49 @@ mme_bearer_t *mme_bearer_cycle(mme_bearer_t *bearer) return ogs_pool_cycle(&mme_bearer_pool, bearer); } -void mme_pdn_remove_all(mme_ue_t *mme_ue) +void mme_session_remove_all(mme_ue_t *mme_ue) { - ogs_subscription_data_t *subscription_data = NULL; + int i; ogs_assert(mme_ue); - subscription_data = &mme_ue->subscription_data; - ogs_assert(subscription_data); - subscription_data->num_of_pdn = 0; + for (i = 0; i < mme_ue->num_of_session; i++) { + if (mme_ue->session[i].name) + ogs_free(mme_ue->session[i].name); + } + + mme_ue->num_of_session = 0; } -ogs_pdn_t *mme_pdn_find_by_apn(mme_ue_t *mme_ue, char *apn) +ogs_session_t *mme_session_find_by_apn(mme_ue_t *mme_ue, char *apn) { - ogs_subscription_data_t *subscription_data = NULL; - ogs_pdn_t *pdn = NULL; + ogs_session_t *session = NULL; int i = 0; ogs_assert(mme_ue); ogs_assert(apn); - subscription_data = &mme_ue->subscription_data; - ogs_assert(subscription_data); - - for (i = 0; i < subscription_data->num_of_pdn; i++) { - pdn = &subscription_data->pdn[i]; - if (ogs_strcasecmp(pdn->apn, apn) == 0) - return pdn; + for (i = 0; i < mme_ue->num_of_session; i++) { + session = &mme_ue->session[i]; + ogs_assert(session->name); + if (ogs_strcasecmp(session->name, apn) == 0) + return session; } return NULL; } -ogs_pdn_t *mme_default_pdn(mme_ue_t *mme_ue) +ogs_session_t *mme_default_session(mme_ue_t *mme_ue) { - ogs_subscription_data_t *subscription_data = NULL; - ogs_pdn_t *pdn = NULL; + ogs_session_t *session = NULL; int i = 0; ogs_assert(mme_ue); - subscription_data = &mme_ue->subscription_data; - ogs_assert(subscription_data); - for (i = 0; i < subscription_data->num_of_pdn; i++) { - pdn = &subscription_data->pdn[i]; - if (pdn->context_identifier == subscription_data->context_identifier) - return pdn; + for (i = 0; i < mme_ue->num_of_session; i++) { + session = &mme_ue->session[i]; + if (session->context_identifier == mme_ue->context_identifier) + return session; } return NULL; diff --git a/src/mme/mme-context.h b/src/mme/mme-context.h index c39d5b049..43c057788 100644 --- a/src/mme/mme-context.h +++ b/src/mme/mme-context.h @@ -395,7 +395,12 @@ struct mme_ue_s { uint8_t selected_int_algorithm; /* HSS Info */ - ogs_subscription_data_t subscription_data; + ogs_bitrate_t ambr; /* UE-AMBR */ + + uint32_t context_identifier; /* default APN */ + + int num_of_session; + ogs_session_t session[OGS_MAX_NUM_OF_SESS]; /* ESM Info */ ogs_list_t sess_list; @@ -537,9 +542,9 @@ typedef struct mme_sess_s { ogs_list_t bearer_list; /* Related Context */ - mme_ue_t *mme_ue; + mme_ue_t *mme_ue; - ogs_pdn_t *pdn; + ogs_session_t *session; /* Save Protocol Configuration Options from UE */ struct { @@ -789,9 +794,9 @@ mme_bearer_t *mme_bearer_first(mme_sess_t *sess); mme_bearer_t *mme_bearer_next(mme_bearer_t *bearer); mme_bearer_t *mme_bearer_cycle(mme_bearer_t *bearer); -void mme_pdn_remove_all(mme_ue_t *mme_ue); -ogs_pdn_t *mme_pdn_find_by_apn(mme_ue_t *mme_ue, char *apn); -ogs_pdn_t *mme_default_pdn(mme_ue_t *mme_ue); +void mme_session_remove_all(mme_ue_t *mme_ue); +ogs_session_t *mme_session_find_by_apn(mme_ue_t *mme_ue, char *apn); +ogs_session_t *mme_default_session(mme_ue_t *mme_ue); int mme_find_served_tai(ogs_eps_tai_t *tai); diff --git a/src/mme/mme-fd-path.c b/src/mme/mme-fd-path.c index 54f5f8808..1bd165a11 100644 --- a/src/mme/mme-fd-path.c +++ b/src/mme/mme-fd-path.c @@ -814,31 +814,35 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) ogs_diam_s6a_apn_configuration_profile, &avpch1); ogs_assert(ret == 0); if (avpch1) { + ogs_slice_data_t *slice_data = NULL; + ret = fd_msg_browse(avpch1, MSG_BRW_FIRST_CHILD, &avpch2, NULL); ogs_assert(ret == 0); + + ogs_assert(subscription_data->num_of_slice == 0); + slice_data = &subscription_data->slice[0]; while (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); ogs_assert(ret == 0); switch(hdr->avp_code) { case OGS_DIAM_S6A_AVP_CODE_CONTEXT_IDENTIFIER: - subscription_data->context_identifier = - hdr->avp_value->i32; + slice_data->context_identifier = hdr->avp_value->i32; break; case OGS_DIAM_S6A_AVP_CODE_ALL_APN_CONFIG_INC_IND: break; case OGS_DIAM_S6A_AVP_CODE_APN_CONFIGURATION: { - ogs_pdn_t *pdn = &subscription_data->pdn[ - subscription_data->num_of_pdn]; - ogs_assert(pdn); + ogs_session_t *session = + &slice_data->session[slice_data->num_of_session]; + ogs_assert(session); ret = fd_avp_search_avp( avpch2, ogs_diam_s6a_service_selection, &avpch3); ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - ogs_cpystrn(pdn->apn, - (char*)hdr->avp_value->os.data, - ogs_min(hdr->avp_value->os.len, OGS_MAX_APN_LEN)+1); + session->name = ogs_strndup( + (char*)hdr->avp_value->os.data, + hdr->avp_value->os.len); } else { ogs_error("no_Service-Selection"); error++; @@ -849,7 +853,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - pdn->context_identifier = hdr->avp_value->i32; + session->context_identifier = hdr->avp_value->i32; } else { ogs_error("no_Context-Identifier"); error++; @@ -860,7 +864,9 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) ogs_assert(ret == 0); if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); - pdn->pdn_type = hdr->avp_value->i32; + session->session_type = + OGS_PDU_SESSION_TYPE_FROM_DIAMETER( + hdr->avp_value->i32); } else { ogs_error("no_PDN-Type"); error++; @@ -879,11 +885,13 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) ogs_assert(ret == 0); if (addr.ogs_sa_family == AF_INET) { - if (pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4) { - pdn->paa.addr = addr.sin.sin_addr.s_addr; - } else if (pdn->pdn_type == - OGS_DIAM_PDN_TYPE_IPV4V6) { - pdn->paa.both.addr = + if (session->session_type == + OGS_PDU_SESSION_TYPE_IPV4) { + session->paa.addr = + addr.sin.sin_addr.s_addr; + } else if (session->session_type == + OGS_PDU_SESSION_TYPE_IPV4V6) { + session->paa.both.addr = addr.sin.sin_addr.s_addr; } else { ogs_error("Warning: Received a static IPv4 " @@ -891,13 +899,14 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) "IPv4. Ignoring..."); } } else if (addr.ogs_sa_family == AF_INET6) { - if (pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV6) { - memcpy(pdn->paa.addr6, + if (session->session_type == + OGS_PDU_SESSION_TYPE_IPV6) { + memcpy(session->paa.addr6, addr.sin6.sin6_addr.s6_addr, OGS_IPV6_LEN); - } else if (pdn->pdn_type == - OGS_DIAM_PDN_TYPE_IPV4V6) { - memcpy(pdn->paa.both.addr6, + } else if (session->session_type == + OGS_PDU_SESSION_TYPE_IPV4V6) { + memcpy(session->paa.both.addr6, addr.sin6.sin6_addr.s6_addr, OGS_IPV6_LEN); } else { @@ -926,7 +935,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); ogs_assert(ret == 0); - pdn->qos.qci = hdr->avp_value->i32; + session->qos.index = hdr->avp_value->i32; } else { ogs_error("no_QoS-Class-Identifier"); error++; @@ -943,7 +952,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) if (avpch5) { ret = fd_msg_avp_hdr(avpch5, &hdr); ogs_assert(ret == 0); - pdn->qos.arp.priority_level = + session->qos.arp.priority_level = hdr->avp_value->i32; } else { @@ -957,11 +966,11 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) if (avpch5) { ret = fd_msg_avp_hdr(avpch5, &hdr); ogs_assert(ret == 0); - pdn->qos.arp.pre_emption_capability = + session->qos.arp.pre_emption_capability = hdr->avp_value->i32; } else { - pdn->qos.arp.pre_emption_capability = - OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED; + session->qos.arp.pre_emption_capability = + OGS_EPC_PRE_EMPTION_DISABLED; } ret = fd_avp_search_avp(avpch4, @@ -971,11 +980,11 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) if (avpch5) { ret = fd_msg_avp_hdr(avpch5, &hdr); ogs_assert(ret == 0); - pdn->qos.arp.pre_emption_vulnerability = + session->qos.arp.pre_emption_vulnerability = hdr->avp_value->i32; } else { - pdn->qos.arp.pre_emption_vulnerability = - OGS_PDN_PRE_EMPTION_VULNERABILITY_ENABLED; + session->qos.arp.pre_emption_vulnerability = + OGS_EPC_PRE_EMPTION_ENABLED; } } else { @@ -1003,14 +1012,14 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) ogs_assert(ret == 0); if (addr.ogs_sa_family == AF_INET) { - pdn->pgw_ip.ipv4 = 1; - pdn->pgw_ip.addr = + session->smf_ip.ipv4 = 1; + session->smf_ip.addr = addr.sin.sin_addr.s_addr; } else if (addr.ogs_sa_family == AF_INET6) { - pdn->pgw_ip.ipv6 = 1; - memcpy(pdn->pgw_ip.addr6, + session->smf_ip.ipv6 = 1; + memcpy(session->smf_ip.addr6, addr.sin6.sin6_addr.s6_addr, OGS_IPV6_LEN); } @@ -1041,7 +1050,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); ogs_assert(ret == 0); - pdn->ambr.uplink = hdr->avp_value->u32; + session->ambr.uplink = hdr->avp_value->u32; } else { ogs_error("no_Max-Bandwidth-UL"); error++; @@ -1053,14 +1062,14 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) if (avpch4) { ret = fd_msg_avp_hdr(avpch4, &hdr); ogs_assert(ret == 0); - pdn->ambr.downlink = hdr->avp_value->u32; + session->ambr.downlink = hdr->avp_value->u32; } else { ogs_error("no_Max-Bandwidth-DL"); error++; } } - subscription_data->num_of_pdn++; + slice_data->num_of_session++; break; } default: @@ -1070,6 +1079,9 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) fd_msg_browse(avpch2, MSG_BRW_NEXT, &avpch2, NULL); } + + if (slice_data->num_of_session) + subscription_data->num_of_slice = 1; } else { ogs_error("no_APN-Configuration-Profile"); error++; @@ -1088,11 +1100,15 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg) rv = ogs_queue_push(ogs_app()->queue, e); if (rv != OGS_OK) { ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_subscription_data_free(subscription_data); ogs_pkbuf_free(e->pkbuf); mme_event_free(e); } else { ogs_pollset_notify(ogs_app()->pollset); } + } else { + ogs_subscription_data_free(subscription_data); + ogs_pkbuf_free(s6abuf); } /* Free the message */ diff --git a/src/mme/mme-s11-build.c b/src/mme/mme-s11-build.c index b642f6a98..d22b5515b 100644 --- a/src/mme/mme-s11-build.c +++ b/src/mme/mme-s11-build.c @@ -25,7 +25,7 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( uint8_t type, mme_sess_t *sess) { int rv; - ogs_pdn_t *pdn = NULL; + ogs_session_t *session = NULL; mme_ue_t *mme_ue = NULL; mme_bearer_t *bearer = NULL; ogs_gtp_message_t gtp_message; @@ -44,8 +44,9 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( char apn[OGS_MAX_APN_LEN]; ogs_assert(sess); - pdn = sess->pdn; - ogs_assert(pdn); + session = sess->session; + ogs_assert(session); + ogs_assert(session->name); bearer = mme_default_bearer_in_sess(sess); ogs_assert(bearer); mme_ue = sess->mme_ue; @@ -104,22 +105,22 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( memset(&pgw_s5c_teid, 0, sizeof(ogs_gtp_f_teid_t)); pgw_s5c_teid.interface_type = OGS_GTP_F_TEID_S5_S8_PGW_GTP_C; - if (pdn->pgw_ip.ipv4 || pdn->pgw_ip.ipv6) { - pgw_s5c_teid.ipv4 = pdn->pgw_ip.ipv4; - pgw_s5c_teid.ipv6 = pdn->pgw_ip.ipv6; + if (session->smf_ip.ipv4 || session->smf_ip.ipv6) { + pgw_s5c_teid.ipv4 = session->smf_ip.ipv4; + pgw_s5c_teid.ipv6 = session->smf_ip.ipv6; if (pgw_s5c_teid.ipv4 && pgw_s5c_teid.ipv6) { - pgw_s5c_teid.both.addr = pdn->pgw_ip.addr; - memcpy(pgw_s5c_teid.both.addr6, pdn->pgw_ip.addr6, - sizeof pdn->pgw_ip.addr6); + pgw_s5c_teid.both.addr = session->smf_ip.addr; + memcpy(pgw_s5c_teid.both.addr6, session->smf_ip.addr6, + sizeof session->smf_ip.addr6); req->pgw_s5_s8_address_for_control_plane_or_pmip.len = OGS_GTP_F_TEID_IPV4V6_LEN; } else if (pgw_s5c_teid.ipv4) { - pgw_s5c_teid.addr = pdn->pgw_ip.addr; + pgw_s5c_teid.addr = session->smf_ip.addr; req->pgw_s5_s8_address_for_control_plane_or_pmip.len = OGS_GTP_F_TEID_IPV4_LEN; } else if (pgw_s5c_teid.ipv6) { - memcpy(pgw_s5c_teid.addr6, pdn->pgw_ip.addr6, - sizeof pdn->pgw_ip.addr6); + memcpy(pgw_s5c_teid.addr6, session->smf_ip.addr6, + sizeof session->smf_ip.addr6); req->pgw_s5_s8_address_for_control_plane_or_pmip.len = OGS_GTP_F_TEID_IPV6_LEN; } @@ -131,9 +132,9 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( ogs_sockaddr_t *pgw_addr6 = NULL; pgw_addr = mme_pgw_addr_find_by_apn( - &mme_self()->pgw_list, AF_INET, pdn->apn); + &mme_self()->pgw_list, AF_INET, session->name); pgw_addr6 = mme_pgw_addr_find_by_apn( - &mme_self()->pgw_list, AF_INET6, pdn->apn); + &mme_self()->pgw_list, AF_INET6, session->name); if (!pgw_addr && !pgw_addr6) { pgw_addr = mme_self()->pgw_addr; pgw_addr6 = mme_self()->pgw_addr6; @@ -149,7 +150,7 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( req->access_point_name.presence = 1; req->access_point_name.len = ogs_fqdn_build( - apn, pdn->apn, strlen(pdn->apn)); + apn, session->name, strlen(session->name)); req->access_point_name.data = apn; req->selection_mode.presence = 1; @@ -159,19 +160,21 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( ogs_assert(sess->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV4 || sess->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV6 || sess->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV4V6); - if (pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4 || - pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV6 || - pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4V6) { - req->pdn_type.u8 = ((pdn->pdn_type + 1) & sess->request_type.type); + + req->pdn_type.u8 = ((session->session_type + 1) & + sess->request_type.type); + if (session->session_type == OGS_PDU_SESSION_TYPE_IPV4 || + session->session_type == OGS_PDU_SESSION_TYPE_IPV6 || + session->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { + req->pdn_type.u8 = + (session->session_type & sess->request_type.type); if (req->pdn_type.u8 == 0) { ogs_fatal("Cannot derive PDN Type [UE:%d,HSS:%d]", - sess->request_type.type, pdn->pdn_type); + sess->request_type.type, session->session_type); ogs_assert_if_reached(); } - } else if (pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4_OR_IPV6) { - req->pdn_type.u8 = sess->request_type.type; } else { - ogs_fatal("Invalid PDN_TYPE[%d]\n", pdn->pdn_type); + ogs_fatal("Invalid PDN_TYPE[%d]", session->session_type); ogs_assert_if_reached(); } req->pdn_type.presence = 1; @@ -179,25 +182,25 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( /* If we started with both addrs (IPV4V6) but the above code * (pdn_type & sess->request_type) truncates us down to just one, * we need to change position of addresses in struct. */ - if (req->pdn_type.u8 == OGS_GTP_PDN_TYPE_IPV4 && - pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4V6) { - uint32_t addr = pdn->paa.both.addr; - pdn->paa.addr = addr; + if (req->pdn_type.u8 == OGS_PDU_SESSION_TYPE_IPV4 && + session->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { + uint32_t addr = session->paa.both.addr; + session->paa.addr = addr; } - if (req->pdn_type.u8 == OGS_GTP_PDN_TYPE_IPV6 && - pdn->pdn_type == OGS_DIAM_PDN_TYPE_IPV4V6) { + if (req->pdn_type.u8 == OGS_PDU_SESSION_TYPE_IPV6 && + session->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { uint8_t addr[16]; - memcpy(&addr, pdn->paa.both.addr6, OGS_IPV6_LEN); - memcpy(pdn->paa.addr6, &addr, OGS_IPV6_LEN); + memcpy(&addr, session->paa.both.addr6, OGS_IPV6_LEN); + memcpy(session->paa.addr6, &addr, OGS_IPV6_LEN); } - pdn->paa.pdn_type = req->pdn_type.u8; - req->pdn_address_allocation.data = &pdn->paa; - if (req->pdn_type.u8 == OGS_GTP_PDN_TYPE_IPV4) + session->paa.session_type = req->pdn_type.u8; + req->pdn_address_allocation.data = &session->paa; + if (req->pdn_type.u8 == OGS_PDU_SESSION_TYPE_IPV4) req->pdn_address_allocation.len = OGS_PAA_IPV4_LEN; - else if (req->pdn_type.u8 == OGS_GTP_PDN_TYPE_IPV6) + else if (req->pdn_type.u8 == OGS_PDU_SESSION_TYPE_IPV6) req->pdn_address_allocation.len = OGS_PAA_IPV6_LEN; - else if (req->pdn_type.u8 == OGS_GTP_PDN_TYPE_IPV4V6) + else if (req->pdn_type.u8 == OGS_PDU_SESSION_TYPE_IPV4V6) req->pdn_address_allocation.len = OGS_PAA_IPV4V6_LEN; else ogs_assert_if_reached(); @@ -206,7 +209,7 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( req->maximum_apn_restriction.presence = 1; req->maximum_apn_restriction.u8 = OGS_GTP_APN_NO_RESTRICTION; - if (pdn->ambr.uplink || pdn->ambr.downlink) { + if (session->ambr.uplink || session->ambr.downlink) { /* * Ch 8.7. Aggregate Maximum Bit Rate(AMBR) in TS 29.274 V15.9.0 * @@ -215,8 +218,8 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( * Unsigned32 binary integer values in kbps (1000 bits per second). */ memset(&ambr, 0, sizeof(ogs_gtp_ambr_t)); - ambr.uplink = htobe32(pdn->ambr.uplink / 1000); - ambr.downlink = htobe32(pdn->ambr.downlink / 1000); + ambr.uplink = htobe32(session->ambr.uplink / 1000); + ambr.downlink = htobe32(session->ambr.downlink / 1000); req->aggregate_maximum_bit_rate.presence = 1; req->aggregate_maximum_bit_rate.data = &ambr; req->aggregate_maximum_bit_rate.len = sizeof(ambr); @@ -233,11 +236,11 @@ ogs_pkbuf_t *mme_s11_build_create_session_request( req->bearer_contexts_to_be_created.eps_bearer_id.u8 = bearer->ebi; memset(&bearer_qos, 0, sizeof(bearer_qos)); - bearer_qos.qci = pdn->qos.qci; - bearer_qos.priority_level = pdn->qos.arp.priority_level; - bearer_qos.pre_emption_capability = pdn->qos.arp.pre_emption_capability; + bearer_qos.qci = session->qos.index; + bearer_qos.priority_level = session->qos.arp.priority_level; + bearer_qos.pre_emption_capability = session->qos.arp.pre_emption_capability; bearer_qos.pre_emption_vulnerability = - pdn->qos.arp.pre_emption_vulnerability; + session->qos.arp.pre_emption_vulnerability; req->bearer_contexts_to_be_created.bearer_level_qos.presence = 1; ogs_gtp_build_bearer_qos( &req->bearer_contexts_to_be_created.bearer_level_qos, diff --git a/src/mme/mme-s11-handler.c b/src/mme/mme-s11-handler.c index cdeae18cf..5b6062a9d 100644 --- a/src/mme/mme-s11-handler.c +++ b/src/mme/mme-s11-handler.c @@ -87,7 +87,7 @@ void mme_s11_handle_create_session_response( mme_bearer_t *bearer = NULL; mme_sess_t *sess = NULL; - ogs_pdn_t *pdn = NULL; + ogs_session_t *session = NULL; ogs_gtp_bearer_qos_t bearer_qos; ogs_gtp_ambr_t *ambr = NULL; uint16_t decoded = 0; @@ -159,8 +159,8 @@ void mme_s11_handle_create_session_response( memcpy(&paa, rsp->pdn_address_allocation.data, rsp->pdn_address_allocation.len); - if (!OGS_GTP_PDN_TYPE_IS_VALID(paa.pdn_type)) { - ogs_error("Unknown PDN Type[%u]", paa.pdn_type); + if (!OGS_PDU_SESSION_TYPE_IS_VALID(paa.session_type)) { + ogs_error("Unknown PDN Type[%u]", paa.session_type); cause_value = OGS_GTP_CAUSE_MANDATORY_IE_INCORRECT; } } @@ -180,14 +180,14 @@ void mme_s11_handle_create_session_response( ogs_expect_or_return(bearer); sess = bearer->sess; ogs_assert(sess); - pdn = sess->pdn; - ogs_assert(pdn); + session = sess->session; + ogs_assert(session); /* Control Plane(UL) : SGW-S11 */ sgw_s11_teid = rsp->sender_f_teid_for_control_plane.data; mme_ue->sgw_s11_teid = be32toh(sgw_s11_teid->teid); - memcpy(&pdn->paa, rsp->pdn_address_allocation.data, + memcpy(&session->paa, rsp->pdn_address_allocation.data, rsp->pdn_address_allocation.len); /* PCO */ @@ -202,19 +202,19 @@ void mme_s11_handle_create_session_response( &rsp->bearer_contexts_created.bearer_level_qos); ogs_assert(rsp->bearer_contexts_created.bearer_level_qos.len == decoded); - pdn->qos.qci = bearer_qos.qci; - pdn->qos.arp.priority_level = bearer_qos.priority_level; - pdn->qos.arp.pre_emption_capability = + session->qos.index = bearer_qos.qci; + session->qos.arp.priority_level = bearer_qos.priority_level; + session->qos.arp.pre_emption_capability = bearer_qos.pre_emption_capability; - pdn->qos.arp.pre_emption_vulnerability = + session->qos.arp.pre_emption_vulnerability = bearer_qos.pre_emption_vulnerability; } /* AMBR */ if (rsp->aggregate_maximum_bit_rate.presence) { ambr = rsp->aggregate_maximum_bit_rate.data; - pdn->ambr.downlink = be32toh(ambr->downlink) * 1000; - pdn->ambr.uplink = be32toh(ambr->uplink) * 1000; + session->ambr.downlink = be32toh(ambr->downlink) * 1000; + session->ambr.uplink = be32toh(ambr->uplink) * 1000; } /* Data Plane(UL) : SGW-S1U */ @@ -234,15 +234,17 @@ void mme_s11_handle_create_session_response( mme_ue->csmap = csmap; if (csmap) { - ogs_assert(OGS_GTP_PDN_TYPE_IS_VALID(pdn->paa.pdn_type)); + ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID( + session->paa.session_type)); sgsap_send_location_update_request(mme_ue); } else { - ogs_assert(OGS_GTP_PDN_TYPE_IS_VALID(pdn->paa.pdn_type)); + ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID( + session->paa.session_type)); nas_eps_send_attach_accept(mme_ue); } } else { - ogs_assert(OGS_GTP_PDN_TYPE_IS_VALID(pdn->paa.pdn_type)); + ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(session->paa.session_type)); nas_eps_send_activate_default_bearer_context_request(bearer); } } @@ -475,7 +477,7 @@ void mme_s11_handle_create_bearer_request( ogs_expect_or_return(ogs_gtp_parse_bearer_qos(&bearer_qos, &req->bearer_contexts.bearer_level_qos) == req->bearer_contexts.bearer_level_qos.len); - bearer->qos.qci = bearer_qos.qci; + bearer->qos.index = bearer_qos.qci; bearer->qos.arp.priority_level = bearer_qos.priority_level; bearer->qos.arp.pre_emption_capability = bearer_qos.pre_emption_capability; @@ -597,7 +599,7 @@ void mme_s11_handle_update_bearer_request( ogs_expect_or_return(ogs_gtp_parse_bearer_qos(&bearer_qos, &req->bearer_contexts.bearer_level_qos) == req->bearer_contexts.bearer_level_qos.len); - bearer->qos.qci = bearer_qos.qci; + bearer->qos.index = bearer_qos.qci; bearer->qos.arp.priority_level = bearer_qos.priority_level; bearer->qos.arp.pre_emption_capability = bearer_qos.pre_emption_capability; diff --git a/src/mme/mme-s6a-handler.c b/src/mme/mme-s6a-handler.c index 4c11e3f55..311ad9f04 100644 --- a/src/mme/mme-s6a-handler.c +++ b/src/mme/mme-s6a-handler.c @@ -51,12 +51,41 @@ void mme_s6a_handle_ula(mme_ue_t *mme_ue, ogs_diam_s6a_ula_message_t *ula_message) { ogs_subscription_data_t *subscription_data = NULL; + ogs_slice_data_t *slice_data = NULL; + int i; ogs_assert(mme_ue); ogs_assert(ula_message); subscription_data = &ula_message->subscription_data; ogs_assert(subscription_data); - memcpy(&mme_ue->subscription_data, - subscription_data, sizeof(ogs_subscription_data_t)); + ogs_assert(subscription_data->num_of_slice == 1); + slice_data = &subscription_data->slice[0]; + + memcpy(&mme_ue->ambr, &subscription_data->ambr, sizeof(ogs_bitrate_t)); + + mme_session_remove_all(mme_ue); + + mme_ue->num_of_session = slice_data->num_of_session; + mme_ue->context_identifier = slice_data->context_identifier; + + for (i = 0; i < slice_data->num_of_session; i++) { + mme_ue->session[i].name = ogs_strdup(slice_data->session[i].name); + ogs_assert(mme_ue->session[i].name); + + mme_ue->session[i].context_identifier = + slice_data->session[i].context_identifier; + + mme_ue->session[i].session_type = slice_data->session[i].session_type; + memcpy(&mme_ue->session[i].paa, &slice_data->session[i].paa, + sizeof(mme_ue->session[i].paa)); + + memcpy(&mme_ue->session[i].qos, &slice_data->session[i].qos, + sizeof(mme_ue->session[i].qos)); + memcpy(&mme_ue->session[i].ambr, &slice_data->session[i].ambr, + sizeof(mme_ue->session[i].ambr)); + + memcpy(&mme_ue->session[i].smf_ip, &slice_data->session[i].smf_ip, + sizeof(mme_ue->session[i].smf_ip)); + } } diff --git a/src/mme/mme-sm.c b/src/mme/mme-sm.c index b91f1c398..f5e27c98b 100644 --- a/src/mme/mme-sm.c +++ b/src/mme/mme-sm.c @@ -476,6 +476,8 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e) S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0); + ogs_subscription_data_free( + &s6a_message->ula_message.subscription_data); ogs_pkbuf_free(s6abuf); break; } @@ -513,6 +515,7 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e) ogs_error("Invalid Type[%d]", s6a_message->cmd_code); break; } + ogs_subscription_data_free(&s6a_message->ula_message.subscription_data); ogs_pkbuf_free(s6abuf); break; diff --git a/src/mme/s1ap-build.c b/src/mme/s1ap-build.c index d7c9d358f..087d70741 100644 --- a/src/mme/s1ap-build.c +++ b/src/mme/s1ap-build.c @@ -283,13 +283,10 @@ ogs_pkbuf_t *s1ap_build_initial_context_setup_request( enb_ue_t *enb_ue = NULL; mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - ogs_subscription_data_t *subscription_data = NULL; ogs_assert(mme_ue); enb_ue = enb_ue_cycle(mme_ue->enb_ue); ogs_assert(enb_ue); - subscription_data = &mme_ue->subscription_data; - ogs_assert(subscription_data); ogs_debug("InitialContextSetupRequest"); @@ -355,10 +352,10 @@ ogs_pkbuf_t *s1ap_build_initial_context_setup_request( asn_uint642INTEGER( &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateUL, - subscription_data->ambr.uplink); + mme_ue->ambr.uplink); asn_uint642INTEGER( &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateDL, - subscription_data->ambr.downlink); + mme_ue->ambr.downlink); ogs_list_for_each(&mme_ue->sess_list, sess) { ogs_list_for_each(&sess->bearer_list, bearer) { @@ -414,10 +411,10 @@ ogs_pkbuf_t *s1ap_build_initial_context_setup_request( e_rab = &item->value.choice.E_RABToBeSetupItemCtxtSUReq; e_rab->e_RAB_ID = bearer->ebi; - e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.qci; + e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.index; ogs_debug(" EBI[%d] QCI[%d] SGW-S1U-TEID[%d]", - bearer->ebi, bearer->qos.qci, bearer->sgw_s1u_teid); + bearer->ebi, bearer->qos.index, bearer->sgw_s1u_teid); e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. priorityLevel = bearer->qos.arp.priority_level; @@ -931,9 +928,9 @@ ogs_pkbuf_t *s1ap_build_e_rab_setup_request( e_rab = &item->value.choice.E_RABToBeSetupItemBearerSUReq; e_rab->e_RAB_ID = bearer->ebi; - e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.qci; + e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.index; - ogs_debug(" EBI[%d] QCI[%d]", bearer->ebi, bearer->qos.qci); + ogs_debug(" EBI[%d] QCI[%d]", bearer->ebi, bearer->qos.index); e_rab->e_RABlevelQoSParameters.allocationRetentionPriority. priorityLevel = bearer->qos.arp.priority_level; @@ -1064,9 +1061,9 @@ ogs_pkbuf_t *s1ap_build_e_rab_modify_request( e_rab = &item->value.choice.E_RABToBeModifiedItemBearerModReq; e_rab->e_RAB_ID = bearer->ebi; - e_rab->e_RABLevelQoSParameters.qCI = bearer->qos.qci; + e_rab->e_RABLevelQoSParameters.qCI = bearer->qos.index; - ogs_debug(" EBI[%d] QCI[%d]", bearer->ebi, bearer->qos.qci); + ogs_debug(" EBI[%d] QCI[%d]", bearer->ebi, bearer->qos.index); e_rab->e_RABLevelQoSParameters.allocationRetentionPriority. priorityLevel = bearer->qos.arp.priority_level; @@ -1124,7 +1121,6 @@ ogs_pkbuf_t *s1ap_build_e_rab_release_command( mme_ue_t *mme_ue = NULL; enb_ue_t *enb_ue = NULL; - ogs_subscription_data_t *subscription_data = NULL; ogs_assert(esmbuf); ogs_assert(bearer); @@ -1133,8 +1129,6 @@ ogs_pkbuf_t *s1ap_build_e_rab_release_command( ogs_assert(mme_ue); enb_ue = enb_ue_cycle(mme_ue->enb_ue); ogs_assert(enb_ue); - subscription_data = &mme_ue->subscription_data; - ogs_assert(subscription_data); ogs_debug("E-RABReleaseCommand"); @@ -1207,10 +1201,10 @@ ogs_pkbuf_t *s1ap_build_e_rab_release_command( if (UEAggregateMaximumBitrate) { asn_uint642INTEGER( &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateUL, - subscription_data->ambr.uplink); + mme_ue->ambr.uplink); asn_uint642INTEGER( &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateDL, - subscription_data->ambr.downlink); + mme_ue->ambr.downlink); } item = CALLOC(1, sizeof(S1AP_E_RABItemIEs_t)); @@ -1824,7 +1818,6 @@ ogs_pkbuf_t *s1ap_build_handover_request( mme_ue_t *mme_ue = NULL; mme_sess_t *sess = NULL; mme_bearer_t *bearer = NULL; - ogs_subscription_data_t *subscription_data = NULL; ogs_assert(handovertype); ogs_assert(cause); @@ -1833,8 +1826,6 @@ ogs_pkbuf_t *s1ap_build_handover_request( ogs_assert(target_ue); mme_ue = target_ue->mme_ue; ogs_assert(mme_ue); - subscription_data = &mme_ue->subscription_data; - ogs_assert(subscription_data); ogs_debug("HandoverRequest"); @@ -1935,10 +1926,10 @@ ogs_pkbuf_t *s1ap_build_handover_request( asn_uint642INTEGER( &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateUL, - subscription_data->ambr.uplink); + mme_ue->ambr.uplink); asn_uint642INTEGER( &UEAggregateMaximumBitrate->uEaggregateMaximumBitRateDL, - subscription_data->ambr.downlink); + mme_ue->ambr.downlink); ogs_list_for_each(&mme_ue->sess_list, sess) { ogs_list_for_each(&sess->bearer_list, bearer) { @@ -1958,7 +1949,7 @@ ogs_pkbuf_t *s1ap_build_handover_request( e_rab = &item->value.choice.E_RABToBeSetupItemHOReq; e_rab->e_RAB_ID = bearer->ebi; - e_rab->e_RABlevelQosParameters.qCI = bearer->qos.qci; + e_rab->e_RABlevelQosParameters.qCI = bearer->qos.index; e_rab->e_RABlevelQosParameters.allocationRetentionPriority. priorityLevel = bearer->qos.arp.priority_level; diff --git a/src/nssf/app.c b/src/nssf/app.c new file mode 100644 index 000000000..1d3e274a0 --- /dev/null +++ b/src/nssf/app.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ogs-app.h" + +int app_initialize(const char *const argv[]) +{ + int rv; + + rv = nssf_initialize(); + if (rv != OGS_OK) { + ogs_warn("Failed to intialize NSSF"); + return rv; + } + ogs_info("NSSF initialize...done"); + + return OGS_OK; +} + +void app_terminate(void) +{ + nssf_terminate(); + ogs_info("NSSF terminate...done"); +} diff --git a/src/nssf/context.c b/src/nssf/context.c new file mode 100644 index 000000000..5fba9a0ec --- /dev/null +++ b/src/nssf/context.c @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "sbi-path.h" + +static nssf_context_t self; + +int __nssf_log_domain; + +static OGS_POOL(nssf_nsi_pool, nssf_nsi_t); + +static int context_initialized = 0; + +void nssf_context_init(void) +{ + ogs_assert(context_initialized == 0); + + /* Initialize NSSF context */ + memset(&self, 0, sizeof(nssf_context_t)); + + ogs_log_install_domain(&__nssf_log_domain, "nssf", ogs_core()->log.level); + + ogs_pool_init(&nssf_nsi_pool, ogs_app()->pool.nf); + + context_initialized = 1; +} + +void nssf_context_final(void) +{ + ogs_assert(context_initialized == 1); + + nssf_nsi_remove_all(); + + ogs_pool_final(&nssf_nsi_pool); + + context_initialized = 0; +} + +nssf_context_t *nssf_self(void) +{ + return &self; +} + +static int nssf_context_prepare(void) +{ + self.nf_type = OpenAPI_nf_type_NSSF; + + return OGS_OK; +} + +static int nssf_context_validation(void) +{ + return OGS_OK; +} + +int nssf_context_parse_config(void) +{ + int rv; + yaml_document_t *document = NULL; + ogs_yaml_iter_t root_iter; + + document = ogs_app()->document; + ogs_assert(document); + + rv = nssf_context_prepare(); + if (rv != OGS_OK) return rv; + + ogs_yaml_iter_init(&root_iter, document); + while (ogs_yaml_iter_next(&root_iter)) { + const char *root_key = ogs_yaml_iter_key(&root_iter); + ogs_assert(root_key); + if (!strcmp(root_key, "nssf")) { + ogs_yaml_iter_t nssf_iter; + ogs_yaml_iter_recurse(&root_iter, &nssf_iter); + while (ogs_yaml_iter_next(&nssf_iter)) { + const char *nssf_key = ogs_yaml_iter_key(&nssf_iter); + ogs_assert(nssf_key); + if (!strcmp(nssf_key, "sbi")) { + /* handle config in sbi library */ + } else if (!strcmp(nssf_key, "nsi")) { + ogs_list_t list, list6; + ogs_socknode_t *node = NULL, *node6 = NULL; + + ogs_yaml_iter_t nsi_array, nsi_iter; + ogs_yaml_iter_recurse(&nssf_iter, &nsi_array); + do { + int family = AF_UNSPEC; + int i, num = 0; + const char *hostname[OGS_MAX_NUM_OF_HOSTNAME]; + uint16_t port = ogs_sbi_self()->http_port; + const char *dev = NULL; + ogs_sockaddr_t *addr = NULL; + const char *key = NULL, *pem = NULL; + const char *sst = NULL, *sd = NULL; + + if (ogs_yaml_iter_type(&nsi_array) == + YAML_MAPPING_NODE) { + memcpy(&nsi_iter, &nsi_array, + sizeof(ogs_yaml_iter_t)); + } else if (ogs_yaml_iter_type(&nsi_array) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next(&nsi_array)) + break; + ogs_yaml_iter_recurse(&nsi_array, &nsi_iter); + } else if (ogs_yaml_iter_type(&nsi_array) == + YAML_SCALAR_NODE) { + break; + } else + ogs_assert_if_reached(); + + while (ogs_yaml_iter_next(&nsi_iter)) { + const char *nsi_key = + ogs_yaml_iter_key(&nsi_iter); + ogs_assert(nsi_key); + if (!strcmp(nsi_key, "family")) { + const char *v = ogs_yaml_iter_value(&nsi_iter); + if (v) family = atoi(v); + if (family != AF_UNSPEC && + family != AF_INET && family != AF_INET6) { + ogs_warn("Ignore family(%d) : " + "AF_UNSPEC(%d), " + "AF_INET(%d), AF_INET6(%d) ", + family, AF_UNSPEC, AF_INET, AF_INET6); + family = AF_UNSPEC; + } + } else if (!strcmp(nsi_key, "addr") || + !strcmp(nsi_key, "name")) { + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(&nsi_iter, + &hostname_iter); + ogs_assert(ogs_yaml_iter_type(&hostname_iter) != + YAML_MAPPING_NODE); + + do { + if (ogs_yaml_iter_type(&hostname_iter) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next( + &hostname_iter)) + break; + } + + ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME); + hostname[num++] = + ogs_yaml_iter_value(&hostname_iter); + } while ( + ogs_yaml_iter_type(&hostname_iter) == + YAML_SEQUENCE_NODE); + } else if (!strcmp(nsi_key, "port")) { + const char *v = ogs_yaml_iter_value(&nsi_iter); + if (v) { + port = atoi(v); + } + } else if (!strcmp(nsi_key, "dev")) { + dev = ogs_yaml_iter_value(&nsi_iter); + } else if (!strcmp(nsi_key, "tls")) { + ogs_yaml_iter_t tls_iter; + ogs_yaml_iter_recurse(&nsi_iter, &tls_iter); + + while (ogs_yaml_iter_next(&tls_iter)) { + const char *tls_key = + ogs_yaml_iter_key(&tls_iter); + ogs_assert(tls_key); + + if (!strcmp(tls_key, "key")) { + key = ogs_yaml_iter_value(&tls_iter); + } else if (!strcmp(tls_key, "pem")) { + pem = ogs_yaml_iter_value(&tls_iter); + } else + ogs_warn("unknown key `%s`", tls_key); + } + } else if (!strcmp(nsi_key, "s_nssai")) { + ogs_yaml_iter_t s_nssai_iter; + ogs_yaml_iter_recurse(&nsi_iter, &s_nssai_iter); + + while (ogs_yaml_iter_next(&s_nssai_iter)) { + const char *s_nssai_key = + ogs_yaml_iter_key(&s_nssai_iter); + ogs_assert(s_nssai_key); + + if (!strcmp(s_nssai_key, "sst")) { + sst = ogs_yaml_iter_value( + &s_nssai_iter); + } else if (!strcmp(s_nssai_key, "sd")) { + sd = ogs_yaml_iter_value(&s_nssai_iter); + } else + ogs_warn("unknown key `%s`", + s_nssai_key); + } + } else + ogs_warn("unknown key `%s`", nsi_key); + } + + addr = NULL; + for (i = 0; i < num; i++) { + rv = ogs_addaddrinfo(&addr, + family, hostname[i], port, 0); + ogs_assert(rv == OGS_OK); + } + + ogs_list_init(&list); + ogs_list_init(&list6); + + if (addr) { + if (ogs_app()->parameter.no_ipv4 == 0) + ogs_socknode_add(&list, AF_INET, addr); + if (ogs_app()->parameter.no_ipv6 == 0) + ogs_socknode_add(&list6, AF_INET6, addr); + ogs_freeaddrinfo(addr); + } + + if (dev) { + rv = ogs_socknode_probe( + ogs_app()->parameter.no_ipv4 ? NULL : &list, + ogs_app()->parameter.no_ipv6 ? NULL : &list6, + dev, port); + ogs_assert(rv == OGS_OK); + } + + node = ogs_list_first(&list); + if (node) { + ogs_assert(sst); + + nssf_nsi_t *nsi = nssf_nsi_add(node->addr, + atoi(sst), ogs_s_nssai_sd_from_string(sd)); + ogs_assert(nsi); + + if (key) nsi->tls.key = key; + if (pem) nsi->tls.pem = pem; + } + node6 = ogs_list_first(&list6); + if (node6) { + ogs_assert(sst); + + nssf_nsi_t *nsi = nssf_nsi_add(node6->addr, + atoi(sst), ogs_s_nssai_sd_from_string(sd)); + ogs_assert(nsi); + + if (key) nsi->tls.key = key; + if (pem) nsi->tls.pem = pem; + } + + ogs_socknode_remove_all(&list); + ogs_socknode_remove_all(&list6); + } while (ogs_yaml_iter_type(&nsi_array) == + YAML_SEQUENCE_NODE); + } else + ogs_warn("unknown key `%s`", nssf_key); + } + } + } + + rv = nssf_context_validation(); + if (rv != OGS_OK) return rv; + + return OGS_OK; +} + +nssf_nsi_t *nssf_nsi_add(ogs_sockaddr_t *addr, uint8_t sst, ogs_uint24_t sd) +{ + nssf_nsi_t *nsi = NULL; + + ogs_assert(addr); + ogs_assert(sst); + + ogs_pool_alloc(&nssf_nsi_pool, &nsi); + ogs_assert(nsi); + memset(nsi, 0, sizeof *nsi); + + nsi->nsi_id = ogs_msprintf("%d", (int)ogs_pool_index(&nssf_nsi_pool, nsi)); + ogs_assert(nsi->nsi_id); + + ogs_copyaddrinfo(&nsi->addr, addr); + + nsi->s_nssai.sst = sst; + nsi->s_nssai.sd.v = sd.v; + + ogs_list_add(&self.nsi_list, nsi); + + return nsi; +} + +void nssf_nsi_remove(nssf_nsi_t *nsi) +{ + ogs_assert(nsi); + + ogs_list_remove(&self.nsi_list, nsi); + + ogs_assert(nsi->addr); + ogs_freeaddrinfo(nsi->addr); + + ogs_assert(nsi->nsi_id); + ogs_free(nsi->nsi_id); + + ogs_pool_free(&nssf_nsi_pool, nsi); +} + +void nssf_nsi_remove_all(void) +{ + nssf_nsi_t *nsi = NULL, *next_nsi = NULL; + + ogs_list_for_each_safe(&self.nsi_list, next_nsi, nsi) + nssf_nsi_remove(nsi); +} + +nssf_nsi_t *nssf_nsi_find_by_s_nssai(ogs_s_nssai_t *s_nssai) +{ + nssf_nsi_t *nsi = NULL; + + ogs_assert(s_nssai); + + ogs_list_for_each(&self.nsi_list, nsi) { + /* Compare S-NSSAI */ + if (nsi->s_nssai.sst == s_nssai->sst && + nsi->s_nssai.sd.v == s_nssai->sd.v) { + return nsi; + } + } + + return NULL; +} + +char *nssf_nsi_nrf_uri(nssf_nsi_t *nsi) +{ + ogs_sbi_header_t h; + bool https = false; + + ogs_assert(nsi); + + memset(&h, 0, sizeof(h)); + + if (nsi->tls.key && nsi->tls.pem) + https = true; + + h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_DISC; + h.api.version = (char *)OGS_SBI_API_V1; + h.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; + + return ogs_uridup(https, nsi->addr, &h); +} diff --git a/src/nssf/context.h b/src/nssf/context.h new file mode 100644 index 000000000..d2743775a --- /dev/null +++ b/src/nssf/context.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_CONTEXT_H +#define NSSF_CONTEXT_H + +#include "ogs-app.h" +#include "ogs-sbi.h" + +#include "nssf-sm.h" +#include "timer.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_NUM_OF_SERVED_GUAMI 8 + +extern int __nssf_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __nssf_log_domain + +typedef struct nssf_context_s { + OpenAPI_nf_type_e nf_type; + + ogs_list_t nsi_list; /* NSI List */ +} nssf_context_t; + +#define NSSF_NF_INSTANCE_CLEAR(_cAUSE, _nFInstance) \ + do { \ + ogs_assert(_nFInstance); \ + if ((_nFInstance)->reference_count == 1) { \ + ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \ + nssf_nf_fsm_fini((_nFInstance)); \ + } else { \ + /* There is an assocation with other context */ \ + ogs_info("[%s:%d] (%s) NF suspended", \ + _nFInstance->id, _nFInstance->reference_count, (_cAUSE)); \ + OGS_FSM_TRAN(&_nFInstance->sm, nssf_nf_state_de_registered); \ + ogs_fsm_dispatch(&_nFInstance->sm, NULL); \ + } \ + ogs_sbi_nf_instance_remove(_nFInstance); \ + } while(0) + +void nssf_context_init(void); +void nssf_context_final(void); +nssf_context_t *nssf_self(void); + +int nssf_context_parse_config(void); + +typedef struct nssf_nsi_s { + ogs_lnode_t lnode; + + char *nsi_id; + + ogs_sockaddr_t *addr; + struct { + const char *key; + const char *pem; + } tls; + + ogs_s_nssai_t s_nssai; +} nssf_nsi_t; + +nssf_nsi_t *nssf_nsi_add(ogs_sockaddr_t *addr, uint8_t sst, ogs_uint24_t sd); +void nssf_nsi_remove(nssf_nsi_t *nsi); +void nssf_nsi_remove_all(void); +nssf_nsi_t *nssf_nsi_find_by_s_nssai(ogs_s_nssai_t *s_nssai); + +char *nssf_nsi_nrf_uri(nssf_nsi_t *nsi); + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_CONTEXT_H */ diff --git a/src/nssf/event.c b/src/nssf/event.c new file mode 100644 index 000000000..d7db10680 --- /dev/null +++ b/src/nssf/event.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "event.h" +#include "context.h" + +static OGS_POOL(pool, nssf_event_t); + +void nssf_event_init(void) +{ + ogs_pool_init(&pool, ogs_app()->pool.event); +} + +void nssf_event_final(void) +{ + ogs_pool_final(&pool); +} + +nssf_event_t *nssf_event_new(nssf_event_e id) +{ + nssf_event_t *e = NULL; + + ogs_pool_alloc(&pool, &e); + ogs_assert(e); + memset(e, 0, sizeof(*e)); + + e->id = id; + + return e; +} + +void nssf_event_free(nssf_event_t *e) +{ + ogs_assert(e); + ogs_pool_free(&pool, e); +} + +const char *nssf_event_get_name(nssf_event_t *e) +{ + if (e == NULL) + return OGS_FSM_NAME_INIT_SIG; + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + return OGS_FSM_NAME_ENTRY_SIG; + case OGS_FSM_EXIT_SIG: + return OGS_FSM_NAME_EXIT_SIG; + + case NSSF_EVT_SBI_SERVER: + return "NSSF_EVT_SBI_SERVER"; + case NSSF_EVT_SBI_CLIENT: + return "NSSF_EVT_SBI_CLIENT"; + case NSSF_EVT_SBI_TIMER: + return "NSSF_EVT_SBI_TIMER"; + + default: + break; + } + + return "UNKNOWN_EVENT"; +} diff --git a/src/nssf/event.h b/src/nssf/event.h new file mode 100644 index 000000000..2f0c066f1 --- /dev/null +++ b/src/nssf/event.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_EVENT_H +#define NSSF_EVENT_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ogs_sbi_request_s ogs_sbi_request_t; +typedef struct ogs_sbi_response_s ogs_sbi_response_t; +typedef struct ogs_sbi_message_s ogs_sbi_message_t; +typedef struct ogs_sbi_nf_instance_s ogs_sbi_nf_instance_t; +typedef struct ogs_sbi_subscription_s ogs_sbi_subscription_t; + +typedef enum { + NSSF_EVT_BASE = OGS_FSM_USER_SIG, + + NSSF_EVT_SBI_SERVER, + NSSF_EVT_SBI_CLIENT, + NSSF_EVT_SBI_TIMER, + + NSSF_EVT_TOP, + +} nssf_event_e; + +typedef struct nssf_event_s { + int id; + int timer_id; + + struct { + ogs_sbi_request_t *request; + ogs_sbi_response_t *response; + void *data; + + ogs_sbi_message_t *message; + } sbi; + + ogs_timer_t *timer; +} nssf_event_t; + +void nssf_event_init(void); +void nssf_event_final(void); + +nssf_event_t *nssf_event_new(nssf_event_e id); +void nssf_event_free(nssf_event_t *e); + +const char *nssf_event_get_name(nssf_event_t *e); + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_EVENT_H */ diff --git a/src/nssf/init.c b/src/nssf/init.c new file mode 100644 index 000000000..98fc87733 --- /dev/null +++ b/src/nssf/init.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "context.h" + +static ogs_thread_t *thread; +static void nssf_main(void *data); +static int initialized = 0; + +int nssf_initialize() +{ + int rv; + + nssf_context_init(); + nssf_event_init(); + ogs_sbi_context_init(); + + rv = ogs_sbi_context_parse_config("nssf", "nrf"); + if (rv != OGS_OK) return rv; + + rv = nssf_context_parse_config(); + if (rv != OGS_OK) return rv; + + rv = ogs_log_config_domain( + ogs_app()->logger.domain, ogs_app()->logger.level); + if (rv != OGS_OK) return rv; + + thread = ogs_thread_create(nssf_main, NULL); + if (!thread) return OGS_ERROR; + + initialized = 1; + + return OGS_OK; +} + +static ogs_timer_t *t_termination_holding = NULL; + +static void event_termination(void) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + /* Sending NF Instance De-registeration to NRF */ + ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + nssf_nf_fsm_fini(nf_instance); + + /* Starting holding timer */ + t_termination_holding = ogs_timer_add(ogs_app()->timer_mgr, NULL, NULL); + ogs_assert(t_termination_holding); +#define TERMINATION_HOLDING_TIME ogs_time_from_msec(300) + ogs_timer_start(t_termination_holding, TERMINATION_HOLDING_TIME); + + /* Sending termination event to the queue */ + ogs_queue_term(ogs_app()->queue); + ogs_pollset_notify(ogs_app()->pollset); +} + +void nssf_terminate(void) +{ + if (!initialized) return; + + /* Daemon terminating */ + event_termination(); + ogs_thread_destroy(thread); + ogs_timer_delete(t_termination_holding); + + nssf_context_final(); + ogs_sbi_context_final(); + + nssf_event_final(); /* Destroy event */ +} + +static void nssf_main(void *data) +{ + ogs_fsm_t nssf_sm; + int rv; + + ogs_fsm_create(&nssf_sm, nssf_state_initial, nssf_state_final); + ogs_fsm_init(&nssf_sm, 0); + + for ( ;; ) { + ogs_pollset_poll(ogs_app()->pollset, + ogs_timer_mgr_next(ogs_app()->timer_mgr)); + + /* + * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. + * + * The reason is why ogs_timer_mgr_next() can get the corrent value + * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). + * + * You should not use event-queue before ogs_timer_mgr_expire(). + * In this case, ogs_timer_mgr_expire() does not work + * because 'if rv == OGS_DONE' statement is exiting and + * not calling ogs_timer_mgr_expire(). + */ + ogs_timer_mgr_expire(ogs_app()->timer_mgr); + + for ( ;; ) { + nssf_event_t *e = NULL; + + rv = ogs_queue_trypop(ogs_app()->queue, (void**)&e); + ogs_assert(rv != OGS_ERROR); + + if (rv == OGS_DONE) + goto done; + + if (rv == OGS_RETRY) + break; + + ogs_assert(e); + ogs_fsm_dispatch(&nssf_sm, e); + nssf_event_free(e); + } + } +done: + + ogs_fsm_fini(&nssf_sm, 0); + ogs_fsm_delete(&nssf_sm); +} diff --git a/src/nssf/meson.build b/src/nssf/meson.build new file mode 100644 index 000000000..055680553 --- /dev/null +++ b/src/nssf/meson.build @@ -0,0 +1,57 @@ +# Copyright (C) 2019,2020 by Sukchan Lee + +# This file is part of Open5GS. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +libnssf_sources = files(''' + context.c + event.c + timer.c + + nnrf-build.c + nnrf-handler.c + nf-sm.c + + nnssf-handler.c + + sbi-path.c + nssf-sm.c + + init.c +'''.split()) + +libnssf = static_library('nssf', + sources : libnssf_sources, + dependencies : [libapp_dep, + libsbi_dep], + install : false) + +libnssf_dep = declare_dependency( + link_with : libnssf, + dependencies : [libapp_dep, + libsbi_dep]) + +nssf_sources = files(''' + app.c + ../main.c +'''.split()) + +executable('open5gs-nssfd', + sources : nssf_sources, + c_args : '-DDEFAULT_CONFIG_FILENAME="@0@/nssf.yaml"'.format(open5gs_sysconfdir), + include_directories : srcinc, + dependencies : libnssf_dep, + install_rpath : libdir, + install : true) diff --git a/src/nssf/nf-sm.c b/src/nssf/nf-sm.c new file mode 100644 index 000000000..bde5aa1d6 --- /dev/null +++ b/src/nssf/nf-sm.c @@ -0,0 +1,405 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "context.h" + +#include "sbi-path.h" +#include "nnrf-handler.h" + +void nssf_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance) +{ + nssf_event_t e; + + ogs_assert(nf_instance); + + memset(&e, 0, sizeof(e)); + e.sbi.data = nf_instance; + + ogs_fsm_create(&nf_instance->sm, + nssf_nf_state_initial, nssf_nf_state_final); + ogs_fsm_init(&nf_instance->sm, &e); +} + +void nssf_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance) +{ + nssf_event_t e; + + ogs_assert(nf_instance); + + memset(&e, 0, sizeof(e)); + e.sbi.data = nf_instance; + + ogs_fsm_fini(&nf_instance->sm, &e); + ogs_fsm_delete(&nf_instance->sm); +} + +void nssf_nf_state_initial(ogs_fsm_t *s, nssf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(s); + ogs_assert(e); + + nssf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + ogs_assert(nf_instance->id); + + ogs_assert(nf_instance->t_registration_interval); + nf_instance->t_registration_interval->cb = + nssf_timer_nf_instance_registration_interval; + ogs_assert(nf_instance->t_heartbeat_interval); + nf_instance->t_heartbeat_interval->cb = + nssf_timer_nf_instance_heartbeat_interval; + ogs_assert(nf_instance->t_no_heartbeat); + nf_instance->t_no_heartbeat->cb = nssf_timer_nf_instance_no_heartbeat; + ogs_assert(nf_instance->t_validity); + nf_instance->t_validity->cb = nssf_timer_nf_instance_validity; + + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + OGS_FSM_TRAN(s, &nssf_nf_state_will_register); + } else { + OGS_FSM_TRAN(s, &nssf_nf_state_registered); + } +} + +void nssf_nf_state_final(ogs_fsm_t *s, nssf_event_t *e) +{ + ogs_assert(s); + ogs_assert(e); + + nssf_sm_debug(e); +} + +void nssf_nf_state_will_register(ogs_fsm_t *s, nssf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_client_t *client = NULL; + ogs_sbi_message_t *message = NULL; + ogs_sockaddr_t *addr = NULL; + + ogs_assert(s); + ogs_assert(e); + + nssf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) + ogs_timer_start(nf_instance->t_registration_interval, + ogs_app()->time.message.sbi.nf_register_interval); + + nssf_nnrf_nfm_send_nf_register(nf_instance); + break; + + case OGS_FSM_EXIT_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) + ogs_timer_stop(nf_instance->t_registration_interval); + break; + + case NSSF_EVT_SBI_CLIENT: + message = e->sbi.message; + ogs_assert(message); + + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM) + + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + + if (message->res_status == OGS_SBI_HTTP_STATUS_OK || + message->res_status == OGS_SBI_HTTP_STATUS_CREATED) { + nssf_nnrf_handle_nf_register(nf_instance, message); + OGS_FSM_TRAN(s, &nssf_nf_state_registered); + } else { + ogs_error("[%s] HTTP response error [%d]", + nf_instance->id, message->res_status); + OGS_FSM_TRAN(s, &nssf_nf_state_exception); + } + break; + + DEFAULT + ogs_error("[%s] Invalid resource name [%s]", + nf_instance->id, message->h.resource.component[0]); + END + break; + + DEFAULT + ogs_error("[%s] Invalid API name [%s]", + nf_instance->id, message->h.service.name); + END + break; + + case NSSF_EVT_SBI_TIMER: + switch(e->timer_id) { + case NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + client = nf_instance->client; + ogs_assert(client); + addr = client->node.addr; + ogs_assert(addr); + + ogs_warn("[%s] Retry to registration with NRF", nf_instance->id); + + if (NF_INSTANCE_IS_SELF(nf_instance->id)) + ogs_timer_start(nf_instance->t_registration_interval, + ogs_app()->time.message.sbi.nf_register_interval); + + nssf_nnrf_nfm_send_nf_register(nf_instance); + break; + + default: + ogs_error("[%s] Unknown timer[%s:%d]", nf_instance->id, + nssf_timer_get_name(e->timer_id), e->timer_id); + } + break; + + default: + ogs_error("Unknown event %s", nssf_event_get_name(e)); + break; + } +} + +void nssf_nf_state_registered(ogs_fsm_t *s, nssf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_client_t *client = NULL; + ogs_sbi_message_t *message = NULL; + ogs_assert(s); + ogs_assert(e); + + nssf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + ogs_info("[%s] NF registred [Heartbeat:%ds]", + nf_instance->id, nf_instance->time.heartbeat_interval); + + client = nf_instance->client; + ogs_assert(client); + + if (nf_instance->time.heartbeat_interval) { + ogs_timer_start(nf_instance->t_heartbeat_interval, + ogs_time_from_sec(nf_instance->time.heartbeat_interval)); + ogs_timer_start(nf_instance->t_no_heartbeat, + ogs_time_from_sec( + nf_instance->time.heartbeat_interval + + ogs_app()->time.nf_instance.no_heartbeat_margin)); + } + } + + break; + + case OGS_FSM_EXIT_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + ogs_info("[%s] NF de-registered", nf_instance->id); + + if (nf_instance->time.heartbeat_interval) { + ogs_timer_stop(nf_instance->t_heartbeat_interval); + ogs_timer_stop(nf_instance->t_no_heartbeat); + } + + if (!OGS_FSM_CHECK(&nf_instance->sm, nssf_nf_state_exception)) { + ogs_nnrf_nfm_send_nf_de_register(nf_instance); + } + } + break; + + case NSSF_EVT_SBI_CLIENT: + message = e->sbi.message; + ogs_assert(message); + + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM) + + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + + if (message->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT || + message->res_status == OGS_SBI_HTTP_STATUS_OK) { + if (nf_instance->time.heartbeat_interval) + ogs_timer_start(nf_instance->t_no_heartbeat, + ogs_time_from_sec( + nf_instance->time.heartbeat_interval + + ogs_app()->time.nf_instance. + no_heartbeat_margin)); + } else { + ogs_warn("[%s] HTTP response error [%d]", + nf_instance->id, message->res_status); + OGS_FSM_TRAN(s, &nssf_nf_state_exception); + } + + break; + + DEFAULT + ogs_error("[%s] Invalid resource name [%s]", + nf_instance->id, message->h.resource.component[0]); + END + break; + + DEFAULT + ogs_error("[%s] Invalid API name [%s]", + nf_instance->id, message->h.service.name); + END + break; + + case NSSF_EVT_SBI_TIMER: + switch(e->timer_id) { + case NSSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + if (nf_instance->time.heartbeat_interval) + ogs_timer_start(nf_instance->t_heartbeat_interval, + ogs_time_from_sec(nf_instance->time.heartbeat_interval)); + + ogs_nnrf_nfm_send_nf_update(nf_instance); + break; + + case NSSF_TIMER_NF_INSTANCE_NO_HEARTBEAT: + ogs_error("[%s] No heartbeat", nf_instance->id); + OGS_FSM_TRAN(s, &nssf_nf_state_will_register); + break; + + case NSSF_TIMER_NF_INSTANCE_VALIDITY: + if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { + ogs_info("[%s] NF expired", nf_instance->id); + OGS_FSM_TRAN(s, &nssf_nf_state_de_registered); + } + break; + + default: + ogs_error("[%s] Unknown timer[%s:%d]", nf_instance->id, + nssf_timer_get_name(e->timer_id), e->timer_id); + break; + } + break; + + default: + ogs_error("[%s] Unknown event %s", + nf_instance->id, nssf_event_get_name(e)); + break; + } +} + +void nssf_nf_state_de_registered(ogs_fsm_t *s, nssf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_assert(s); + ogs_assert(e); + + nssf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + ogs_info("[%s] NF de-registered", nf_instance->id); + } + break; + + case OGS_FSM_EXIT_SIG: + break; + + default: + ogs_error("[%s] Unknown event %s", + nf_instance->id, nssf_event_get_name(e)); + break; + } +} + +void nssf_nf_state_exception(ogs_fsm_t *s, nssf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_client_t *client = NULL; + ogs_sbi_message_t *message = NULL; + ogs_sockaddr_t *addr = NULL; + ogs_assert(s); + ogs_assert(e); + + nssf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) + ogs_timer_start(nf_instance->t_registration_interval, + ogs_app()->time.message.sbi. + nf_register_interval_in_exception); + break; + + case OGS_FSM_EXIT_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) + ogs_timer_stop(nf_instance->t_registration_interval); + break; + + case NSSF_EVT_SBI_TIMER: + switch(e->timer_id) { + case NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + client = nf_instance->client; + ogs_assert(client); + addr = client->node.addr; + ogs_assert(addr); + + ogs_warn("[%s] Retry to registration with NRF", nf_instance->id); + + OGS_FSM_TRAN(s, &nssf_nf_state_will_register); + break; + + default: + ogs_error("[%s] Unknown timer[%s:%d]", nf_instance->id, + nssf_timer_get_name(e->timer_id), e->timer_id); + break; + } + break; + + case NSSF_EVT_SBI_CLIENT: + message = e->sbi.message; + ogs_assert(message); + + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM) + + SWITCH(message->h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + break; + DEFAULT + ogs_error("Invalid resource name [%s]", + message->h.resource.component[0]); + END + break; + DEFAULT + ogs_error("Invalid API name [%s]", message->h.service.name); + END + break; + + default: + ogs_error("[%s] Unknown event %s", + nf_instance->id, nssf_event_get_name(e)); + break; + } +} diff --git a/src/nssf/nnrf-build.c b/src/nssf/nnrf-build.c new file mode 100644 index 000000000..b2b1cd74f --- /dev/null +++ b/src/nssf/nnrf-build.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnrf-build.h" + +ogs_sbi_request_t *nssf_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); + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return request; +} diff --git a/src/nssf/nnrf-build.h b/src/nssf/nnrf-build.h new file mode 100644 index 000000000..4598900f8 --- /dev/null +++ b/src/nssf/nnrf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_NNRF_BUILD_H +#define NSSF_NNRF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *nssf_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_NNRF_BUILD_H */ diff --git a/src/nssf/nnrf-handler.c b/src/nssf/nnrf-handler.c new file mode 100644 index 000000000..1eab07165 --- /dev/null +++ b/src/nssf/nnrf-handler.c @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "sbi-path.h" +#include "nnrf-handler.h" + +void nssf_nnrf_handle_nf_register( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_message_t *recvmsg) +{ + OpenAPI_nf_profile_t *NFProfile = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(recvmsg); + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + NFProfile = recvmsg->NFProfile; + if (!NFProfile) { + ogs_error("No NFProfile"); + return; + } + + /* TIME : Update heartbeat from NRF */ + if (NFProfile->nf_profile_changes_ind == true) { + if (NFProfile->heart_beat_timer) + nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer; + } else { + nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer; + } +} + +void nssf_nnrf_handle_nf_status_subscribe( + ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *recvmsg) +{ + OpenAPI_subscription_data_t *SubscriptionData = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(recvmsg); + ogs_assert(subscription); + client = subscription->client; + ogs_assert(client); + + SubscriptionData = recvmsg->SubscriptionData; + if (!SubscriptionData) { + ogs_error("No SubscriptionData"); + return; + } + + if (!SubscriptionData->subscription_id) { + ogs_error("No SubscriptionId"); + return; + } + ogs_sbi_subscription_set_id( + subscription, SubscriptionData->subscription_id); + + if (SubscriptionData->validity_time) { +#define VALIDITY_MINIMUM (10LL * OGS_USEC_PER_SEC) /* 10 seconds */ + ogs_time_t time, duration; + if (ogs_sbi_time_from_string( + &time, SubscriptionData->validity_time) == true) { + duration = time - ogs_time_now(); + if (duration < VALIDITY_MINIMUM) { + duration = VALIDITY_MINIMUM; + ogs_warn("[%s] Forced to %lld seconds", subscription->id, + (long long)ogs_time_sec(VALIDITY_MINIMUM)); + } + subscription->t_validity = ogs_timer_add(ogs_app()->timer_mgr, + nssf_timer_subscription_validity, subscription); + ogs_assert(subscription->t_validity); + ogs_timer_start(subscription->t_validity, duration); + } else { + ogs_error("Cannot parse validitiyTime [%s]", + SubscriptionData->validity_time); + } + } +} + +bool nssf_nnrf_handle_nf_status_notify( + ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg) +{ + int rv; + bool handled; + + ogs_sbi_response_t *response = NULL; + OpenAPI_notification_data_t *NotificationData = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_sbi_message_t message; + ogs_sbi_header_t header; + + ogs_assert(stream); + ogs_assert(recvmsg); + + NotificationData = recvmsg->NotificationData; + if (!NotificationData) { + ogs_error("No NotificationData"); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No NotificationData", NULL); + return false; + } + + if (!NotificationData->nf_instance_uri) { + ogs_error("No nfInstanceUri"); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No nfInstanceUri", NULL); + return false; + } + + memset(&header, 0, sizeof(header)); + header.uri = NotificationData->nf_instance_uri; + + rv = ogs_sbi_parse_header(&message, &header); + if (rv != OGS_OK) { + ogs_error("Cannot parse nfInstanceUri [%s]", header.uri); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "Cannot parse nfInstanceUri", header.uri); + return false; + } + + if (!message.h.resource.component[1]) { + ogs_error("No nfInstanceId [%s]", header.uri); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "Cannot parse nfInstanceUri", header.uri); + ogs_sbi_header_free(&header); + return false; + } + + if (NF_INSTANCE_IS_SELF(message.h.resource.component[1])) { + ogs_warn("[%s] The notification is not allowed", + message.h.resource.component[1]); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN, + recvmsg, "The notification is not allowed", + message.h.resource.component[1]); + ogs_sbi_header_free(&header); + return false; + } + + if (NotificationData->event == + OpenAPI_notification_event_type_NF_REGISTERED) { + + OpenAPI_nf_profile_t *NFProfile = NULL; + + NFProfile = NotificationData->nf_profile; + if (!NFProfile) { + ogs_error("No NFProfile"); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No NFProfile", NULL); + ogs_sbi_header_free(&header); + return false; + } + + nf_instance = ogs_sbi_nf_instance_find(message.h.resource.component[1]); + if (!nf_instance) { + nf_instance = ogs_sbi_nf_instance_add( + message.h.resource.component[1]); + ogs_assert(nf_instance); + + nssf_nf_fsm_init(nf_instance); + + ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id); + + } else { + OGS_FSM_TRAN(&nf_instance->sm, nssf_nf_state_registered); + ogs_fsm_dispatch(&nf_instance->sm, NULL); + + ogs_warn("[%s] (NRF-notify) NF has already been added", + message.h.resource.component[1]); + + } + + handled = ogs_sbi_nnrf_handle_nf_profile( + nf_instance, NFProfile, stream, recvmsg); + if (!handled) { + NSSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance); + ogs_sbi_header_free(&header); + return false; + } + + ogs_info("[%s] (NRF-notify) NF Profile updated", nf_instance->id); + + handled = ogs_sbi_client_associate(nf_instance); + if (!handled) { + ogs_error("[%s] Cannot associate NF EndPoint", nf_instance->id); + ogs_sbi_server_send_error(stream, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "Cannot find NF EndPoint", nf_instance->id); + NSSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance); + ogs_sbi_header_free(&header); + return false; + } + + } else if (NotificationData->event == + OpenAPI_notification_event_type_NF_DEREGISTERED) { + nf_instance = ogs_sbi_nf_instance_find(message.h.resource.component[1]); + if (nf_instance) { + NSSF_NF_INSTANCE_CLEAR("NRF-notify", nf_instance); + } else { + ogs_warn("[%s] (NRF-notify) Not found", + message.h.resource.component[1]); + ogs_sbi_server_send_error(stream, + OGS_SBI_HTTP_STATUS_NOT_FOUND, + recvmsg, "Not found", message.h.resource.component[1]); + ogs_sbi_header_free(&header); + return false; + } + } else { + char *eventstr = OpenAPI_notification_event_type_ToString( + NotificationData->event); + ogs_error("Not supported event [%d:%s]", + NotificationData->event, eventstr ? eventstr : "Unknown"); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "Not supported event", + eventstr ? eventstr : "Unknown"); + ogs_sbi_header_free(&header); + return false; + } + + response = ogs_sbi_build_response(recvmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT); + ogs_assert(response); + ogs_sbi_server_send_response(stream, response); + + ogs_sbi_header_free(&header); + return true; +} diff --git a/src/nssf/nnrf-handler.h b/src/nssf/nnrf-handler.h new file mode 100644 index 000000000..fb0e15479 --- /dev/null +++ b/src/nssf/nnrf-handler.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_NNRF_HANDLER_H +#define NSSF_NNRF_HANDLER_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void nssf_nnrf_handle_nf_register( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_message_t *recvmsg); +void nssf_nnrf_handle_nf_status_subscribe( + ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *recvmsg); + +bool nssf_nnrf_handle_nf_status_notify( + ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg); + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_NNRF_HANDLER_H */ diff --git a/src/nssf/nnssf-handler.c b/src/nssf/nnssf-handler.c new file mode 100644 index 000000000..f5df9ec62 --- /dev/null +++ b/src/nssf/nnssf-handler.c @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "sbi-path.h" +#include "nnrf-handler.h" +#include "nnssf-handler.h" + +bool nssf_nnrf_nsselection_handle_get( + ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg) +{ + int status = OGS_SBI_HTTP_STATUS_OK; + char *strerror = NULL; + + OpenAPI_authorized_network_slice_info_t AuthorizedNetworkSliceInfo; + OpenAPI_nsi_information_t NsiInformation; + + nssf_nsi_t *nsi = NULL; + + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + + ogs_assert(stream); + ogs_assert(recvmsg); + + if (!recvmsg->param.nf_id) { + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + strerror = ogs_msprintf("No nf-id"); + goto cleanup; + } + + if (!recvmsg->param.nf_type) { + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + strerror = ogs_msprintf("No nf-type"); + goto cleanup; + } + + if (!recvmsg->param.slice_info_request_for_pdu_session_presence) { + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + strerror = ogs_msprintf("Not implemented except PDU session"); + goto cleanup; + } + + nsi = nssf_nsi_find_by_s_nssai(&recvmsg->param.s_nssai); + if (!nsi) { + status = OGS_SBI_HTTP_STATUS_FORBIDDEN; + strerror = ogs_msprintf("Cannot find NSI by S-NSSAI[SST:%d SD:0x%x]", + recvmsg->param.s_nssai.sst, recvmsg->param.s_nssai.sd.v); + goto cleanup; + } + + memset(&NsiInformation, 0, sizeof(NsiInformation)); + NsiInformation.nrf_id = nssf_nsi_nrf_uri(nsi); + NsiInformation.nsi_id = nsi->nsi_id; + + memset(&AuthorizedNetworkSliceInfo, 0, sizeof(AuthorizedNetworkSliceInfo)); + AuthorizedNetworkSliceInfo.nsi_information = &NsiInformation; + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.AuthorizedNetworkSliceInfo = &AuthorizedNetworkSliceInfo; + + response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK); + ogs_assert(response); + ogs_sbi_server_send_response(stream, response); + + if (NsiInformation.nrf_id) + ogs_free(NsiInformation.nrf_id); + + return true; + +cleanup: + ogs_assert(strerror); + + ogs_error("%s", strerror); + ogs_sbi_server_send_error(stream, status, recvmsg, strerror, NULL); + ogs_free(strerror); + + return false; +} diff --git a/src/nssf/nnssf-handler.h b/src/nssf/nnssf-handler.h new file mode 100644 index 000000000..20635b66d --- /dev/null +++ b/src/nssf/nnssf-handler.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_NNSSF_HANDLER_H +#define NSSF_NNSSF_HANDLER_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +bool nssf_nnrf_nsselection_handle_get( + ogs_sbi_stream_t *stream, ogs_sbi_message_t *message); + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_NNSSF_HANDLER_H */ diff --git a/src/nssf/nssf-sm.c b/src/nssf/nssf-sm.c new file mode 100644 index 000000000..351f95c15 --- /dev/null +++ b/src/nssf/nssf-sm.c @@ -0,0 +1,262 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "sbi-path.h" +#include "nnrf-handler.h" +#include "nnssf-handler.h" + +void nssf_state_initial(ogs_fsm_t *s, nssf_event_t *e) +{ + nssf_sm_debug(e); + + ogs_assert(s); + + OGS_FSM_TRAN(s, &nssf_state_operational); +} + +void nssf_state_final(ogs_fsm_t *s, nssf_event_t *e) +{ + nssf_sm_debug(e); + + ogs_assert(s); +} + +void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e) +{ + int rv; + const char *api_version = NULL; + + ogs_sbi_stream_t *stream = NULL; + ogs_sbi_request_t *request = NULL; + + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_subscription_t *subscription = NULL; + ogs_sbi_response_t *response = NULL; + ogs_sbi_message_t message; + + nssf_sm_debug(e); + + ogs_assert(s); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + rv = nssf_sbi_open(); + if (rv != OGS_OK) { + ogs_fatal("Can't establish SBI path"); + } + + break; + + case OGS_FSM_EXIT_SIG: + nssf_sbi_close(); + break; + + case NSSF_EVT_SBI_SERVER: + request = e->sbi.request; + ogs_assert(request); + stream = e->sbi.data; + ogs_assert(stream); + + rv = ogs_sbi_parse_request(&message, request); + if (rv != OGS_OK) { + /* 'message' buffer is released in ogs_sbi_parse_request() */ + ogs_error("cannot parse HTTP message"); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + NULL, "cannot parse HTTP message", NULL); + break; + } + + SWITCH(message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION) + api_version = OGS_SBI_API_V2; + break; + DEFAULT + api_version = OGS_SBI_API_V1; + END + + if (strcmp(message.h.api.version, api_version) != 0) { + ogs_error("Not supported version [%s]", message.h.api.version); + ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + &message, "Not supported version", NULL); + ogs_sbi_message_free(&message); + break; + } + + SWITCH(message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION) + + SWITCH(message.h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION) + SWITCH(message.h.method) + CASE(OGS_SBI_HTTP_METHOD_GET) + nssf_nnrf_nsselection_handle_get(stream, &message); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", message.h.method); + ogs_sbi_server_send_error(stream, + OGS_SBI_HTTP_STATUS_FORBIDDEN, + &message, "Invalid HTTP method", message.h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message.h.resource.component[0]); + ogs_sbi_server_send_error(stream, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, + "Unknown resource name", + message.h.resource.component[0]); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", message.h.service.name); + ogs_sbi_server_send_error(stream, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, &message, + "Invalid API name", message.h.resource.component[0]); + END + + /* In lib/sbi/server.c, notify_completed() releases 'request' buffer. */ + ogs_sbi_message_free(&message); + break; + + case NSSF_EVT_SBI_CLIENT: + ogs_assert(e); + + response = e->sbi.response; + ogs_assert(response); + rv = ogs_sbi_parse_response(&message, response); + if (rv != OGS_OK) { + ogs_error("cannot parse HTTP response"); + ogs_sbi_message_free(&message); + ogs_sbi_response_free(response); + break; + } + + if (strcmp(message.h.api.version, OGS_SBI_API_V1) != 0) { + ogs_error("Not supported version [%s]", message.h.api.version); + ogs_sbi_message_free(&message); + ogs_sbi_response_free(response); + break; + } + + SWITCH(message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM) + + SWITCH(message.h.resource.component[0]) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); + + e->sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + break; + + CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) + subscription = e->sbi.data; + ogs_assert(subscription); + + SWITCH(message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED || + message.res_status == OGS_SBI_HTTP_STATUS_OK) { + nssf_nnrf_handle_nf_status_subscribe( + subscription, &message); + } else { + ogs_error("[%s] HTTP response error [%d]", + subscription->id, message.res_status); + } + break; + + CASE(OGS_SBI_HTTP_METHOD_DELETE) + if (message.res_status == + OGS_SBI_HTTP_STATUS_NO_CONTENT) { + ogs_sbi_subscription_remove(subscription); + } else { + ogs_error("[%s] HTTP response error [%d]", + subscription->id, message.res_status); + } + break; + + DEFAULT + ogs_error("[%s] Invalid HTTP method [%s]", + subscription->id, message.h.method); + ogs_assert_if_reached(); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message.h.resource.component[0]); + ogs_assert_if_reached(); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", message.h.service.name); + ogs_assert_if_reached(); + END + + ogs_sbi_message_free(&message); + ogs_sbi_response_free(response); + break; + + case NSSF_EVT_SBI_TIMER: + ogs_assert(e); + + switch(e->timer_id) { + case NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + case NSSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + case NSSF_TIMER_NF_INSTANCE_NO_HEARTBEAT: + case NSSF_TIMER_NF_INSTANCE_VALIDITY: + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); + + ogs_fsm_dispatch(&nf_instance->sm, e); + if (OGS_FSM_CHECK(&nf_instance->sm, nssf_nf_state_exception)) + ogs_error("[%s] State machine exception [%d]", + nf_instance->id, e->timer_id); + break; + + case NSSF_TIMER_SUBSCRIPTION_VALIDITY: + subscription = e->sbi.data; + ogs_assert(subscription); + + ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client, + nssf_self()->nf_type, subscription->req_nf_instance_id, + subscription->subscr_cond.nf_type); + + ogs_info("[%s] Subscription validity expired", subscription->id); + ogs_sbi_subscription_remove(subscription); + break; + + default: + ogs_error("Unknown timer[%s:%d]", + nssf_timer_get_name(e->timer_id), e->timer_id); + } + break; + + default: + ogs_error("No handler for event %s", nssf_event_get_name(e)); + break; + } +} diff --git a/src/nssf/nssf-sm.h b/src/nssf/nssf-sm.h new file mode 100644 index 000000000..83d812d10 --- /dev/null +++ b/src/nssf/nssf-sm.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_SM_H +#define NSSF_SM_H + +#include "event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void nssf_state_initial(ogs_fsm_t *s, nssf_event_t *e); +void nssf_state_final(ogs_fsm_t *s, nssf_event_t *e); +void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e); + +void nssf_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance); +void nssf_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance); + +void nssf_nf_state_initial(ogs_fsm_t *s, nssf_event_t *e); +void nssf_nf_state_final(ogs_fsm_t *s, nssf_event_t *e); +void nssf_nf_state_will_register(ogs_fsm_t *s, nssf_event_t *e); +void nssf_nf_state_registered(ogs_fsm_t *s, nssf_event_t *e); +void nssf_nf_state_de_registered(ogs_fsm_t *s, nssf_event_t *e); +void nssf_nf_state_exception(ogs_fsm_t *s, nssf_event_t *e); + +#define nssf_sm_debug(__pe) \ + ogs_debug("%s(): %s", __func__, nssf_event_get_name(__pe)) + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_SM_H */ diff --git a/src/nssf/sbi-path.c b/src/nssf/sbi-path.c new file mode 100644 index 000000000..8a977b241 --- /dev/null +++ b/src/nssf/sbi-path.c @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "sbi-path.h" + +static int server_cb(ogs_sbi_request_t *request, void *data) +{ + nssf_event_t *e = NULL; + int rv; + + ogs_assert(request); + ogs_assert(data); + + e = nssf_event_new(NSSF_EVT_SBI_SERVER); + ogs_assert(e); + + e->sbi.request = request; + e->sbi.data = data; + + rv = ogs_queue_push(ogs_app()->queue, e); + if (rv != OGS_OK) { + ogs_warn("ogs_queue_push() failed:%d", (int)rv); + nssf_event_free(e); + return OGS_ERROR; + } + + return OGS_OK; +} + +static int client_cb(ogs_sbi_response_t *response, void *data) +{ + nssf_event_t *e = NULL; + int rv; + + ogs_assert(response); + + e = nssf_event_new(NSSF_EVT_SBI_CLIENT); + ogs_assert(e); + e->sbi.response = response; + e->sbi.data = data; + + rv = ogs_queue_push(ogs_app()->queue, e); + if (rv != OGS_OK) { + ogs_warn("ogs_queue_push() failed:%d", (int)rv); + nssf_event_free(e); + return OGS_ERROR; + } + + return OGS_OK; +} + +int nssf_sbi_open(void) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_sbi_server_start_all(server_cb); + + /* + * The connection between NF and NRF is a little special. + * + * NF and NRF share nf_instance. I get the NRF EndPoint(client) information + * the configuration file via lib/sbi/context.c. + * And, the NFService information will be transmitted to NRF. + * + * ogs_sbi_self()->nf_instance_id means NF's InstanceId. + */ + ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) { + ogs_sbi_nf_service_t *service = NULL; + ogs_sbi_client_t *client = NULL; + + /* Build NF instance information. It will be transmitted to NRF. */ + ogs_sbi_nf_instance_build_default(nf_instance, nssf_self()->nf_type); + + /* Build NF service information. It will be transmitted to NRF. */ + service = ogs_sbi_nf_service_build_default(nf_instance, + (char*)OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION); + ogs_assert(service); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V2, + (char*)OGS_SBI_API_V2_0_0, NULL); + + /* Client callback is only used when NF sends to NRF */ + client = nf_instance->client; + ogs_assert(client); + client->cb = client_cb; + + /* NFRegister is sent and the response is received + * by the above client callback. */ + nssf_nf_fsm_init(nf_instance); + } + + return OGS_OK; +} + +void nssf_sbi_close(void) +{ + ogs_sbi_server_stop_all(); +} + +void nssf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + request = nssf_nnrf_nfm_build_register(nf_instance); + if (!request) { + ogs_error("nssf_nnrf_nfm_send_nf_register() failed"); + return; + } + ogs_sbi_client_send_request(client, client->cb, request, nf_instance); +} diff --git a/src/nssf/sbi-path.h b/src/nssf/sbi-path.h new file mode 100644 index 000000000..8efd71871 --- /dev/null +++ b/src/nssf/sbi-path.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_SBI_PATH_H +#define NSSF_SBI_PATH_H + +#include "nnrf-build.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int nssf_sbi_open(void); +void nssf_sbi_close(void); + +void nssf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_SBI_PATH_H */ diff --git a/src/nssf/timer.c b/src/nssf/timer.c new file mode 100644 index 000000000..e5456ddfd --- /dev/null +++ b/src/nssf/timer.c @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "context.h" + +const char *nssf_timer_get_name(nssf_timer_e id) +{ + switch (id) { + case NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + return "NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL"; + case NSSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + return "NSSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL"; + case NSSF_TIMER_NF_INSTANCE_NO_HEARTBEAT: + return "NSSF_TIMER_NF_INSTANCE_NO_HEARTBEAT"; + case NSSF_TIMER_NF_INSTANCE_VALIDITY: + return "NSSF_TIMER_NF_INSTANCE_VALIDITY"; + case NSSF_TIMER_SUBSCRIPTION_VALIDITY: + return "NSSF_TIMER_SUBSCRIPTION_VALIDITY"; + default: + break; + } + + return "UNKNOWN_TIMER"; +} + +static void sbi_timer_send_event(int timer_id, void *data) +{ + int rv; + nssf_event_t *e = NULL; + ogs_assert(data); + + switch (timer_id) { + case NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + case NSSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + case NSSF_TIMER_NF_INSTANCE_NO_HEARTBEAT: + case NSSF_TIMER_NF_INSTANCE_VALIDITY: + case NSSF_TIMER_SUBSCRIPTION_VALIDITY: + e = nssf_event_new(NSSF_EVT_SBI_TIMER); + ogs_assert(e); + e->timer_id = timer_id; + e->sbi.data = data; + break; + default: + ogs_fatal("Unknown timer id[%d]", timer_id); + ogs_assert_if_reached(); + break; + } + + rv = ogs_queue_push(ogs_app()->queue, e); + if (rv != OGS_OK) { + ogs_warn("ogs_queue_push() failed [%d] in %s", + (int)rv, nssf_timer_get_name(e->timer_id)); + nssf_event_free(e); + } +} + +void nssf_timer_nf_instance_registration_interval(void *data) +{ + sbi_timer_send_event(NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL, data); +} + +void nssf_timer_nf_instance_heartbeat_interval(void *data) +{ + sbi_timer_send_event(NSSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, data); +} + +void nssf_timer_nf_instance_no_heartbeat(void *data) +{ + sbi_timer_send_event(NSSF_TIMER_NF_INSTANCE_NO_HEARTBEAT, data); +} + +void nssf_timer_nf_instance_validity(void *data) +{ + sbi_timer_send_event(NSSF_TIMER_NF_INSTANCE_VALIDITY, data); +} + +void nssf_timer_subscription_validity(void *data) +{ + sbi_timer_send_event(NSSF_TIMER_SUBSCRIPTION_VALIDITY, data); +} diff --git a/src/nssf/timer.h b/src/nssf/timer.h new file mode 100644 index 000000000..549574d18 --- /dev/null +++ b/src/nssf/timer.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NSSF_TIMER_H +#define NSSF_TIMER_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* forward declaration */ +typedef enum { + NSSF_TIMER_BASE = 0, + + NSSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL, + NSSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, + NSSF_TIMER_NF_INSTANCE_NO_HEARTBEAT, + NSSF_TIMER_NF_INSTANCE_VALIDITY, + NSSF_TIMER_SUBSCRIPTION_VALIDITY, + + MAX_NUM_OF_NSSF_TIMER, + +} nssf_timer_e; + +const char *nssf_timer_get_name(nssf_timer_e id); + +void nssf_timer_nf_instance_registration_interval(void *data); +void nssf_timer_nf_instance_heartbeat_interval(void *data); +void nssf_timer_nf_instance_no_heartbeat(void *data); +void nssf_timer_nf_instance_validity(void *data); +void nssf_timer_subscription_validity(void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* NSSF_TIMER_H */ diff --git a/src/pcf/context.c b/src/pcf/context.c index b413fac7e..810534151 100644 --- a/src/pcf/context.c +++ b/src/pcf/context.c @@ -320,3 +320,25 @@ pcf_sess_t *pcf_sess_cycle(pcf_sess_t *sess) { return ogs_pool_cycle(&pcf_sess_pool, sess); } + +void pcf_ue_select_nf(pcf_ue_t *pcf_ue, OpenAPI_nf_type_e nf_type) +{ + ogs_assert(pcf_ue); + ogs_assert(nf_type); + + if (nf_type == OpenAPI_nf_type_NRF) + ogs_sbi_select_nrf(&pcf_ue->sbi, pcf_nf_state_registered); + else + ogs_sbi_select_first_nf(&pcf_ue->sbi, nf_type, pcf_nf_state_registered); +} + +void pcf_sess_select_nf(pcf_sess_t *sess, OpenAPI_nf_type_e nf_type) +{ + ogs_assert(sess); + ogs_assert(nf_type); + + if (nf_type == OpenAPI_nf_type_NRF) + ogs_sbi_select_nrf(&sess->sbi, pcf_nf_state_registered); + else + ogs_sbi_select_first_nf(&sess->sbi, nf_type, pcf_nf_state_registered); +} diff --git a/src/pcf/context.h b/src/pcf/context.h index 2cf6a51e9..8d6192577 100644 --- a/src/pcf/context.h +++ b/src/pcf/context.h @@ -127,6 +127,9 @@ pcf_sess_t *pcf_sess_find_by_dnn(pcf_ue_t *pcf_ue, char *dnn); pcf_ue_t *pcf_ue_cycle(pcf_ue_t *pcf_ue); pcf_sess_t *pcf_sess_cycle(pcf_sess_t *sess); +void pcf_ue_select_nf(pcf_ue_t *pcf_ue, OpenAPI_nf_type_e nf_type); +void pcf_sess_select_nf(pcf_sess_t *sess, OpenAPI_nf_type_e nf_type); + #ifdef __cplusplus } #endif diff --git a/src/pcf/meson.build b/src/pcf/meson.build index 4a441cabe..ec4b30a61 100644 --- a/src/pcf/meson.build +++ b/src/pcf/meson.build @@ -20,6 +20,7 @@ libpcf_sources = files(''' event.c timer.c + nnrf-build.c nnrf-handler.c nf-sm.c diff --git a/src/pcf/nf-sm.c b/src/pcf/nf-sm.c index 16c4d7e2a..6061692e5 100644 --- a/src/pcf/nf-sm.c +++ b/src/pcf/nf-sm.c @@ -109,7 +109,7 @@ void pcf_nf_state_will_register(ogs_fsm_t *s, pcf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + pcf_nnrf_nfm_send_nf_register(nf_instance); break; case OGS_FSM_EXIT_SIG: @@ -164,7 +164,7 @@ void pcf_nf_state_will_register(ogs_fsm_t *s, pcf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + pcf_nnrf_nfm_send_nf_register(nf_instance); break; default: diff --git a/src/pcf/nnrf-build.c b/src/pcf/nnrf-build.c new file mode 100644 index 000000000..de35b75d8 --- /dev/null +++ b/src/pcf/nnrf-build.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnrf-build.h" + +ogs_sbi_request_t *pcf_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); + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return request; +} diff --git a/src/pcf/nnrf-build.h b/src/pcf/nnrf-build.h new file mode 100644 index 000000000..034a872d5 --- /dev/null +++ b/src/pcf/nnrf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef PCF_NNRF_BUILD_H +#define PCF_NNRF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *pcf_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* PCF_NNRF_BUILD_H */ diff --git a/src/pcf/nnrf-handler.c b/src/pcf/nnrf-handler.c index b198413fc..7b2115732 100644 --- a/src/pcf/nnrf-handler.c +++ b/src/pcf/nnrf-handler.c @@ -287,6 +287,9 @@ void pcf_nnrf_handle_nf_discover( } if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { + pcf_ue_t *pcf_ue = NULL; + pcf_sess_t *sess = NULL; + handled = ogs_sbi_nnrf_handle_nf_profile( nf_instance, NFProfile, NULL, NULL); if (!handled) { @@ -303,10 +306,22 @@ void pcf_nnrf_handle_nf_discover( continue; } - if (!OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, nf_instance->nf_type)) - ogs_sbi_nf_instance_associate(sbi_object->nf_type_array, - nf_instance->nf_type, pcf_nf_state_registered); + switch(sbi_object->type) { + case OGS_SBI_OBJ_UE_TYPE: + pcf_ue = (pcf_ue_t *)sbi_object; + ogs_assert(pcf_ue); + pcf_ue_select_nf(pcf_ue, nf_instance->nf_type); + break; + case OGS_SBI_OBJ_SESS_TYPE: + sess = (pcf_sess_t *)sbi_object; + ogs_assert(sess); + pcf_sess_select_nf(sess, nf_instance->nf_type); + break; + default: + ogs_fatal("(NF discover search result) Not implemented [%d]", + sbi_object->type); + ogs_assert_if_reached(); + } /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -326,8 +341,7 @@ void pcf_nnrf_handle_nf_discover( } ogs_assert(xact->target_nf_type); - nf_instance = OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, xact->target_nf_type); + nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, xact->target_nf_type); if (!nf_instance) { ogs_assert(sbi_object->type > OGS_SBI_OBJ_BASE && sbi_object->type < OGS_SBI_OBJ_TOP); diff --git a/src/pcf/nudr-build.c b/src/pcf/nudr-build.c index 563c4016c..fc99b9f34 100644 --- a/src/pcf/nudr-build.c +++ b/src/pcf/nudr-build.c @@ -64,7 +64,8 @@ ogs_sbi_request_t *pcf_nudr_dr_build_query_sm_data( message.h.resource.component[3] = (char *)OGS_SBI_RESOURCE_NAME_SM_DATA; message.param.snssai_presence = true; - memcpy(&message.param.snssai, &sess->s_nssai, sizeof(message.param.snssai)); + memcpy(&message.param.s_nssai, &sess->s_nssai, + sizeof(message.param.s_nssai)); if (sess->dnn) message.param.dnn = sess->dnn; diff --git a/src/pcf/nudr-handler.c b/src/pcf/nudr-handler.c index 1d36ad545..014ed0f92 100644 --- a/src/pcf/nudr-handler.c +++ b/src/pcf/nudr-handler.c @@ -30,6 +30,8 @@ bool pcf_nudr_dr_handle_query_am_data( ogs_sbi_header_t header; ogs_sbi_response_t *response = NULL; + ogs_subscription_data_t subscription_data; + ogs_assert(pcf_ue); ogs_assert(stream); server = ogs_sbi_server_from_stream(stream); @@ -37,10 +39,10 @@ bool pcf_nudr_dr_handle_query_am_data( ogs_assert(recvmsg); + memset(&subscription_data, 0, sizeof(ogs_subscription_data_t)); + SWITCH(recvmsg->h.resource.component[3]) CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) - ogs_subscription_data_t subscription_data; - OpenAPI_policy_association_t PolicyAssociation; OpenAPI_ambr_t UeAmbr; OpenAPI_list_t *TriggerList = NULL; @@ -141,6 +143,8 @@ bool pcf_nudr_dr_handle_query_am_data( if (UeAmbr.downlink) ogs_free(UeAmbr.downlink); + ogs_subscription_data_free(&subscription_data); + return true; DEFAULT @@ -155,6 +159,8 @@ cleanup: ogs_sbi_server_send_error(stream, status, recvmsg, strerror, NULL); ogs_free(strerror); + ogs_subscription_data_free(&subscription_data); + return false; } @@ -185,7 +191,7 @@ bool pcf_nudr_dr_handle_query_sm_data( SWITCH(recvmsg->h.resource.component[3]) CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) - ogs_pdn_t *pdn = NULL; + ogs_session_t *session = NULL; OpenAPI_sm_policy_decision_t SmPolicyDecision; @@ -219,7 +225,8 @@ bool pcf_nudr_dr_handle_query_sm_data( ogs_assert(pcf_ue->supi); ogs_assert(sess->dnn); - rv = ogs_dbi_session_data(pcf_ue->supi, sess->dnn, &session_data); + rv = ogs_dbi_session_data( + pcf_ue->supi, &sess->s_nssai, sess->dnn, &session_data); if (rv != OGS_OK) { strerror = ogs_msprintf("[%s:%d] Cannot find SUPI in DB", pcf_ue->supi, sess->psi); @@ -227,21 +234,21 @@ bool pcf_nudr_dr_handle_query_sm_data( goto cleanup; } - pdn = &session_data.pdn; + session = &session_data.session; - if (!pdn->qos.qci) { - strerror = ogs_msprintf("[%s:%d] No QCI", pcf_ue->supi, sess->psi); + if (!session->qos.index) { + strerror = ogs_msprintf("[%s:%d] No 5QI", pcf_ue->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } - if (!pdn->qos.arp.priority_level) { + if (!session->qos.arp.priority_level) { strerror = ogs_msprintf("[%s:%d] No Priority Level", pcf_ue->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } - if (!pdn->ambr.uplink && !pdn->ambr.downlink) { + if (!session->ambr.uplink && !session->ambr.downlink) { strerror = ogs_msprintf("[%s:%d] No Session-AMBR", pcf_ue->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; @@ -275,9 +282,9 @@ bool pcf_nudr_dr_handle_query_sm_data( subscribed_sess_ambr.downlink = ogs_sbi_bitrate_from_string( sess->subscribed_sess_ambr->downlink); if (((subscribed_sess_ambr.uplink / 1024) != - (pdn->ambr.uplink / 1024)) || + (session->ambr.uplink / 1024)) || ((subscribed_sess_ambr.downlink / 1024) != - (pdn->ambr.downlink / 1024))) { + (session->ambr.downlink / 1024))) { OpenAPI_list_add(PolicyCtrlReqTriggers, (void *)OpenAPI_policy_control_request_trigger_SE_AMBR_CH); @@ -285,9 +292,9 @@ bool pcf_nudr_dr_handle_query_sm_data( memset(&AuthSessAmbr, 0, sizeof(AuthSessAmbr)); AuthSessAmbr.uplink = ogs_sbi_bitrate_to_string( - pdn->ambr.uplink, OGS_SBI_BITRATE_KBPS); + session->ambr.uplink, OGS_SBI_BITRATE_KBPS); AuthSessAmbr.downlink = ogs_sbi_bitrate_to_string( - pdn->ambr.downlink, OGS_SBI_BITRATE_KBPS); + session->ambr.downlink, OGS_SBI_BITRATE_KBPS); SessionRule->auth_sess_ambr = &AuthSessAmbr; } } @@ -299,24 +306,29 @@ bool pcf_nudr_dr_handle_query_sm_data( AuthDefQos.arp = ogs_calloc(1, sizeof(OpenAPI_arp_t)); ogs_assert(AuthDefQos.arp); - AuthDefQos._5qi = pdn->qos.qci; - AuthDefQos.priority_level = pdn->qos.arp.priority_level; + AuthDefQos._5qi = session->qos.index; + AuthDefQos.priority_level = session->qos.arp.priority_level; - if (pdn->qos.arp.pre_emption_capability == - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED) + if (session->qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_ENABLED) AuthDefQos.arp->preempt_cap = OpenAPI_preemption_capability_MAY_PREEMPT; - else + else if (session->qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_DISABLED) AuthDefQos.arp->preempt_cap = OpenAPI_preemption_capability_NOT_PREEMPT; - if (pdn->qos.arp.pre_emption_vulnerability == - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED) + ogs_assert(AuthDefQos.arp->preempt_cap); + + if (session->qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_ENABLED) AuthDefQos.arp->preempt_vuln = OpenAPI_preemption_vulnerability_PREEMPTABLE; - else + else if (session->qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_DISABLED) AuthDefQos.arp->preempt_vuln = OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE; - AuthDefQos.arp->priority_level = pdn->qos.arp.priority_level; + ogs_assert(AuthDefQos.arp->preempt_vuln); + AuthDefQos.arp->priority_level = session->qos.arp.priority_level; SessionRule->auth_def_qos = &AuthDefQos; @@ -424,26 +436,31 @@ bool pcf_nudr_dr_handle_query_sm_data( OpenAPI_list_add(PccRuleList, PccRuleMap); - QosData->_5qi = pcc_rule->qos.qci; + QosData->_5qi = pcc_rule->qos.index; QosData->priority_level = pcc_rule->qos.arp.priority_level; QosData->arp = ogs_calloc(1, sizeof(OpenAPI_arp_t)); ogs_assert(QosData->arp); if (pcc_rule->qos.arp.pre_emption_capability == - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED) + OGS_5GC_PRE_EMPTION_ENABLED) QosData->arp->preempt_cap = OpenAPI_preemption_capability_MAY_PREEMPT; - else + else if (pcc_rule->qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_DISABLED) QosData->arp->preempt_cap = OpenAPI_preemption_capability_NOT_PREEMPT; + ogs_assert(pcc_rule->qos.arp.pre_emption_capability); + if (pcc_rule->qos.arp.pre_emption_vulnerability == - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED) + OGS_5GC_PRE_EMPTION_ENABLED) QosData->arp->preempt_vuln = OpenAPI_preemption_vulnerability_PREEMPTABLE; - else + else if (pcc_rule->qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_DISABLED) QosData->arp->preempt_vuln = OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE; + ogs_assert(pcc_rule->qos.arp.pre_emption_vulnerability); QosData->arp->priority_level = pcc_rule->qos.arp.priority_level; if (pcc_rule->qos.mbr.uplink) @@ -576,6 +593,7 @@ bool pcf_nudr_dr_handle_query_sm_data( cleanup: ogs_assert(strerror); + ogs_assert(status); ogs_error("%s", strerror); ogs_sbi_server_send_error(stream, status, recvmsg, strerror, NULL); ogs_free(strerror); diff --git a/src/pcf/sbi-path.c b/src/pcf/sbi-path.c index 0af047a95..b5f71617e 100644 --- a/src/pcf/sbi-path.c +++ b/src/pcf/sbi-path.c @@ -118,6 +118,23 @@ void pcf_sbi_close(void) ogs_sbi_server_stop_all(); } +void pcf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + request = pcf_nnrf_nfm_build_register(nf_instance); + if (!request) { + ogs_error("ogs_nnrf_nfm_send_nf_register() failed"); + return; + } + ogs_sbi_client_send_request(client, client->cb, request, nf_instance); +} + void pcf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact) { ogs_sbi_send(nf_instance, client_cb, xact); diff --git a/src/pcf/sbi-path.h b/src/pcf/sbi-path.h index ccb2cc53f..ab5931b75 100644 --- a/src/pcf/sbi-path.h +++ b/src/pcf/sbi-path.h @@ -20,6 +20,7 @@ #ifndef PCF_SBI_PATH_H #define PCF_SBI_PATH_H +#include "nnrf-build.h" #include "nudr-build.h" #ifdef __cplusplus @@ -33,6 +34,8 @@ extern "C" { int pcf_sbi_open(void); void pcf_sbi_close(void); +void pcf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); + void pcf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact); void pcf_ue_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type, pcf_ue_t *pcf_ue, ogs_sbi_stream_t *stream, void *data, diff --git a/src/pcrf/pcrf-context.c b/src/pcrf/pcrf-context.c index 495833092..7aa1f39ed 100644 --- a/src/pcrf/pcrf-context.c +++ b/src/pcrf/pcrf-context.c @@ -267,6 +267,7 @@ int pcrf_db_qos_data( { int rv; char *supi = NULL; + ogs_s_nssai_t s_nssai; ogs_assert(imsi_bcd); ogs_assert(apn); @@ -276,7 +277,11 @@ int pcrf_db_qos_data( supi = ogs_msprintf("%s-%s", OGS_ID_SUPI_TYPE_IMSI, imsi_bcd); ogs_assert(supi); - rv = ogs_dbi_session_data(supi, apn, session_data); + /* For EPC, we'll use SST:1 */ + s_nssai.sst = 1; + s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE; + + rv = ogs_dbi_session_data(supi, &s_nssai, apn, session_data); ogs_free(supi); ogs_thread_mutex_unlock(&self.db_lock); diff --git a/src/pcrf/pcrf-gx-path.c b/src/pcrf/pcrf-gx-path.c index 4b845e96b..31ca2a7d7 100644 --- a/src/pcrf/pcrf-gx-path.c +++ b/src/pcrf/pcrf-gx-path.c @@ -455,27 +455,27 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, } /* Set QoS-Information */ - if (gx_message.session_data.pdn.ambr.downlink || - gx_message.session_data.pdn.ambr.uplink) { + if (gx_message.session_data.session.ambr.downlink || + gx_message.session_data.session.ambr.uplink) { ret = fd_msg_avp_new(ogs_diam_gx_qos_information, 0, &avp); ogs_assert(ret == 0); - if (gx_message.session_data.pdn.ambr.uplink) { + if (gx_message.session_data.session.ambr.uplink) { ret = fd_msg_avp_new( ogs_diam_gx_apn_aggregate_max_bitrate_ul, 0, &avpch1); ogs_assert(ret == 0); - val.u32 = gx_message.session_data.pdn.ambr.uplink; + val.u32 = gx_message.session_data.session.ambr.uplink; ret = fd_msg_avp_setvalue (avpch1, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); ogs_assert(ret == 0); } - if (gx_message.session_data.pdn.ambr.downlink) { + if (gx_message.session_data.session.ambr.downlink) { ret = fd_msg_avp_new( ogs_diam_gx_apn_aggregate_max_bitrate_dl, 0, &avpch1); ogs_assert(ret == 0); - val.u32 = gx_message.session_data.pdn.ambr.downlink; + val.u32 = gx_message.session_data.session.ambr.downlink; ret = fd_msg_avp_setvalue (avpch1, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); @@ -492,7 +492,7 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, ret = fd_msg_avp_new(ogs_diam_gx_qos_class_identifier, 0, &avpch1); ogs_assert(ret == 0); - val.u32 = gx_message.session_data.pdn.qos.qci; + val.u32 = gx_message.session_data.session.qos.index; ret = fd_msg_avp_setvalue (avpch1, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); @@ -504,7 +504,7 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, ret = fd_msg_avp_new(ogs_diam_gx_priority_level, 0, &avpch2); ogs_assert(ret == 0); - val.u32 = gx_message.session_data.pdn.qos.arp.priority_level; + val.u32 = gx_message.session_data.session.qos.arp.priority_level; ret = fd_msg_avp_setvalue (avpch2, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); @@ -512,7 +512,10 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, ret = fd_msg_avp_new(ogs_diam_gx_pre_emption_capability, 0, &avpch2); ogs_assert(ret == 0); - val.u32 = gx_message.session_data.pdn.qos.arp.pre_emption_capability; + val.u32 = OGS_EPC_PRE_EMPTION_DISABLED; + if (gx_message.session_data.session.qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_ENABLED) + val.u32 = OGS_EPC_PRE_EMPTION_ENABLED; ret = fd_msg_avp_setvalue (avpch2, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); @@ -520,7 +523,10 @@ static int pcrf_gx_ccr_cb( struct msg **msg, struct avp *avp, ret = fd_msg_avp_new(ogs_diam_gx_pre_emption_vulnerability, 0, &avpch2); ogs_assert(ret == 0); - val.u32 = gx_message.session_data.pdn.qos.arp.pre_emption_vulnerability; + val.u32 = OGS_EPC_PRE_EMPTION_DISABLED; + if (gx_message.session_data.session.qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_ENABLED) + val.u32 = OGS_EPC_PRE_EMPTION_ENABLED; ret = fd_msg_avp_setvalue (avpch2, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); @@ -729,7 +735,7 @@ int pcrf_gx_send_rar( int flow_presence = 0; ogs_pcc_rule_t *pcc_rule = NULL; ogs_pcc_rule_t *db_pcc_rule = NULL; - uint8_t qci = 0; + uint8_t qos_index = 0; ogs_diam_rx_media_component_t *media_component = &rx_message->media_component[i]; @@ -739,13 +745,13 @@ int pcrf_gx_send_rar( switch(media_component->media_type) { case OGS_DIAM_RX_MEDIA_TYPE_AUDIO: - qci = OGS_PDN_QCI_1; + qos_index = OGS_QOS_INDEX_1; break; case OGS_DIAM_RX_MEDIA_TYPE_VIDEO: - qci = OGS_PDN_QCI_2; + qos_index = OGS_QOS_INDEX_2; break; case OGS_DIAM_RX_MEDIA_TYPE_CONTROL: - qci = OGS_PDN_QCI_5; + qos_index = OGS_QOS_INDEX_5; break; default: ogs_error("Not implemented : [Media-Type:%d]", @@ -755,7 +761,8 @@ int pcrf_gx_send_rar( } for (j = 0; j < gx_message.session_data.num_of_pcc_rule; j++) { - if (gx_message.session_data.pcc_rule[j].qos.qci == qci) { + if (gx_message.session_data.pcc_rule[j].qos.index == + qos_index) { db_pcc_rule = &gx_message.session_data.pcc_rule[j]; break; } @@ -767,12 +774,14 @@ int pcrf_gx_send_rar( * Check for default bearer for IMS signalling * QCI 5 and ARP 1 */ - if (gx_message.session_data.pdn.qos.qci != OGS_PDN_QCI_5 || - gx_message.session_data.pdn.qos.arp.priority_level != 1) { + if (gx_message.session_data. + session.qos.index != OGS_QOS_INDEX_5 || + gx_message.session_data. + session.qos.arp.priority_level != 1) { ogs_error("CHECK WEBUI : Even the Default " "Bearer(QCI:%d,ARP:%d) cannot support IMS signalling.", - gx_message.session_data.pdn.qos.qci, - gx_message.session_data.pdn.qos.arp.priority_level); + gx_message.session_data.session.qos.index, + gx_message.session_data.session.qos.arp.priority_level); rx_message->result_code = OGS_DIAM_RX_DIAMETER_REQUESTED_SERVICE_NOT_AUTHORIZED; goto out; @@ -782,7 +791,8 @@ int pcrf_gx_send_rar( } if (!db_pcc_rule) { - ogs_error("CHECK WEBUI : No PCC Rule in DB [QCI:%d]", qci); + ogs_error("CHECK WEBUI : No PCC Rule in DB [QoS Index:%d]", + qos_index); ogs_error("Please add PCC Rule using WEBUI"); rx_message->result_code = OGS_DIAM_RX_DIAMETER_REQUESTED_SERVICE_NOT_AUTHORIZED; @@ -790,7 +800,7 @@ int pcrf_gx_send_rar( } for (j = 0; j < rx_sess_data->num_of_pcc_rule; j++) { - if (rx_sess_data->pcc_rule[j].qos.qci == qci) { + if (rx_sess_data->pcc_rule[j].qos.index == qos_index) { pcc_rule = &rx_sess_data->pcc_rule[j]; break; } @@ -1245,7 +1255,7 @@ static int encode_pcc_rule_definition( ret = fd_msg_avp_new(ogs_diam_gx_qos_class_identifier, 0, &avpch3); ogs_assert(ret == 0); - val.u32 = pcc_rule->qos.qci; + val.u32 = pcc_rule->qos.index; ret = fd_msg_avp_setvalue (avpch3, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch2, MSG_BRW_LAST_CHILD, avpch3); @@ -1264,7 +1274,9 @@ static int encode_pcc_rule_definition( ret = fd_msg_avp_new(ogs_diam_gx_pre_emption_capability, 0, &avpch4); ogs_assert(ret == 0); - val.u32 = pcc_rule->qos.arp.pre_emption_capability; + val.u32 = OGS_EPC_PRE_EMPTION_DISABLED; + if (pcc_rule->qos.arp.pre_emption_capability == OGS_5GC_PRE_EMPTION_ENABLED) + val.u32 = OGS_EPC_PRE_EMPTION_ENABLED; ret = fd_msg_avp_setvalue (avpch4, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4); @@ -1272,7 +1284,10 @@ static int encode_pcc_rule_definition( ret = fd_msg_avp_new(ogs_diam_gx_pre_emption_vulnerability, 0, &avpch4); ogs_assert(ret == 0); - val.u32 = pcc_rule->qos.arp.pre_emption_vulnerability; + val.u32 = OGS_EPC_PRE_EMPTION_DISABLED; + if (pcc_rule->qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_ENABLED) + val.u32 = OGS_EPC_PRE_EMPTION_ENABLED; ret = fd_msg_avp_setvalue (avpch4, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch3, MSG_BRW_LAST_CHILD, avpch4); diff --git a/src/sgwc/context.c b/src/sgwc/context.c index ceebc24ee..f7e345008 100644 --- a/src/sgwc/context.c +++ b/src/sgwc/context.c @@ -190,7 +190,7 @@ int sgwc_context_parse_config(void) 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 ( @@ -413,7 +413,8 @@ sgwc_sess_t *sgwc_sess_add(sgwc_ue_t *sgwc_ue, char *apn) ogs_pfcp_bar_new(&sess->pfcp); /* Set APN */ - ogs_cpystrn(sess->pdn.apn, apn, OGS_MAX_APN_LEN+1); + sess->session.name = ogs_strdup(apn); + ogs_assert(sess->session.name); sess->sgwc_ue = sgwc_ue; @@ -434,8 +435,9 @@ static bool compare_ue_info(ogs_pfcp_node_t *node, sgwc_sess_t *sess) sgwc_ue = sess->sgwc_ue; ogs_assert(sgwc_ue); + ogs_assert(sess->session.name); for (i = 0; i < node->num_of_dnn; i++) - if (ogs_strcasecmp(node->dnn[i], sess->pdn.apn) == 0) return true; + if (ogs_strcasecmp(node->dnn[i], sess->session.name) == 0) return true; for (i = 0; i < node->num_of_e_cell_id; i++) if (node->e_cell_id[i] == sgwc_ue->e_cgi.cell_id) return true; @@ -540,6 +542,9 @@ int sgwc_sess_remove(sgwc_sess_t *sess) ogs_pfcp_pool_final(&sess->pfcp); + ogs_assert(sess->session.name); + ogs_free(sess->session.name); + ogs_pool_free(&sgwc_sess_pool, sess); stats_remove_sgwc_session(); @@ -580,7 +585,7 @@ sgwc_sess_t* sgwc_sess_find_by_apn(sgwc_ue_t *sgwc_ue, char *apn) ogs_assert(apn); ogs_list_for_each(&sgwc_ue->sess_list, sess) { - if (!ogs_strcasecmp(sess->pdn.apn, apn)) + if (!ogs_strcasecmp(sess->session.name, apn)) return sess; } @@ -810,17 +815,17 @@ sgwc_tunnel_t *sgwc_tunnel_add( ogs_assert(pdr); pdr->src_if = src_if; - if (strlen(sess->pdn.apn)) - pdr->apn = ogs_strdup(sess->pdn.apn); + if (sess->session.name) + pdr->apn = ogs_strdup(sess->session.name); pdr->outer_header_removal_len = 1; - if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { + if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) { pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) { pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP; } else @@ -843,7 +848,7 @@ sgwc_tunnel_t *sgwc_tunnel_add( } else { resource = ogs_pfcp_gtpu_resource_find( &sess->pfcp_node->gtpu_resource_list, - sess->pdn.apn, OGS_PFCP_INTERFACE_ACCESS); + sess->session.name, OGS_PFCP_INTERFACE_ACCESS); if (resource) { ogs_pfcp_user_plane_ip_resource_info_to_sockaddr(&resource->info, &tunnel->local_addr, &tunnel->local_addr6); diff --git a/src/sgwc/context.h b/src/sgwc/context.h index ea8e0f8cd..df314a6ee 100644 --- a/src/sgwc/context.h +++ b/src/sgwc/context.h @@ -105,7 +105,7 @@ typedef struct sgwc_sess_s { } state; /* APN Configuration */ - ogs_pdn_t pdn; + ogs_session_t session; ogs_list_t bearer_list; diff --git a/src/sgwc/s11-build.c b/src/sgwc/s11-build.c index 6e1001e28..71a7069fb 100644 --- a/src/sgwc/s11-build.c +++ b/src/sgwc/s11-build.c @@ -54,9 +54,10 @@ ogs_pkbuf_t *sgwc_s11_build_downlink_data_notification( noti->eps_bearer_id.u8 = bearer->ebi; memset(&arp, 0, sizeof(arp)); - arp.pre_emption_vulnerability = sess->pdn.qos.arp.pre_emption_vulnerability; - arp.priority_level = sess->pdn.qos.arp.priority_level; - arp.pre_emption_capability = sess->pdn.qos.arp.pre_emption_capability; + arp.pre_emption_vulnerability = + sess->session.qos.arp.pre_emption_vulnerability; + arp.priority_level = sess->session.qos.arp.priority_level; + arp.pre_emption_capability = sess->session.qos.arp.pre_emption_capability; noti->allocation_retention_priority.presence = 1; noti->allocation_retention_priority.data = &arp; diff --git a/src/sgwc/s11-handler.c b/src/sgwc/s11-handler.c index 0a1f9427b..34ffe3b91 100644 --- a/src/sgwc/s11-handler.c +++ b/src/sgwc/s11-handler.c @@ -194,7 +194,7 @@ void sgwc_s11_handle_create_session_request( req->bearer_contexts_to_be_created.eps_bearer_id.u8); if (sess) { ogs_warn("OLD Session Release [IMSI:%s,APN:%s]", - sgwc_ue->imsi_bcd, sess->pdn.apn); + sgwc_ue->imsi_bcd, sess->session.name); sgwc_sess_remove(sess); } sess = sgwc_sess_add(sgwc_ue, apn); @@ -227,16 +227,16 @@ void sgwc_s11_handle_create_session_request( &req->bearer_contexts_to_be_created.bearer_level_qos); ogs_assert(req->bearer_contexts_to_be_created.bearer_level_qos.len == decoded); - sess->pdn.qos.qci = bearer_qos.qci; - sess->pdn.qos.arp.priority_level = bearer_qos.priority_level; - sess->pdn.qos.arp.pre_emption_capability = + sess->session.qos.index = bearer_qos.qci; + sess->session.qos.arp.priority_level = bearer_qos.priority_level; + sess->session.qos.arp.pre_emption_capability = bearer_qos.pre_emption_capability; - sess->pdn.qos.arp.pre_emption_vulnerability = + sess->session.qos.arp.pre_emption_vulnerability = bearer_qos.pre_emption_vulnerability; /* Set PDN Type */ - sess->pdn.pdn_type = req->pdn_type.u8; - sess->pdn.paa.pdn_type = req->pdn_type.u8; + sess->session.session_type = req->pdn_type.u8; + sess->session.paa.session_type = req->pdn_type.u8; /* Remove all previous bearer */ sgwc_bearer_remove_all(sess); diff --git a/src/sgwc/s5c-handler.c b/src/sgwc/s5c-handler.c index 131efd758..acae98bac 100644 --- a/src/sgwc/s5c-handler.c +++ b/src/sgwc/s5c-handler.c @@ -118,14 +118,14 @@ void sgwc_s5c_handle_create_session_response( memcpy(&paa, rsp->pdn_address_allocation.data, ogs_min(sizeof(paa), rsp->pdn_address_allocation.len)); - if (paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { + if (paa.session_type == OGS_PDU_SESSION_TYPE_IPV4) { /* Nothing */ - } else if (paa.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { + } else if (paa.session_type == OGS_PDU_SESSION_TYPE_IPV6) { /* Nothing */ - } else if (paa.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + } else if (paa.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { /* Nothing */ } else { - ogs_error("Unknown PDN Type %u", paa.pdn_type); + ogs_error("Unknown PDN Type %u", paa.session_type); cause_value = OGS_GTP_CAUSE_MANDATORY_IE_INCORRECT; } diff --git a/src/sgwc/sxa-build.c b/src/sgwc/sxa-build.c index 5d30b2bdb..a14557f2d 100644 --- a/src/sgwc/sxa-build.c +++ b/src/sgwc/sxa-build.c @@ -97,7 +97,7 @@ ogs_pkbuf_t *sgwc_sxa_build_session_establishment_request( /* PDN Type */ req->pdn_type.presence = 1; - req->pdn_type.u8 = sess->pdn.paa.pdn_type; + req->pdn_type.u8 = sess->session.paa.session_type; pfcp_message.h.type = type; pkbuf = ogs_pfcp_build_msg(&pfcp_message); diff --git a/src/sgwu/context.c b/src/sgwu/context.c index 481c87926..8e3340cf7 100644 --- a/src/sgwu/context.c +++ b/src/sgwu/context.c @@ -195,7 +195,7 @@ int sgwu_context_parse_config(void) 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 ( @@ -218,7 +218,7 @@ int sgwu_context_parse_config(void) break; } - ogs_assert(adv_num <= + ogs_assert(adv_num < OGS_MAX_NUM_OF_HOSTNAME); adv_hostname[adv_num++] = ogs_yaml_iter_value(&adv_hostname_iter); @@ -397,9 +397,10 @@ int sgwu_context_parse_config(void) ogs_list_for_each_safe(&list6, next_iter, iter) ogs_list_add(&self.gtpu_list, iter); } - } else if (!strcmp(sgwu_key, "pdn")) { + } else if (!strcmp(sgwu_key, "pfcp")) { /* handle config in pfcp library */ - } + } else + ogs_warn("unknown key `%s`", sgwu_key); } } } diff --git a/src/sgwu/context.h b/src/sgwu/context.h index 42ed0185b..26c7f3943 100644 --- a/src/sgwu/context.h +++ b/src/sgwu/context.h @@ -58,9 +58,6 @@ typedef struct sgwu_sess_s { uint64_t sgwu_sxa_seid; /* SGW-U SEID is dervied from INDEX */ uint64_t sgwc_sxa_seid; /* SGW-C SEID is received from Peer */ - /* APN Configuration */ - ogs_pdn_t pdn; - ogs_pfcp_node_t *pfcp_node; } sgwu_sess_t; diff --git a/src/smf/binding.c b/src/smf/binding.c index 1b55e1eda..9fed4d92e 100644 --- a/src/smf/binding.c +++ b/src/smf/binding.c @@ -134,7 +134,7 @@ void smf_bearer_binding(smf_sess_t *sess) ogs_pfcp_pdr_t *dl_pdr = NULL, *ul_pdr = NULL; bearer = smf_bearer_find_by_qci_arp(sess, - pcc_rule->qos.qci, + pcc_rule->qos.index, pcc_rule->qos.arp.priority_level, pcc_rule->qos.arp.pre_emption_capability, pcc_rule->qos.arp.pre_emption_vulnerability); @@ -399,7 +399,7 @@ void smf_qos_flow_binding(smf_sess_t *sess, ogs_sbi_stream_t *stream) ogs_pfcp_pdr_t *dl_pdr = NULL, *ul_pdr = NULL; qos_flow = smf_bearer_find_by_qci_arp(sess, - pcc_rule->qos.qci, + pcc_rule->qos.index, pcc_rule->qos.arp.priority_level, pcc_rule->qos.arp.pre_emption_capability, pcc_rule->qos.arp.pre_emption_vulnerability); diff --git a/src/smf/context.c b/src/smf/context.c index e7b7325d3..8558b2658 100644 --- a/src/smf/context.c +++ b/src/smf/context.c @@ -127,14 +127,46 @@ static int smf_context_prepare(void) static int smf_context_validation(void) { + ogs_sbi_nf_info_t *nf_info = NULL; + if (self.dns[0] == NULL && self.dns6[0] == NULL) { ogs_error("No smf.dns in '%s'", ogs_app()->file); return OGS_ERROR; } if (ogs_list_first(&ogs_pfcp_self()->subnet_list) == NULL) { - ogs_error("No smf.pdn: in '%s'", ogs_app()->file); + ogs_error("No smf.subnet: in '%s'", ogs_app()->file); return OGS_ERROR; } + + ogs_list_for_each(&ogs_sbi_self()->nf_info_list, nf_info) { + int i; + ogs_sbi_smf_info_t *smf_info = &nf_info->smf; + ogs_assert(smf_info); + + if (smf_info->num_of_slice == 0) { + ogs_error("CHECK CONFIGURATION: No S-NSSAI in smfInfo"); + return OGS_ERROR; + } + + for (i = 0; i < smf_info->num_of_slice; i++) { + if (smf_info->slice[i].num_of_dnn == 0) { + ogs_error("CHECK CONFIGURATION: No DNN in SST[%d] SD[0x%x]", + smf_info->slice[i].s_nssai.sst, + smf_info->slice[i].s_nssai.sd.v); + return OGS_ERROR; + } + } + for (i = 0; i < smf_info->num_of_nr_tai_range; i++) { + if (smf_info->nr_tai_range[i].num_of_tac_range == 0) { + ogs_error("CHECK CONFIGURATION: No TacRange in " + "MCC[%d] MNC[0x%x]", + ogs_plmn_id_mcc(&smf_info->nr_tai[i].plmn_id), + ogs_plmn_id_mnc(&smf_info->nr_tai[i].plmn_id)); + return OGS_ERROR; + } + } + } + return OGS_OK; } @@ -355,7 +387,7 @@ int smf_context_parse_config(void) 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 ( @@ -449,18 +481,17 @@ int smf_context_parse_config(void) ogs_warn("Ignore DNS : %s", v); } - } while ( - ogs_yaml_iter_type(&dns_iter) == - YAML_SEQUENCE_NODE); + } while (ogs_yaml_iter_type(&dns_iter) == + YAML_SEQUENCE_NODE); } else if (!strcmp(smf_key, "mtu")) { ogs_assert(ogs_yaml_iter_type(&smf_iter) != YAML_SCALAR_NODE); self.mtu = atoi(ogs_yaml_iter_value(&smf_iter)); ogs_assert(self.mtu); } else if (!strcmp(smf_key, "p-cscf")) { - ogs_yaml_iter_t dns_iter; - ogs_yaml_iter_recurse(&smf_iter, &dns_iter); - ogs_assert(ogs_yaml_iter_type(&dns_iter) != + ogs_yaml_iter_t p_cscf_iter; + ogs_yaml_iter_recurse(&smf_iter, &p_cscf_iter); + ogs_assert(ogs_yaml_iter_type(&p_cscf_iter) != YAML_MAPPING_NODE); self.num_of_p_cscf = 0; @@ -468,13 +499,13 @@ int smf_context_parse_config(void) do { const char *v = NULL; - if (ogs_yaml_iter_type(&dns_iter) == + if (ogs_yaml_iter_type(&p_cscf_iter) == YAML_SEQUENCE_NODE) { - if (!ogs_yaml_iter_next(&dns_iter)) + if (!ogs_yaml_iter_next(&p_cscf_iter)) break; } - v = ogs_yaml_iter_value(&dns_iter); + v = ogs_yaml_iter_value(&p_cscf_iter); if (v) { ogs_ipsubnet_t ipsub; rv = ogs_ipsubnet(&ipsub, v, NULL); @@ -493,12 +524,345 @@ int smf_context_parse_config(void) ogs_warn("Ignore P-CSCF : %s", v); } - } while ( - ogs_yaml_iter_type(&dns_iter) == + } while (ogs_yaml_iter_type(&p_cscf_iter) == + YAML_SEQUENCE_NODE); + } else if (!strcmp(smf_key, "info")) { + ogs_yaml_iter_t info_array, info_iter; + ogs_yaml_iter_recurse(&smf_iter, &info_array); + do { + ogs_sbi_nf_info_t *nf_info = NULL; + ogs_sbi_smf_info_t *smf_info = NULL; + + if (ogs_yaml_iter_type(&info_array) == + YAML_MAPPING_NODE) { + memcpy(&info_iter, &info_array, + sizeof(ogs_yaml_iter_t)); + } else if (ogs_yaml_iter_type(&info_array) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next(&info_array)) + break; + ogs_yaml_iter_recurse(&info_array, &info_iter); + } else if (ogs_yaml_iter_type(&info_array) == + YAML_SCALAR_NODE) { + break; + } else + ogs_assert_if_reached(); + + nf_info = ogs_sbi_nf_info_add( + &ogs_sbi_self()->nf_info_list, + OpenAPI_nf_type_SMF); + ogs_assert(nf_info); + + smf_info = &nf_info->smf; + ogs_assert(smf_info); + + while (ogs_yaml_iter_next(&info_iter)) { + const char *info_key = + ogs_yaml_iter_key(&info_iter); + ogs_assert(info_key); + if (!strcmp(info_key, "s_nssai")) { + int num_of_slice = 0; + + ogs_yaml_iter_t s_nssai_array, s_nssai_iter; + ogs_yaml_iter_recurse(&info_iter, + &s_nssai_array); + do { + ogs_s_nssai_t *s_nssai = NULL; + const char *sst = NULL, *sd = NULL; + int num_of_dnn = 0; + const char *dnn[OGS_MAX_NUM_OF_DNN]; + + ogs_assert(num_of_slice < + OGS_MAX_NUM_OF_SLICE); + s_nssai = &smf_info->slice[num_of_slice]. + s_nssai; + ogs_assert(s_nssai); + + if (ogs_yaml_iter_type(&s_nssai_array) == + YAML_MAPPING_NODE) { + memcpy(&s_nssai_iter, &s_nssai_array, + sizeof(ogs_yaml_iter_t)); + } else if (ogs_yaml_iter_type( + &s_nssai_array) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next(&s_nssai_array)) + break; + ogs_yaml_iter_recurse(&s_nssai_array, + &s_nssai_iter); + } else if (ogs_yaml_iter_type( + &s_nssai_array) == + YAML_SCALAR_NODE) { + break; + } else + ogs_assert_if_reached(); + + while (ogs_yaml_iter_next(&s_nssai_iter)) { + const char *s_nssai_key = + ogs_yaml_iter_key(&s_nssai_iter); + ogs_assert(s_nssai_key); + if (!strcmp(s_nssai_key, "sst")) { + sst = ogs_yaml_iter_value( + &s_nssai_iter); + } else if (!strcmp(s_nssai_key, "sd")) { + sd = ogs_yaml_iter_value( + &s_nssai_iter); + } else if (!strcmp(s_nssai_key, + "dnn")) { + ogs_yaml_iter_t dnn_iter; + ogs_yaml_iter_recurse(&s_nssai_iter, + &dnn_iter); + ogs_assert(ogs_yaml_iter_type( + &dnn_iter) != + YAML_MAPPING_NODE); + + do { + const char *v = NULL; + + if (ogs_yaml_iter_type( + &dnn_iter) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next( + &dnn_iter)) + break; + } + + v = ogs_yaml_iter_value( + &dnn_iter); + if (v) { + ogs_assert(num_of_dnn < + OGS_MAX_NUM_OF_DNN); + dnn[num_of_dnn++] = v; + } + } while (ogs_yaml_iter_type( + &dnn_iter) == + YAML_SEQUENCE_NODE); + } + } + + if (sst) { + int i; + + s_nssai->sst = atoi(sst); + if (sd) + s_nssai->sd = + ogs_uint24_from_string( + (char*)sd); + else + s_nssai->sd.v = + OGS_S_NSSAI_NO_SD_VALUE; + + ogs_assert(num_of_dnn < + OGS_MAX_NUM_OF_DNN); + + for (i = 0; i < num_of_dnn; i++) + smf_info->slice[num_of_slice]. + dnn[i] = ogs_strdup(dnn[i]); + + smf_info->slice[num_of_slice]. + num_of_dnn = num_of_dnn; + + num_of_slice++; + } + } while (ogs_yaml_iter_type(&s_nssai_array) == + YAML_SEQUENCE_NODE); + + smf_info->num_of_slice = num_of_slice; + + } else if (!strcmp(info_key, "tai")) { + int num_of_nr_tai = 0; + int num_of_nr_tai_range = 0; + + ogs_yaml_iter_t tai_array, tai_iter; + ogs_yaml_iter_recurse(&info_iter, &tai_array); + do { + const char *mcc = NULL, *mnc = NULL; + int num_of_tac = 0; + ogs_uint24_t tac[OGS_MAX_NUM_OF_TAI]; + int num_of_range = 0; + ogs_uint24_t start[OGS_MAX_NUM_OF_TAI]; + ogs_uint24_t end[OGS_MAX_NUM_OF_TAI]; + + if (ogs_yaml_iter_type(&tai_array) == + YAML_MAPPING_NODE) { + memcpy(&tai_iter, &tai_array, + sizeof(ogs_yaml_iter_t)); + } else if (ogs_yaml_iter_type(&tai_array) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next(&tai_array)) + break; + ogs_yaml_iter_recurse(&tai_array, + &tai_iter); + } else if (ogs_yaml_iter_type(&tai_array) == + YAML_SCALAR_NODE) { + break; + } else + ogs_assert_if_reached(); + + while (ogs_yaml_iter_next(&tai_iter)) { + const char *tai_key = + ogs_yaml_iter_key(&tai_iter); + ogs_assert(tai_key); + if (!strcmp(tai_key, "plmn_id")) { + ogs_yaml_iter_t plmn_id_iter; + + ogs_yaml_iter_recurse( + &tai_iter, &plmn_id_iter); + while (ogs_yaml_iter_next( + &plmn_id_iter)) { + const char *plmn_id_key = + ogs_yaml_iter_key( + &plmn_id_iter); + ogs_assert(plmn_id_key); + if (!strcmp(plmn_id_key, + "mcc")) { + mcc = ogs_yaml_iter_value( + &plmn_id_iter); + } else if (!strcmp(plmn_id_key, + "mnc")) { + mnc = ogs_yaml_iter_value( + &plmn_id_iter); + } + } + } else if (!strcmp(tai_key, "tac")) { + ogs_yaml_iter_t tac_iter; + ogs_yaml_iter_recurse( + &tai_iter, &tac_iter); + ogs_assert(ogs_yaml_iter_type( + &tac_iter) != + YAML_MAPPING_NODE); + + do { + const char *v = NULL; + + ogs_assert(num_of_tac < + OGS_MAX_NUM_OF_TAI); + if (ogs_yaml_iter_type( + &tac_iter) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next( + &tac_iter)) + break; + } + + v = ogs_yaml_iter_value( + &tac_iter); + if (v) { + tac[num_of_tac].v = atoi(v); + num_of_tac++; + } + } while ( + ogs_yaml_iter_type(&tac_iter) == + YAML_SEQUENCE_NODE); + } else if (!strcmp(tai_key, "range")) { + ogs_yaml_iter_t range_iter; + ogs_yaml_iter_recurse( + &tai_iter, &range_iter); + ogs_assert(ogs_yaml_iter_type( + &range_iter) != + YAML_MAPPING_NODE); + do { + char *v = NULL; + char *low = NULL, *high = NULL; + + if (ogs_yaml_iter_type( + &range_iter) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next( + &range_iter)) + break; + } + + v = (char *)ogs_yaml_iter_value( + &range_iter); + if (v) { + low = strsep(&v, "-"); + if (low && strlen(low) == 0) + low = NULL; + + high = v; + if (high && + strlen(high) == 0) + high = NULL; + + if (low && high) { + ogs_assert( + num_of_range < + OGS_MAX_NUM_OF_TAI); + start[num_of_range].v = + atoi(low); + end[num_of_range].v = + atoi(high); + num_of_range++; + } + } + } while ( + ogs_yaml_iter_type( + &range_iter) == + YAML_SEQUENCE_NODE); + + } else + ogs_warn("unknown key `%s`", + tai_key); + } + + if (mcc && mnc) { + int i; + + if (num_of_range) { + ogs_assert(num_of_nr_tai_range < + OGS_MAX_NUM_OF_TAI); + ogs_plmn_id_build( + &smf_info->nr_tai_range + [num_of_nr_tai_range]. + plmn_id, + atoi(mcc), atoi(mnc), + strlen(mnc)); + for (i = 0; i < num_of_range; i++) { + smf_info->nr_tai_range + [num_of_nr_tai_range]. + start[i].v = start[i].v; + smf_info->nr_tai_range + [num_of_nr_tai_range]. + end[i].v = end[i].v; + } + smf_info->nr_tai_range + [num_of_nr_tai_range]. + num_of_tac_range = + num_of_range; + num_of_nr_tai_range++; + } else if (num_of_tac) { + for (i = 0; i < num_of_tac; i++) { + ogs_assert(num_of_nr_tai < + OGS_MAX_NUM_OF_TAI); + ogs_plmn_id_build( + &smf_info->nr_tai + [num_of_nr_tai].plmn_id, + atoi(mcc), atoi(mnc), + strlen(mnc)); + smf_info->nr_tai[num_of_nr_tai]. + tac.v = tac[i].v; + num_of_nr_tai++; + } + } else { + ogs_warn("No TAC info"); + } + } + } while (ogs_yaml_iter_type(&tai_array) == + YAML_SEQUENCE_NODE); + + smf_info->num_of_nr_tai = num_of_nr_tai; + smf_info->num_of_nr_tai_range = + num_of_nr_tai_range; + } else + ogs_warn("unknown key `%s`", info_key); + } + + } while (ogs_yaml_iter_type(&info_array) == YAML_SEQUENCE_NODE); + } else if (!strcmp(smf_key, "pfcp")) { /* handle config in pfcp library */ - } else if (!strcmp(smf_key, "pdn")) { + } else if (!strcmp(smf_key, "subnet")) { /* handle config in pfcp library */ } else if (!strcmp(smf_key, "sbi")) { /* handle config in sbi library */ @@ -614,9 +978,10 @@ static bool compare_ue_info(ogs_pfcp_node_t *node, smf_sess_t *sess) ogs_assert(node); ogs_assert(sess); + ogs_assert(sess->session.name); for (i = 0; i < node->num_of_dnn; i++) - if (ogs_strcasecmp(node->dnn[i], sess->pdn.dnn) == 0) return true; + if (ogs_strcasecmp(node->dnn[i], sess->session.name) == 0) return true; for (i = 0; i < node->num_of_e_cell_id; i++) if (node->e_cell_id[i] == sess->e_cgi.cell_id) return true; @@ -739,7 +1104,8 @@ smf_sess_t *smf_sess_add_by_apn(smf_ue_t *smf_ue, char *apn) ogs_pfcp_bar_new(&sess->pfcp); /* Set APN */ - ogs_cpystrn(sess->pdn.apn, apn, OGS_MAX_APN_LEN+1); + sess->session.name = ogs_strdup(apn); + ogs_assert(sess->session.name); /* Setup Timer */ sess->t_release_holding = ogs_timer_add( @@ -809,7 +1175,7 @@ smf_sess_t *smf_sess_add_by_gtp_message(ogs_gtp_message_t *message) sess = smf_sess_find_by_apn(smf_ue, apn); if (sess) { ogs_warn("OLD Session Release [IMSI:%s,APN:%s]", - smf_ue->imsi_bcd, sess->pdn.apn); + smf_ue->imsi_bcd, sess->session.name); smf_sess_remove(sess); } @@ -857,8 +1223,8 @@ smf_sess_t *smf_sess_add_by_psi(smf_ue_t *smf_ue, uint8_t psi) /* Set S-NSSAI */ sess->s_nssai.sst = 0; sess->s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE; - sess->s_nssai.mapped_hplmn_sst = 0; - sess->s_nssai.mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE; + sess->mapped_hplmn.sst = 0; + sess->mapped_hplmn.sd.v = OGS_S_NSSAI_NO_SD_VALUE; /* Set TEID & SEID */ sess->smf_n4_teid = sess->index; @@ -931,7 +1297,7 @@ void smf_sess_set_ue_ip(smf_sess_t *sess) smf_ue = sess->smf_ue; ogs_assert(smf_ue); - if (sess->pdn.pdn_type == OGS_PDU_SESSION_TYPE_IPV4V6) { + if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { /* * This is the case when the HSS is set to IPv4v6 and @@ -948,17 +1314,18 @@ void smf_sess_set_ue_ip(smf_sess_t *sess) ogs_pfcp_subnet_t *subnet = NULL; ogs_pfcp_subnet_t *subnet6 = NULL; - subnet = ogs_pfcp_find_subnet_by_dnn(AF_INET, sess->pdn.dnn); - subnet6 = ogs_pfcp_find_subnet_by_dnn(AF_INET6, sess->pdn.dnn); + ogs_assert(sess->session.name); + subnet = ogs_pfcp_find_subnet_by_dnn(AF_INET, sess->session.name); + subnet6 = ogs_pfcp_find_subnet_by_dnn(AF_INET6, sess->session.name); if (subnet != NULL && subnet6 == NULL) - sess->pdn.pdn_type = OGS_PDU_SESSION_TYPE_IPV4; + sess->session.session_type = OGS_PDU_SESSION_TYPE_IPV4; else if (subnet == NULL && subnet6 != NULL) - sess->pdn.pdn_type = OGS_PDU_SESSION_TYPE_IPV6; + sess->session.session_type = OGS_PDU_SESSION_TYPE_IPV6; } - sess->pdn.paa.pdn_type = sess->pdn.pdn_type; - ogs_assert(sess->pdn.pdn_type); + sess->session.paa.session_type = sess->session.session_type; + ogs_assert(sess->session.session_type); if (sess->ipv4) { ogs_hash_set(smf_self()->ipv4_hash, @@ -971,45 +1338,46 @@ void smf_sess_set_ue_ip(smf_sess_t *sess) ogs_pfcp_ue_ip_free(sess->ipv6); } - if (sess->pdn.pdn_type == OGS_PDU_SESSION_TYPE_IPV4) { - sess->ipv4 = ogs_pfcp_ue_ip_alloc( - AF_INET, sess->pdn.dnn, (uint8_t *)&sess->pdn.ue_ip.addr); + if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) { + sess->ipv4 = ogs_pfcp_ue_ip_alloc(AF_INET, + sess->session.name, (uint8_t *)&sess->session.ue_ip.addr); ogs_assert(sess->ipv4); - sess->pdn.paa.addr = sess->ipv4->addr[0]; + sess->session.paa.addr = sess->ipv4->addr[0]; ogs_hash_set(smf_self()->ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, sess); - } else if (sess->pdn.pdn_type == OGS_PDU_SESSION_TYPE_IPV6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) { sess->ipv6 = ogs_pfcp_ue_ip_alloc( - AF_INET6, sess->pdn.dnn, sess->pdn.ue_ip.addr6); + AF_INET6, sess->session.name, sess->session.ue_ip.addr6); ogs_assert(sess->ipv6); subnet6 = sess->ipv6->subnet; ogs_assert(subnet6); - sess->pdn.paa.len = subnet6->prefixlen; - memcpy(sess->pdn.paa.addr6, sess->ipv6->addr, OGS_IPV6_LEN); + sess->session.paa.len = subnet6->prefixlen; + memcpy(sess->session.paa.addr6, sess->ipv6->addr, OGS_IPV6_LEN); ogs_hash_set(smf_self()->ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, sess); - } else if (sess->pdn.pdn_type == OGS_PDU_SESSION_TYPE_IPV4V6) { - sess->ipv4 = ogs_pfcp_ue_ip_alloc( - AF_INET, sess->pdn.dnn, (uint8_t *)&sess->pdn.ue_ip.addr); + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { + sess->ipv4 = ogs_pfcp_ue_ip_alloc(AF_INET, + sess->session.name, (uint8_t *)&sess->session.ue_ip.addr); ogs_assert(sess->ipv4); sess->ipv6 = ogs_pfcp_ue_ip_alloc( - AF_INET6, sess->pdn.dnn, sess->pdn.ue_ip.addr6); + AF_INET6, sess->session.name, sess->session.ue_ip.addr6); ogs_assert(sess->ipv6); subnet6 = sess->ipv6->subnet; ogs_assert(subnet6); - sess->pdn.paa.both.addr = sess->ipv4->addr[0]; - sess->pdn.paa.both.len = subnet6->prefixlen; - memcpy(sess->pdn.paa.both.addr6, sess->ipv6->addr, OGS_IPV6_LEN); + sess->session.paa.both.addr = sess->ipv4->addr[0]; + sess->session.paa.both.len = subnet6->prefixlen; + memcpy(sess->session.paa.both.addr6, sess->ipv6->addr, OGS_IPV6_LEN); ogs_hash_set(smf_self()->ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, sess); ogs_hash_set(smf_self()->ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, sess); } else { - ogs_fatal("Invalid sess->pdn.pdn_type[%d]", sess->pdn.pdn_type); + ogs_fatal("Invalid sess->session.session_type[%d]", + sess->session.session_type); ogs_assert_if_reached(); } } @@ -1114,7 +1482,7 @@ void smf_sess_remove(smf_sess_t *sess) ogs_info("Removed Session: UE IMSI:[%s] DNN:[%s:%d] IPv4:[%s] IPv6:[%s]", smf_ue->supi ? smf_ue->supi : smf_ue->imsi_bcd, - sess->pdn.dnn, sess->psi, + sess->session.name, sess->psi, sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); @@ -1163,8 +1531,8 @@ void smf_sess_remove(smf_sess_t *sess) if (sess->policy_association_id) ogs_free(sess->policy_association_id); - if (sess->dnn) - ogs_free(sess->dnn); + if (sess->session.name) + ogs_free(sess->session.name); if (sess->upf_n3_addr) ogs_freeaddrinfo(sess->upf_n3_addr); @@ -1231,7 +1599,7 @@ smf_sess_t *smf_sess_find_by_apn(smf_ue_t *smf_ue, char *apn) ogs_assert(apn); ogs_list_for_each(&smf_ue->sess_list, sess) { - if (!ogs_strcasecmp(sess->pdn.apn, apn)) + if (!ogs_strcasecmp(sess->session.name, apn)) return sess; } @@ -1311,8 +1679,8 @@ smf_bearer_t *smf_qos_flow_add(smf_sess_t *sess) dl_pdr->src_if = OGS_PFCP_INTERFACE_CORE; - if (strlen(sess->pdn.apn)) - dl_pdr->apn = ogs_strdup(sess->pdn.apn); + if (sess->session.name) + dl_pdr->apn = ogs_strdup(sess->session.name); ul_pdr = ogs_pfcp_pdr_add(&sess->pfcp); ogs_assert(ul_pdr); @@ -1320,17 +1688,17 @@ smf_bearer_t *smf_qos_flow_add(smf_sess_t *sess) ul_pdr->src_if = OGS_PFCP_INTERFACE_ACCESS; - if (strlen(sess->pdn.apn)) - ul_pdr->apn = ogs_strdup(sess->pdn.apn); + if (sess->session.name) + ul_pdr->apn = ogs_strdup(sess->session.name); ul_pdr->outer_header_removal_len = 1; - if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { + if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) { ul_pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) { ul_pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { ul_pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP; } else @@ -1395,13 +1763,13 @@ void smf_sess_create_indirect_data_forwarding(smf_sess_t *sess) pdr->src_if = OGS_PFCP_INTERFACE_ACCESS; pdr->outer_header_removal_len = 1; - if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { + if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) { pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) { pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP; } else @@ -1548,8 +1916,8 @@ smf_bearer_t *smf_bearer_add(smf_sess_t *sess) dl_pdr->src_if = OGS_PFCP_INTERFACE_CORE; - if (strlen(sess->pdn.apn)) - dl_pdr->apn = ogs_strdup(sess->pdn.apn); + ogs_assert(sess->session.name); + dl_pdr->apn = ogs_strdup(sess->session.name); ul_pdr = ogs_pfcp_pdr_add(&sess->pfcp); ogs_assert(ul_pdr); @@ -1557,17 +1925,17 @@ smf_bearer_t *smf_bearer_add(smf_sess_t *sess) ul_pdr->src_if = OGS_PFCP_INTERFACE_ACCESS; - if (strlen(sess->pdn.apn)) - ul_pdr->apn = ogs_strdup(sess->pdn.apn); + ogs_assert(sess->session.name); + ul_pdr->apn = ogs_strdup(sess->session.name); ul_pdr->outer_header_removal_len = 1; - if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4) { + if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4) { ul_pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV4; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV6) { ul_pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IPV6; - } else if (sess->pdn.pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + } else if (sess->session.session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { ul_pdr->outer_header_removal.description = OGS_PFCP_OUTER_HEADER_REMOVAL_GTPU_UDP_IP; } else @@ -1600,7 +1968,7 @@ smf_bearer_t *smf_bearer_add(smf_sess_t *sess) } else { resource = ogs_pfcp_gtpu_resource_find( &sess->pfcp_node->gtpu_resource_list, - sess->pdn.apn, OGS_PFCP_INTERFACE_ACCESS); + sess->session.name, OGS_PFCP_INTERFACE_ACCESS); if (resource) { ogs_pfcp_user_plane_ip_resource_info_to_sockaddr(&resource->info, &bearer->pgw_s5u_addr, &bearer->pgw_s5u_addr6); @@ -1736,7 +2104,7 @@ smf_bearer_t *smf_bearer_find_by_pcc_rule_name( } smf_bearer_t *smf_bearer_find_by_qci_arp(smf_sess_t *sess, - uint8_t qci, + uint8_t qos_index, uint8_t priority_level, uint8_t pre_emption_capability, uint8_t pre_emption_vulnerability) @@ -1748,18 +2116,18 @@ smf_bearer_t *smf_bearer_find_by_qci_arp(smf_sess_t *sess, bearer = smf_default_bearer_in_sess(sess); if (!bearer) return NULL; - if (sess->pdn.qos.qci == qci && - sess->pdn.qos.arp.priority_level == priority_level && - sess->pdn.qos.arp.pre_emption_capability == + if (sess->session.qos.index == qos_index && + sess->session.qos.arp.priority_level == priority_level && + sess->session.qos.arp.pre_emption_capability == pre_emption_capability && - sess->pdn.qos.arp.pre_emption_vulnerability == + sess->session.qos.arp.pre_emption_vulnerability == pre_emption_vulnerability) { return bearer; } bearer = smf_bearer_next(bearer); while (bearer) { - if (bearer->qos.qci == qci && + if (bearer->qos.index == qos_index && bearer->qos.arp.priority_level == priority_level && bearer->qos.arp.pre_emption_capability == pre_emption_capability && @@ -1846,6 +2214,17 @@ smf_bearer_t *smf_qos_flow_cycle(smf_bearer_t *qos_flow) return ogs_pool_cycle(&smf_bearer_pool, qos_flow); } +void smf_sess_select_nf(smf_sess_t *sess, OpenAPI_nf_type_e nf_type) +{ + ogs_assert(sess); + ogs_assert(nf_type); + + if (nf_type == OpenAPI_nf_type_NRF) + ogs_sbi_select_nrf(&sess->sbi, smf_nf_state_registered); + else + ogs_sbi_select_first_nf(&sess->sbi, nf_type, smf_nf_state_registered); +} + smf_pf_t *smf_pf_add(smf_bearer_t *bearer) { smf_pf_t *pf = NULL; diff --git a/src/smf/context.h b/src/smf/context.h index 413a10d84..ec1b5ed67 100644 --- a/src/smf/context.h +++ b/src/smf/context.h @@ -249,10 +249,6 @@ typedef struct smf_sess_s { ogs_nr_cgi_t nr_cgi; ogs_time_t ue_location_timestamp; - /* S_NSSAI & DNN */ - ogs_s_nssai_t s_nssai; - char *dnn; - /* PCF ID */ char *pcf_id; @@ -262,8 +258,12 @@ typedef struct smf_sess_s { uint8_t mbr_ul; } integrity_protection; + /* S_NSSAI */ + ogs_s_nssai_t s_nssai; + ogs_s_nssai_t mapped_hplmn; + /* PDN Configuration */ - ogs_pdn_t pdn; + ogs_session_t session; uint8_t ue_pdu_session_type; uint8_t ue_ssc_mode; @@ -388,7 +388,7 @@ smf_bearer_t *smf_bearer_find_by_ebi(smf_sess_t *sess, uint8_t ebi); smf_bearer_t *smf_bearer_find_by_pcc_rule_name( smf_sess_t *sess, char *pcc_rule_name); smf_bearer_t *smf_bearer_find_by_qci_arp(smf_sess_t *sess, - uint8_t qci, + uint8_t qos_index, uint8_t priority_level, uint8_t pre_emption_capability, uint8_t pre_emption_vulnerability); @@ -404,6 +404,8 @@ smf_sess_t *smf_sess_cycle(smf_sess_t *sess); smf_bearer_t *smf_qos_flow_cycle(smf_bearer_t *qos_flow); smf_bearer_t *smf_bearer_cycle(smf_bearer_t *bearer); +void smf_sess_select_nf(smf_sess_t *sess, OpenAPI_nf_type_e nf_type); + smf_pf_t *smf_pf_add(smf_bearer_t *bearer); int smf_pf_remove(smf_pf_t *pf); void smf_pf_remove_all(smf_bearer_t *bearer); diff --git a/src/smf/fd-path.c b/src/smf/fd-path.c index b8feebbbd..9a4692831 100644 --- a/src/smf/fd-path.c +++ b/src/smf/fd-path.c @@ -283,7 +283,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, if (sess->ipv6) { ret = fd_msg_avp_new(ogs_diam_gx_framed_ipv6_prefix, 0, &avp); ogs_assert(ret == 0); - memcpy(&paa, &sess->pdn.paa, OGS_PAA_IPV6_LEN); + memcpy(&paa, &sess->session.paa, OGS_PAA_IPV6_LEN); #define FRAMED_IPV6_PREFIX_LENGTH 128 /* from spec document */ paa.len = FRAMED_IPV6_PREFIX_LENGTH; val.os.data = (uint8_t*)&paa; @@ -313,26 +313,26 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ogs_assert(ret == 0); /* Set QoS-Information */ - if (sess->pdn.ambr.downlink || sess->pdn.ambr.uplink) { + if (sess->session.ambr.downlink || sess->session.ambr.uplink) { ret = fd_msg_avp_new(ogs_diam_gx_qos_information, 0, &avp); ogs_assert(ret == 0); - if (sess->pdn.ambr.uplink) { + if (sess->session.ambr.uplink) { ret = fd_msg_avp_new(ogs_diam_gx_apn_aggregate_max_bitrate_ul, 0, &avpch1); ogs_assert(ret == 0); - val.u32 = sess->pdn.ambr.uplink; + val.u32 = sess->session.ambr.uplink; ret = fd_msg_avp_setvalue (avpch1, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); ogs_assert(ret == 0); } - if (sess->pdn.ambr.downlink) { + if (sess->session.ambr.downlink) { ret = fd_msg_avp_new( ogs_diam_gx_apn_aggregate_max_bitrate_dl, 0, &avpch1); ogs_assert(ret == 0); - val.u32 = sess->pdn.ambr.downlink; + val.u32 = sess->session.ambr.downlink; ret = fd_msg_avp_setvalue (avpch1, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); @@ -349,7 +349,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ret = fd_msg_avp_new(ogs_diam_gx_qos_class_identifier, 0, &avpch1); ogs_assert(ret == 0); - val.u32 = sess->pdn.qos.qci; + val.u32 = sess->session.qos.index; ret = fd_msg_avp_setvalue (avpch1, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); @@ -361,7 +361,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ret = fd_msg_avp_new(ogs_diam_gx_priority_level, 0, &avpch2); ogs_assert(ret == 0); - val.u32 = sess->pdn.qos.arp.priority_level; + val.u32 = sess->session.qos.arp.priority_level; ret = fd_msg_avp_setvalue (avpch2, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); @@ -369,7 +369,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ret = fd_msg_avp_new(ogs_diam_gx_pre_emption_capability, 0, &avpch2); ogs_assert(ret == 0); - val.u32 = sess->pdn.qos.arp.pre_emption_capability; + val.u32 = sess->session.qos.arp.pre_emption_capability; ret = fd_msg_avp_setvalue (avpch2, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); @@ -377,7 +377,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ret = fd_msg_avp_new(ogs_diam_gx_pre_emption_vulnerability, 0, &avpch2); ogs_assert(ret == 0); - val.u32 = sess->pdn.qos.arp.pre_emption_vulnerability; + val.u32 = sess->session.qos.arp.pre_emption_vulnerability; ret = fd_msg_avp_setvalue (avpch2, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2); @@ -444,8 +444,9 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, /* Set Called-Station-Id */ ret = fd_msg_avp_new(ogs_diam_gx_called_station_id, 0, &avp); ogs_assert(ret == 0); - val.os.data = (uint8_t*)sess->pdn.apn; - val.os.len = strlen(sess->pdn.apn); + ogs_assert(sess->session.name); + val.os.data = (uint8_t*)sess->session.name; + val.os.len = strlen(sess->session.name); ret = fd_msg_avp_setvalue(avp, &val); ogs_assert(ret == 0); ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); @@ -627,7 +628,7 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); ogs_assert(ret == 0); - gx_message->session_data.pdn.ambr.uplink = hdr->avp_value->u32; + gx_message->session_data.session.ambr.uplink = hdr->avp_value->u32; } ret = fd_avp_search_avp( avp, ogs_diam_gx_apn_aggregate_max_bitrate_dl, &avpch1); @@ -635,7 +636,8 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); ogs_assert(ret == 0); - gx_message->session_data.pdn.ambr.downlink = hdr->avp_value->u32; + gx_message->session_data.session.ambr.downlink = + hdr->avp_value->u32; } } @@ -647,7 +649,7 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) if (avpch1) { ret = fd_msg_avp_hdr(avpch1, &hdr); ogs_assert(ret == 0); - gx_message->session_data.pdn.qos.qci = hdr->avp_value->u32; + gx_message->session_data.session.qos.index = hdr->avp_value->u32; } ret = fd_avp_search_avp( @@ -660,18 +662,38 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); ogs_assert(ret == 0); - gx_message->session_data.pdn.qos.arp.priority_level = + gx_message->session_data.session.qos.arp.priority_level = hdr->avp_value->u32; } + /* + * 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 + */ ret = fd_avp_search_avp( avpch1, ogs_diam_gx_pre_emption_capability, &avpch2); ogs_assert(ret == 0); if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); ogs_assert(ret == 0); - gx_message->session_data.pdn.qos.arp.pre_emption_capability = - hdr->avp_value->u32; + gx_message->session_data. + session.qos.arp.pre_emption_capability = + hdr->avp_value->u32; + } else { + gx_message->session_data. + session.qos.arp.pre_emption_capability = + OGS_EPC_PRE_EMPTION_DISABLED; } ret = fd_avp_search_avp(avpch1, @@ -680,8 +702,13 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) if (avpch2) { ret = fd_msg_avp_hdr(avpch2, &hdr); ogs_assert(ret == 0); - gx_message->session_data.pdn.qos.arp.pre_emption_vulnerability = - hdr->avp_value->u32; + gx_message->session_data. + session.qos.arp.pre_emption_vulnerability = + hdr->avp_value->u32; + } else { + gx_message->session_data. + session.qos.arp.pre_emption_vulnerability = + OGS_EPC_PRE_EMPTION_ENABLED; } } } @@ -1178,7 +1205,7 @@ static int decode_pcc_rule_definition( if (avpch3) { ret = fd_msg_avp_hdr(avpch3, &hdr); ogs_assert(ret == 0); - pcc_rule->qos.qci = hdr->avp_value->u32; + pcc_rule->qos.index = hdr->avp_value->u32; } else { ogs_error("no_QCI"); error++; @@ -1200,6 +1227,21 @@ static int decode_pcc_rule_definition( error++; } + /* + * 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 + */ ret = fd_avp_search_avp(avpch3, ogs_diam_gx_pre_emption_capability, &avpch4); ogs_assert(ret == 0); @@ -1209,8 +1251,8 @@ static int decode_pcc_rule_definition( pcc_rule->qos.arp.pre_emption_capability = hdr->avp_value->u32; } else { - ogs_error("no_Preemption-Capability"); - error++; + pcc_rule->qos.arp.pre_emption_capability = + OGS_EPC_PRE_EMPTION_DISABLED; } ret = fd_avp_search_avp(avpch3, @@ -1222,8 +1264,9 @@ static int decode_pcc_rule_definition( pcc_rule->qos.arp.pre_emption_vulnerability = hdr->avp_value->u32; } else { - ogs_error("no_Preemption-Vulnerability"); - error++; + pcc_rule->qos.arp.pre_emption_vulnerability = + OGS_EPC_PRE_EMPTION_ENABLED; + } } else { ogs_error("no_ARP"); diff --git a/src/smf/gsm-build.c b/src/smf/gsm-build.c index 0ff038041..f8c75c856 100644 --- a/src/smf/gsm-build.c +++ b/src/smf/gsm-build.c @@ -87,8 +87,8 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess) message.gsm.h.procedure_transaction_identity = sess->pti; message.gsm.h.message_type = OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT; - selected_pdu_session_type->type = sess->pdn.ssc_mode; - selected_pdu_session_type->value = sess->pdn.pdn_type; + selected_pdu_session_type->type = sess->session.ssc_mode; + selected_pdu_session_type->value = sess->session.session_type; /* * TS23.501 @@ -137,26 +137,26 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess) /* Session-AMBR */ session_ambr->length = 6; ogs_nas_bitrate_from_uint64( - &session_ambr->downlink, sess->pdn.ambr.downlink); + &session_ambr->downlink, sess->session.ambr.downlink); ogs_nas_bitrate_from_uint64( - &session_ambr->uplink, sess->pdn.ambr.uplink); + &session_ambr->uplink, sess->session.ambr.uplink); /* PDU Address */ pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENT; - pdu_address->pdn_type = sess->pdn.paa.pdn_type; + pdu_address->pdn_type = sess->session.paa.session_type; if (pdu_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV4) { - pdu_address->addr = sess->pdn.paa.addr; + pdu_address->addr = sess->session.paa.addr; pdu_address->length = OGS_NAS_PDU_ADDRESS_IPV4_LEN; } else if (pdu_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV6) { memcpy(pdu_address->addr6, - sess->pdn.paa.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); + sess->session.paa.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); pdu_address->length = OGS_NAS_PDU_ADDRESS_IPV6_LEN; } else if (pdu_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV4V6) { - pdu_address->both.addr = sess->pdn.paa.both.addr; + pdu_address->both.addr = sess->session.paa.both.addr; memcpy(pdu_address->both.addr6, - sess->pdn.paa.both.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); + sess->session.paa.both.addr6+(OGS_IPV6_LEN>>1), OGS_IPV6_LEN>>1); pdu_address->length = OGS_NAS_PDU_ADDRESS_IPV4V6_LEN; } else { ogs_error("Unexpected PDN Type %u", pdu_address->pdn_type); @@ -179,7 +179,7 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess) /* S-NSSAI */ pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_S_NSSAI_PRESENT; - ogs_nas_build_s_nssai(nas_s_nssai, &sess->s_nssai); + ogs_nas_build_s_nssai2(nas_s_nssai, &sess->s_nssai, &sess->mapped_hplmn); /* QoS flow descriptions */ memset(&qos_flow_description, 0, sizeof(qos_flow_description)); @@ -192,8 +192,8 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess) qos_flow_description[0].param[num_of_param].identifier = OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI; qos_flow_description[0].param[num_of_param].len = - sizeof(qos_flow_description[0].param[num_of_param].qci); - qos_flow_description[0].param[num_of_param].qci = qos_flow->qos.qci; + sizeof(qos_flow_description[0].param[num_of_param].qos_index); + qos_flow_description[0].param[num_of_param].qos_index = qos_flow->qos.index; num_of_param++; qos_flow_description[0].num_of_parameter = num_of_param; @@ -218,8 +218,9 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess) /* DNN */ pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_PRESENT; - dnn->length = strlen(sess->pdn.dnn); - ogs_cpystrn(dnn->value, sess->pdn.dnn, + ogs_assert(sess->session.name); + dnn->length = strlen(sess->session.name); + ogs_cpystrn(dnn->value, sess->session.name, ogs_min(dnn->length, OGS_MAX_DNN_LEN) + 1); pkbuf = ogs_nas_5gs_plain_encode(&message); @@ -340,8 +341,8 @@ ogs_pkbuf_t *gsm_build_qos_flow_modification_command( qos_flow_description[0].param[num_of_param].identifier = OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI; qos_flow_description[0].param[num_of_param].len = - sizeof(qos_flow_description[0].param[num_of_param].qci); - qos_flow_description[0].param[num_of_param].qci = qos_flow->qos.qci; + sizeof(qos_flow_description[0].param[num_of_param].qos_index); + qos_flow_description[0].param[num_of_param].qos_index = qos_flow->qos.index; num_of_param++; if (qos_flow->qos.gbr.uplink) { diff --git a/src/smf/gx-handler.c b/src/smf/gx-handler.c index 0420ec969..9df5bc204 100644 --- a/src/smf/gx-handler.c +++ b/src/smf/gx-handler.c @@ -78,15 +78,17 @@ void smf_gx_handle_cca_initial_request( /* APN-AMBR * if PCRF changes APN-AMBR, this should be included. */ sess->gtp.create_session_response_apn_ambr = false; - if ((gx_message->session_data.pdn.ambr.uplink && - (sess->pdn.ambr.uplink / 1000) != - (gx_message->session_data.pdn.ambr.uplink / 1000)) || - (gx_message->session_data.pdn.ambr.downlink && - (sess->pdn.ambr.downlink / 1000) != - (gx_message->session_data.pdn.ambr.downlink / 1000))) { + if ((gx_message->session_data.session.ambr.uplink && + (sess->session.ambr.uplink / 1000) != + (gx_message->session_data.session.ambr.uplink / 1000)) || + (gx_message->session_data.session.ambr.downlink && + (sess->session.ambr.downlink / 1000) != + (gx_message->session_data.session.ambr.downlink / 1000))) { - sess->pdn.ambr.downlink = gx_message->session_data.pdn.ambr.downlink; - sess->pdn.ambr.uplink = gx_message->session_data.pdn.ambr.uplink; + sess->session.ambr.downlink = + gx_message->session_data.session.ambr.downlink; + sess->session.ambr.uplink = + gx_message->session_data.session.ambr.uplink; sess->gtp.create_session_response_apn_ambr = true; } @@ -94,23 +96,25 @@ void smf_gx_handle_cca_initial_request( /* Bearer QoS * if PCRF changes Bearer QoS, this should be included. */ sess->gtp.create_session_response_bearer_qos = false; - if ((gx_message->session_data.pdn.qos.qci && - sess->pdn.qos.qci != gx_message->session_data.pdn.qos.qci) || - (gx_message->session_data.pdn.qos.arp.priority_level && - sess->pdn.qos.arp.priority_level != - gx_message->session_data.pdn.qos.arp.priority_level) || - sess->pdn.qos.arp.pre_emption_capability != - gx_message->session_data.pdn.qos.arp.pre_emption_capability || - sess->pdn.qos.arp.pre_emption_vulnerability != - gx_message->session_data.pdn.qos.arp.pre_emption_vulnerability) { + if ((gx_message->session_data.session.qos.index && + sess->session.qos.index != + gx_message->session_data.session.qos.index) || + (gx_message->session_data.session.qos.arp.priority_level && + sess->session.qos.arp.priority_level != + gx_message->session_data.session.qos.arp.priority_level) || + sess->session.qos.arp.pre_emption_capability != + gx_message->session_data.session.qos.arp.pre_emption_capability || + sess->session.qos.arp.pre_emption_vulnerability != + gx_message->session_data. + session.qos.arp.pre_emption_vulnerability) { - sess->pdn.qos.qci = gx_message->session_data.pdn.qos.qci; - sess->pdn.qos.arp.priority_level = - gx_message->session_data.pdn.qos.arp.priority_level; - sess->pdn.qos.arp.pre_emption_capability = - gx_message->session_data.pdn.qos.arp.pre_emption_capability; - sess->pdn.qos.arp.pre_emption_vulnerability = - gx_message->session_data.pdn.qos.arp.pre_emption_vulnerability; + sess->session.qos.index = gx_message->session_data.session.qos.index; + sess->session.qos.arp.priority_level = + gx_message->session_data.session.qos.arp.priority_level; + sess->session.qos.arp.pre_emption_capability = + gx_message->session_data.session.qos.arp.pre_emption_capability; + sess->session.qos.arp.pre_emption_vulnerability = + gx_message->session_data.session.qos.arp.pre_emption_vulnerability; sess->gtp.create_session_response_bearer_qos = true; } @@ -119,7 +123,7 @@ void smf_gx_handle_cca_initial_request( ogs_assert(bearer); /* Setup QER */ - if (sess->pdn.ambr.downlink || sess->pdn.ambr.uplink) { + if (sess->session.ambr.downlink || sess->session.ambr.uplink) { /* Only 1 QER is used per bearer */ qer = bearer->qer; if (!qer) { @@ -128,8 +132,8 @@ void smf_gx_handle_cca_initial_request( bearer->qer = qer; } - qer->mbr.uplink = sess->pdn.ambr.uplink; - qer->mbr.downlink = sess->pdn.ambr.downlink; + qer->mbr.uplink = sess->session.ambr.uplink; + qer->mbr.downlink = sess->session.ambr.downlink; } /* Setup FAR */ @@ -150,7 +154,7 @@ void smf_gx_handle_cca_initial_request( ogs_assert(ul_pdr); /* Set UE IP Address to the Default DL PDR */ - ogs_pfcp_paa_to_ue_ip_addr(&sess->pdn.paa, + ogs_pfcp_paa_to_ue_ip_addr(&sess->session.paa, &dl_pdr->ue_ip_addr, &dl_pdr->ue_ip_addr_len); dl_pdr->ue_ip_addr.sd = OGS_PFCP_UE_IP_DST; diff --git a/src/smf/meson.build b/src/smf/meson.build index ba371084c..f5176b12e 100644 --- a/src/smf/meson.build +++ b/src/smf/meson.build @@ -44,6 +44,7 @@ libsmf_sources = files(''' n4-build.h n4-handler.h binding.h + nnrf-build.h nnrf-handler.h nudm-build.h nudm-handler.h @@ -77,6 +78,7 @@ libsmf_sources = files(''' n4-build.c n4-handler.c binding.c + nnrf-build.c nnrf-handler.c nudm-build.c nudm-handler.c diff --git a/src/smf/n4-build.c b/src/smf/n4-build.c index 55516b287..3c4af0072 100644 --- a/src/smf/n4-build.c +++ b/src/smf/n4-build.c @@ -98,7 +98,7 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request( /* PDN Type */ req->pdn_type.presence = 1; - req->pdn_type.u8 = sess->pdn.paa.pdn_type; + req->pdn_type.u8 = sess->session.paa.session_type; pfcp_message.h.type = type; pkbuf = ogs_pfcp_build_msg(&pfcp_message); diff --git a/src/smf/nf-sm.c b/src/smf/nf-sm.c index 5e2730885..1476fe6c1 100644 --- a/src/smf/nf-sm.c +++ b/src/smf/nf-sm.c @@ -109,7 +109,7 @@ void smf_nf_state_will_register(ogs_fsm_t *s, smf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + smf_nnrf_nfm_send_nf_register(nf_instance); break; case OGS_FSM_EXIT_SIG: @@ -164,7 +164,7 @@ void smf_nf_state_will_register(ogs_fsm_t *s, smf_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + smf_nnrf_nfm_send_nf_register(nf_instance); break; default: diff --git a/src/smf/ngap-build.c b/src/smf/ngap-build.c index 88d0c8774..901624d82 100644 --- a/src/smf/ngap-build.c +++ b/src/smf/ngap-build.c @@ -47,7 +47,7 @@ ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request_transfer( ogs_debug("PDUSessionResourceSetupRequestTransfer"); memset(&message, 0, sizeof(NGAP_PDUSessionResourceSetupRequestTransfer_t)); - if (sess->pdn.ambr.downlink || sess->pdn.ambr.uplink) { + if (sess->session.ambr.downlink || sess->session.ambr.uplink) { ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestTransferIEs_t)); ogs_assert(ie); @@ -61,9 +61,9 @@ ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request_transfer( &ie->value.choice.PDUSessionAggregateMaximumBitRate; asn_uint642INTEGER(&PDUSessionAggregateMaximumBitRate-> - pDUSessionAggregateMaximumBitRateUL, sess->pdn.ambr.uplink); + pDUSessionAggregateMaximumBitRateUL, sess->session.ambr.uplink); asn_uint642INTEGER(&PDUSessionAggregateMaximumBitRate-> - pDUSessionAggregateMaximumBitRateDL, sess->pdn.ambr.downlink); + pDUSessionAggregateMaximumBitRateDL, sess->session.ambr.downlink); } ie = CALLOC(1, sizeof(NGAP_PDUSessionResourceSetupRequestTransferIEs_t)); @@ -114,7 +114,7 @@ ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request_transfer( PDUSessionType = &ie->value.choice.PDUSessionType; *PDUSessionType = OGS_PDU_SESSION_TYPE_IPV4; - switch (sess->pdn.pdn_type) { + switch (sess->session.session_type) { case OGS_PDU_SESSION_TYPE_IPV4 : *PDUSessionType = NGAP_PDUSessionType_ipv4; break; @@ -125,7 +125,7 @@ ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request_transfer( *PDUSessionType = NGAP_PDUSessionType_ipv4v6; break; default: - ogs_fatal("Unknown PDU Session Type [%d]", sess->pdn.pdn_type); + ogs_fatal("Unknown PDU Session Type [%d]", sess->session.session_type); ogs_assert_if_reached(); } @@ -160,23 +160,16 @@ ogs_pkbuf_t *ngap_build_pdu_session_resource_setup_request_transfer( *qosFlowIdentifier = qos_flow->qfi; - nonDynamic5QI->fiveQI = qos_flow->qos.qci; + nonDynamic5QI->fiveQI = qos_flow->qos.index; allocationAndRetentionPriority->priorityLevelARP = qos_flow->qos.arp.priority_level; if (qos_flow->qos.arp.pre_emption_capability == - OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED) - allocationAndRetentionPriority->pre_emptionCapability = - NGAP_Pre_emptionCapability_shall_not_trigger_pre_emption; - else + OGS_5GC_PRE_EMPTION_ENABLED) allocationAndRetentionPriority->pre_emptionCapability = NGAP_Pre_emptionCapability_may_trigger_pre_emption; - if (qos_flow->qos.arp.pre_emption_vulnerability == - OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED) - allocationAndRetentionPriority->pre_emptionVulnerability = - NGAP_Pre_emptionVulnerability_not_pre_emptable; - else + OGS_5GC_PRE_EMPTION_ENABLED) allocationAndRetentionPriority->pre_emptionVulnerability = NGAP_Pre_emptionVulnerability_pre_emptable; @@ -256,23 +249,16 @@ ogs_pkbuf_t *ngap_build_qos_flow_resource_modify_request_transfer( *qosFlowIdentifier = qos_flow->qfi; - nonDynamic5QI->fiveQI = qos_flow->qos.qci; + nonDynamic5QI->fiveQI = qos_flow->qos.index; allocationAndRetentionPriority->priorityLevelARP = qos_flow->qos.arp.priority_level; if (qos_flow->qos.arp.pre_emption_capability == - OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED) - allocationAndRetentionPriority->pre_emptionCapability = - NGAP_Pre_emptionCapability_shall_not_trigger_pre_emption; - else + OGS_5GC_PRE_EMPTION_ENABLED) allocationAndRetentionPriority->pre_emptionCapability = NGAP_Pre_emptionCapability_may_trigger_pre_emption; - if (qos_flow->qos.arp.pre_emption_vulnerability == - OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED) - allocationAndRetentionPriority->pre_emptionVulnerability = - NGAP_Pre_emptionVulnerability_not_pre_emptable; - else + OGS_5GC_PRE_EMPTION_ENABLED) allocationAndRetentionPriority->pre_emptionVulnerability = NGAP_Pre_emptionVulnerability_pre_emptable; diff --git a/src/smf/nnrf-build.c b/src/smf/nnrf-build.c new file mode 100644 index 000000000..a6a476713 --- /dev/null +++ b/src/smf/nnrf-build.c @@ -0,0 +1,290 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnrf-build.h" + +ogs_sbi_request_t *smf_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance) +{ + int i, j; + ogs_sbi_nf_info_t *nf_info = NULL; + + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + OpenAPI_nf_profile_t *NFProfile = NULL; + + OpenAPI_list_t *SmfInfoList = NULL; + OpenAPI_map_t *SmfInfoMap = NULL; + OpenAPI_smf_info_t *SmfInfo = NULL; + int SmfInfoMapKey; + + 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, *node3 = 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; + + SmfInfoList = OpenAPI_list_create(); + ogs_assert(SmfInfoList); + + SmfInfoMapKey = 0; + ogs_list_for_each(&ogs_sbi_self()->nf_info_list, nf_info) { + if (nf_info->nf_type != OpenAPI_nf_type_SMF) { + ogs_fatal("Not implemented NF-type[%s]", + OpenAPI_nf_type_ToString(nf_info->nf_type)); + ogs_assert_if_reached(); + } + + if (nf_info->smf.num_of_slice == 0) { + ogs_fatal("CHECK CONFIGURATION: No S-NSSAI"); + ogs_assert_if_reached(); + } + + SmfInfo = ogs_calloc(1, sizeof(*SmfInfo)); + ogs_assert(SmfInfo); + + sNssaiSmfInfoList = OpenAPI_list_create(); + ogs_assert(sNssaiSmfInfoList); + + for (i = 0; i < nf_info->smf.num_of_slice; i++) { + DnnSmfInfoList = OpenAPI_list_create(); + ogs_assert(DnnSmfInfoList); + + for (j = 0; j < nf_info->smf.slice[i].num_of_dnn; j++) { + DnnSmfInfoItem = ogs_calloc(1, sizeof(*DnnSmfInfoItem)); + ogs_assert(DnnSmfInfoItem); + DnnSmfInfoItem->dnn = nf_info->smf.slice[i].dnn[j]; + + OpenAPI_list_add(DnnSmfInfoList, DnnSmfInfoItem); + } + + if (!DnnSmfInfoList->count) { + OpenAPI_list_free(DnnSmfInfoList); + + ogs_fatal("CHECK CONFIGURATION: No DNN"); + ogs_assert_if_reached(); + } + + sNssaiSmfInfoItem = ogs_calloc(1, sizeof(*sNssaiSmfInfoItem)); + ogs_assert(sNssaiSmfInfoItem); + + sNssaiSmfInfoItem->dnn_smf_info_list = DnnSmfInfoList; + + sNssaiSmfInfoItem->s_nssai = sNssai = + ogs_calloc(1, sizeof(*sNssai)); + ogs_assert(sNssai); + sNssai->sst = nf_info->smf.slice[i].s_nssai.sst; + sNssai->sd = + ogs_s_nssai_sd_to_string(nf_info->smf.slice[i].s_nssai.sd); + + OpenAPI_list_add(sNssaiSmfInfoList, sNssaiSmfInfoItem); + } + + if (sNssaiSmfInfoList->count) + SmfInfo->s_nssai_smf_info_list = sNssaiSmfInfoList; + else + OpenAPI_list_free(sNssaiSmfInfoList); + + TaiList = OpenAPI_list_create(); + ogs_assert(TaiList); + + for (i = 0; i < nf_info->smf.num_of_nr_tai; i++) { + TaiItem = ogs_calloc(1, sizeof(*TaiItem)); + ogs_assert(TaiItem); + TaiItem->plmn_id = ogs_sbi_build_plmn_id( + &nf_info->smf.nr_tai[i].plmn_id); + TaiItem->tac = ogs_uint24_to_0string(nf_info->smf.nr_tai[i].tac); + + OpenAPI_list_add(TaiList, TaiItem); + } + + if (TaiList->count) + SmfInfo->tai_list = TaiList; + else + OpenAPI_list_free(TaiList); + + TaiRangeList = OpenAPI_list_create(); + ogs_assert(TaiRangeList); + + for (i = 0; i < nf_info->smf.num_of_nr_tai_range; i++) { + TacRangeList = OpenAPI_list_create(); + ogs_assert(TacRangeList); + + for (j = 0; + j < nf_info->smf.nr_tai_range[i].num_of_tac_range; j++) { + TacRangeItem = ogs_calloc(1, sizeof(*TacRangeItem)); + ogs_assert(TacRangeItem); + + TacRangeItem->start = ogs_uint24_to_0string( + nf_info->smf.nr_tai_range[i].start[j]); + ogs_assert(TacRangeItem->start); + TacRangeItem->end = + ogs_uint24_to_0string(nf_info->smf.nr_tai_range[i].end[j]); + ogs_assert(TacRangeItem->end); + + OpenAPI_list_add(TacRangeList, TacRangeItem); + } + + if (!TacRangeList->count) { + OpenAPI_list_free(TacRangeList); + + ogs_fatal("CHECK CONFIGURATION: No Start/End in TacRange"); + ogs_assert_if_reached(); + } + + TaiRangeItem = ogs_calloc(1, sizeof(*TaiRangeItem)); + ogs_assert(TaiRangeItem); + + TaiRangeItem->plmn_id = ogs_sbi_build_plmn_id( + &nf_info->smf.nr_tai_range[i].plmn_id); + + TaiRangeItem->tac_range_list = TacRangeList; + + OpenAPI_list_add(TaiRangeList, TaiRangeItem); + } + + if (TaiRangeList->count) + SmfInfo->tai_range_list = TaiRangeList; + else + OpenAPI_list_free(TaiRangeList); + + SmfInfoMap = OpenAPI_map_create( + ogs_msprintf("%d", ++SmfInfoMapKey), SmfInfo); + ogs_assert(SmfInfoMap); + + OpenAPI_list_add(SmfInfoList, SmfInfoMap); + } + + NFProfile = ogs_nnrf_nfm_build_nf_profile(nf_instance); + ogs_assert(NFProfile); + + if (SmfInfoList->count == 1) { + NFProfile->smf_info = SmfInfo; + } else if (SmfInfoList->count > 1) { + NFProfile->smf_info_list = SmfInfoList; + } + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + OpenAPI_list_for_each(SmfInfoList, node) { + SmfInfoMap = node->data; + if (SmfInfoMap) { + SmfInfo = SmfInfoMap->value; + if (SmfInfo) { + sNssaiSmfInfoList = SmfInfo->s_nssai_smf_info_list; + OpenAPI_list_for_each(sNssaiSmfInfoList, node2) { + sNssaiSmfInfoItem = node2->data; + ogs_assert(sNssaiSmfInfoItem); + + DnnSmfInfoList = sNssaiSmfInfoItem->dnn_smf_info_list; + OpenAPI_list_for_each(DnnSmfInfoList, node3) { + DnnSmfInfoItem = node3->data; + ogs_assert(DnnSmfInfoItem); + ogs_free(DnnSmfInfoItem); + } + OpenAPI_list_free(DnnSmfInfoList); + + sNssai = sNssaiSmfInfoItem->s_nssai; + if (sNssai) { + if (sNssai->sd) + ogs_free(sNssai->sd); + ogs_free(sNssai); + } + + ogs_free(sNssaiSmfInfoItem); + } + OpenAPI_list_free(sNssaiSmfInfoList); + + TaiList = SmfInfo->tai_list; + OpenAPI_list_for_each(TaiList, node2) { + TaiItem = node2->data; + ogs_assert(TaiItem); + if (TaiItem->plmn_id) + ogs_sbi_free_plmn_id(TaiItem->plmn_id); + if (TaiItem->tac) + ogs_free(TaiItem->tac); + ogs_free(TaiItem); + } + OpenAPI_list_free(TaiList); + + TaiRangeList = SmfInfo->tai_range_list; + OpenAPI_list_for_each(TaiRangeList, node2) { + TaiRangeItem = node2->data; + ogs_assert(TaiRangeItem); + + if (TaiRangeItem->plmn_id) + ogs_sbi_free_plmn_id(TaiRangeItem->plmn_id); + + TacRangeList = TaiRangeItem->tac_range_list; + OpenAPI_list_for_each(TacRangeList, node3) { + TacRangeItem = node3->data; + ogs_assert(TacRangeItem); + if (TacRangeItem->start) + ogs_free(TacRangeItem->start); + if (TacRangeItem->end) + ogs_free(TacRangeItem->end); + + ogs_free(TacRangeItem); + } + OpenAPI_list_free(TacRangeList); + + ogs_free(TaiRangeItem); + } + OpenAPI_list_free(TaiRangeList); + + ogs_free(SmfInfo); + } + if (SmfInfoMap->key) + ogs_free(SmfInfoMap->key); + ogs_free(SmfInfoMap); + } + } + OpenAPI_list_free(SmfInfoList); + + return request; +} diff --git a/src/smf/nnrf-build.h b/src/smf/nnrf-build.h new file mode 100644 index 000000000..97bac7fbc --- /dev/null +++ b/src/smf/nnrf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SMF_NNRF_BUILD_H +#define SMF_NNRF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *smf_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NNRF_BUILD_H */ diff --git a/src/smf/nnrf-handler.c b/src/smf/nnrf-handler.c index 355bd87b2..550ea4958 100644 --- a/src/smf/nnrf-handler.c +++ b/src/smf/nnrf-handler.c @@ -285,6 +285,8 @@ void smf_nnrf_handle_nf_discover( } if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { + smf_sess_t *sess = NULL; + handled = ogs_sbi_nnrf_handle_nf_profile( nf_instance, NFProfile, NULL, NULL); if (!handled) { @@ -301,10 +303,9 @@ void smf_nnrf_handle_nf_discover( continue; } - if (!OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, nf_instance->nf_type)) - ogs_sbi_nf_instance_associate(sbi_object->nf_type_array, - nf_instance->nf_type, smf_nf_state_registered); + sess = (smf_sess_t *)sbi_object; + ogs_assert(sess); + smf_sess_select_nf(sess, nf_instance->nf_type); /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -324,8 +325,7 @@ void smf_nnrf_handle_nf_discover( } ogs_assert(xact->target_nf_type); - nf_instance = OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, xact->target_nf_type); + nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, xact->target_nf_type); if (!nf_instance) { ogs_error("(NF discover) No [%s]", OpenAPI_nf_type_ToString(xact->target_nf_type)); diff --git a/src/smf/npcf-build.c b/src/smf/npcf-build.c index a5a33dfaf..89513c5b1 100644 --- a/src/smf/npcf-build.c +++ b/src/smf/npcf-build.c @@ -52,10 +52,10 @@ ogs_sbi_request_t *smf_npcf_smpolicycontrol_build_create( SmPolicyContextData.supi = smf_ue->supi; ogs_assert(sess->psi); SmPolicyContextData.pdu_session_id = sess->psi; - ogs_assert(sess->pdn.pdn_type); - SmPolicyContextData.pdu_session_type = sess->pdn.pdn_type; - ogs_assert(sess->dnn); - SmPolicyContextData.dnn = sess->dnn; + ogs_assert(sess->session.session_type); + SmPolicyContextData.pdu_session_type = sess->session.session_type; + ogs_assert(sess->session.name); + SmPolicyContextData.dnn = sess->session.name; server = ogs_list_first(&ogs_sbi_self()->server_list); ogs_assert(server); @@ -72,13 +72,13 @@ ogs_sbi_request_t *smf_npcf_smpolicycontrol_build_create( memset(&SubsSessAmbr, 0, sizeof(SubsSessAmbr)); if (OGS_SBI_FEATURES_IS_SET(sess->smpolicycontrol_features, OGS_SBI_NPCF_SMPOLICYCONTROL_DN_AUTHORIZATION)) { - if (sess->pdn.ambr.uplink) { + if (sess->session.ambr.uplink) { SubsSessAmbr.uplink = ogs_sbi_bitrate_to_string( - sess->pdn.ambr.uplink, OGS_SBI_BITRATE_KBPS); + sess->session.ambr.uplink, OGS_SBI_BITRATE_KBPS); } - if (sess->pdn.ambr.downlink) { + if (sess->session.ambr.downlink) { SubsSessAmbr.downlink = ogs_sbi_bitrate_to_string( - sess->pdn.ambr.downlink, OGS_SBI_BITRATE_KBPS); + sess->session.ambr.downlink, OGS_SBI_BITRATE_KBPS); } if (SubsSessAmbr.downlink || SubsSessAmbr.uplink) { SmPolicyContextData.subs_sess_ambr = &SubsSessAmbr; @@ -86,22 +86,26 @@ ogs_sbi_request_t *smf_npcf_smpolicycontrol_build_create( } memset(&Arp, 0, sizeof(Arp)); - if (sess->pdn.qos.arp.pre_emption_capability == - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED) + if (sess->session.qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_ENABLED) Arp.preempt_cap = OpenAPI_preemption_capability_MAY_PREEMPT; - else + else if (sess->session.qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_DISABLED) Arp.preempt_cap = OpenAPI_preemption_capability_NOT_PREEMPT; - if (sess->pdn.qos.arp.pre_emption_vulnerability == - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED) + ogs_assert(Arp.preempt_cap); + if (sess->session.qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_ENABLED) Arp.preempt_vuln = OpenAPI_preemption_vulnerability_PREEMPTABLE; - else + else if (sess->session.qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_DISABLED) Arp.preempt_vuln = OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE; - Arp.priority_level = sess->pdn.qos.arp.priority_level; + ogs_assert(Arp.preempt_vuln); + Arp.priority_level = sess->session.qos.arp.priority_level; memset(&SubsDefQos, 0, sizeof(SubsDefQos)); SubsDefQos.arp = &Arp; - SubsDefQos._5qi = sess->pdn.qos.qci; - SubsDefQos.priority_level = sess->pdn.qos.arp.priority_level; + SubsDefQos._5qi = sess->session.qos.index; + SubsDefQos.priority_level = sess->session.qos.arp.priority_level; SmPolicyContextData.subs_def_qos = &SubsDefQos; diff --git a/src/smf/npcf-handler.c b/src/smf/npcf-handler.c index 094a38c3c..051293fad 100644 --- a/src/smf/npcf-handler.c +++ b/src/smf/npcf-handler.c @@ -145,39 +145,41 @@ bool smf_npcf_smpolicycontrol_handle_create( if (AuthSessAmbr && trigger_results[ OpenAPI_policy_control_request_trigger_SE_AMBR_CH] == true) { if (AuthSessAmbr->uplink) - sess->pdn.ambr.uplink = + sess->session.ambr.uplink = ogs_sbi_bitrate_from_string(AuthSessAmbr->uplink); if (AuthSessAmbr->downlink) - sess->pdn.ambr.downlink = + sess->session.ambr.downlink = ogs_sbi_bitrate_from_string(AuthSessAmbr->downlink); } AuthDefQos = SessionRule->auth_def_qos; if (AuthDefQos && trigger_results[ OpenAPI_policy_control_request_trigger_DEF_QOS_CH] == true) { - sess->pdn.qos.qci = AuthDefQos->_5qi; - sess->pdn.qos.arp.priority_level = + sess->session.qos.index = AuthDefQos->_5qi; + sess->session.qos.arp.priority_level = AuthDefQos->priority_level; if (AuthDefQos->arp) { - sess->pdn.qos.arp.priority_level = + sess->session.qos.arp.priority_level = AuthDefQos->arp->priority_level; if (AuthDefQos->arp->preempt_cap == OpenAPI_preemption_capability_NOT_PREEMPT) - sess->pdn.qos.arp.pre_emption_capability = - OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED; + sess->session.qos.arp.pre_emption_capability = + OGS_5GC_PRE_EMPTION_DISABLED; else if (AuthDefQos->arp->preempt_cap == OpenAPI_preemption_capability_MAY_PREEMPT) - sess->pdn.qos.arp.pre_emption_capability = - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED; + sess->session.qos.arp.pre_emption_capability = + OGS_5GC_PRE_EMPTION_ENABLED; + ogs_assert(sess->session.qos.arp.pre_emption_capability); if (AuthDefQos->arp->preempt_vuln == OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE) - sess->pdn.qos.arp.pre_emption_vulnerability = - OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED; + sess->session.qos.arp.pre_emption_vulnerability = + OGS_5GC_PRE_EMPTION_DISABLED; else if (AuthDefQos->arp->preempt_vuln == OpenAPI_preemption_vulnerability_PREEMPTABLE) - sess->pdn.qos.arp.pre_emption_vulnerability = - OGS_PDN_PRE_EMPTION_VULNERABILITY_ENABLED; + sess->session.qos.arp.pre_emption_vulnerability = + OGS_5GC_PRE_EMPTION_ENABLED; + ogs_assert(sess->session.qos.arp.pre_emption_vulnerability); } } } @@ -296,7 +298,7 @@ bool smf_npcf_smpolicycontrol_handle_create( } } - pcc_rule->qos.qci = QosData->_5qi; + pcc_rule->qos.index = QosData->_5qi; pcc_rule->qos.arp.priority_level = QosData->priority_level; if (QosData->arp) { @@ -304,20 +306,22 @@ bool smf_npcf_smpolicycontrol_handle_create( if (QosData->arp->preempt_cap == OpenAPI_preemption_capability_NOT_PREEMPT) pcc_rule->qos.arp.pre_emption_capability = - OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED; + OGS_5GC_PRE_EMPTION_DISABLED; else if (QosData->arp->preempt_cap == OpenAPI_preemption_capability_MAY_PREEMPT) pcc_rule->qos.arp.pre_emption_capability = - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED; + OGS_5GC_PRE_EMPTION_ENABLED; + ogs_assert(pcc_rule->qos.arp.pre_emption_capability); if (QosData->arp->preempt_vuln == OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE) pcc_rule->qos.arp.pre_emption_vulnerability = - OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED; + OGS_5GC_PRE_EMPTION_DISABLED; else if (QosData->arp->preempt_vuln == OpenAPI_preemption_vulnerability_PREEMPTABLE) pcc_rule->qos.arp.pre_emption_vulnerability = - OGS_PDN_PRE_EMPTION_VULNERABILITY_ENABLED; + OGS_5GC_PRE_EMPTION_ENABLED; + ogs_assert(pcc_rule->qos.arp.pre_emption_vulnerability); } if (QosData->maxbr_ul) @@ -372,13 +376,13 @@ bool smf_npcf_smpolicycontrol_handle_create( ogs_assert(qos_flow); /* Copy Session QoS information to Default QoS Flow */ - memcpy(&qos_flow->qos, &sess->pdn.qos, sizeof(ogs_qos_t)); + memcpy(&qos_flow->qos, &sess->session.qos, sizeof(ogs_qos_t)); /* Setup QER */ qer = qos_flow->qer; ogs_assert(qer); - qer->mbr.uplink = sess->pdn.ambr.uplink; - qer->mbr.downlink = sess->pdn.ambr.downlink; + qer->mbr.uplink = sess->session.ambr.uplink; + qer->mbr.downlink = sess->session.ambr.downlink; /* Setup PDR */ dl_pdr = qos_flow->dl_pdr; @@ -389,12 +393,12 @@ bool smf_npcf_smpolicycontrol_handle_create( /* Set UE IP Address to the Default DL PDR */ smf_sess_set_ue_ip(sess); - ogs_pfcp_paa_to_ue_ip_addr(&sess->pdn.paa, + ogs_pfcp_paa_to_ue_ip_addr(&sess->session.paa, &dl_pdr->ue_ip_addr, &dl_pdr->ue_ip_addr_len); dl_pdr->ue_ip_addr.sd = OGS_PFCP_UE_IP_DST; ogs_info("UE SUPI[%s] DNN[%s] IPv4[%s] IPv6[%s]", - smf_ue->supi, sess->pdn.dnn, + smf_ue->supi, sess->session.name, sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); @@ -408,7 +412,7 @@ bool smf_npcf_smpolicycontrol_handle_create( } else { resource = ogs_pfcp_gtpu_resource_find( &sess->pfcp_node->gtpu_resource_list, - sess->pdn.dnn, OGS_PFCP_INTERFACE_ACCESS); + sess->session.name, OGS_PFCP_INTERFACE_ACCESS); if (resource) { ogs_pfcp_user_plane_ip_resource_info_to_sockaddr(&resource->info, &sess->upf_n3_addr, &sess->upf_n3_addr6); diff --git a/src/smf/nsmf-handler.c b/src/smf/nsmf-handler.c index 00a31f6d0..bc7387bb9 100644 --- a/src/smf/nsmf-handler.c +++ b/src/smf/nsmf-handler.c @@ -165,11 +165,9 @@ bool smf_nsmf_handle_create_sm_context( sess->s_nssai.sst = sNssai->sst; sess->s_nssai.sd = ogs_s_nssai_sd_from_string(sNssai->sd); if (SmContextCreateData->hplmn_snssai) { - sess->s_nssai.mapped_hplmn_sst = - SmContextCreateData->hplmn_snssai->sst; - sess->s_nssai.mapped_hplmn_sd = - ogs_s_nssai_sd_from_string( - SmContextCreateData->hplmn_snssai->sd); + sess->mapped_hplmn.sst = SmContextCreateData->hplmn_snssai->sst; + sess->mapped_hplmn.sd = ogs_s_nssai_sd_from_string( + SmContextCreateData->hplmn_snssai->sd); } if (sess->sm_context_status_uri) @@ -187,8 +185,8 @@ bool smf_nsmf_handle_create_sm_context( ogs_freeaddrinfo(addr); if (SmContextCreateData->dnn) { - if (sess->dnn) ogs_free(sess->dnn); - sess->dnn = ogs_strdup(SmContextCreateData->dnn); + if (sess->session.name) ogs_free(sess->session.name); + sess->session.name = ogs_strdup(SmContextCreateData->dnn); } if (SmContextCreateData->pcf_id) { diff --git a/src/smf/nudm-build.c b/src/smf/nudm-build.c index ac574401f..09daeeca7 100644 --- a/src/smf/nudm-build.c +++ b/src/smf/nudm-build.c @@ -38,11 +38,11 @@ ogs_sbi_request_t *smf_nudm_sdm_build_get(smf_sess_t *sess, void *data) message.h.resource.component[1] = data; message.param.single_nssai_presence = true; - memcpy(&message.param.single_nssai, &sess->s_nssai, - sizeof(message.param.single_nssai)); + memcpy(&message.param.s_nssai, &sess->s_nssai, + sizeof(message.param.s_nssai)); - if (sess->dnn) - message.param.dnn = sess->dnn; + if (sess->session.name) + message.param.dnn = sess->session.name; request = ogs_sbi_build_request(&message); ogs_assert(request); diff --git a/src/smf/nudm-handler.c b/src/smf/nudm-handler.c index e0051585d..76c08b8ad 100644 --- a/src/smf/nudm-handler.c +++ b/src/smf/nudm-handler.c @@ -109,8 +109,9 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream, continue; } - if (sess->dnn && - ogs_strcasecmp(sess->dnn, dnnConfigurationMap->key) != 0) + if (sess->session.name && + ogs_strcasecmp(sess->session.name, + dnnConfigurationMap->key) != 0) continue; if (sess->ue_pdu_session_type) { @@ -119,31 +120,33 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream, if (node2->data) { uint8_t allowed_session_type = (uintptr_t)node2->data; if (sess->ue_pdu_session_type == allowed_session_type) { - sess->pdn.pdn_type = sess->ue_pdu_session_type; + sess->session.session_type = + sess->ue_pdu_session_type; break; } } } } - if (!sess->pdn.pdn_type) - sess->pdn.pdn_type = pduSessionTypeList->default_session_type; + if (!sess->session.session_type) + sess->session.session_type = + pduSessionTypeList->default_session_type; if (sess->ue_ssc_mode) { OpenAPI_list_for_each(sscModeList->allowed_ssc_modes, node2) { if (node2->data) { uint8_t allowed_ssc_mode = (uintptr_t)node2->data; if (sess->ue_ssc_mode == allowed_ssc_mode) { - sess->pdn.ssc_mode = sess->ue_ssc_mode; + sess->session.ssc_mode = sess->ue_ssc_mode; break; } } } } else { - sess->pdn.ssc_mode = sscModeList->default_ssc_mode; + sess->session.ssc_mode = sscModeList->default_ssc_mode; } - if (!sess->pdn.ssc_mode) { + if (!sess->session.ssc_mode) { ogs_error("SSCMode is not allowed"); continue; } @@ -154,32 +157,38 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream, continue; } - sess->pdn.ambr.uplink = + sess->session.ambr.uplink = ogs_sbi_bitrate_from_string(sessionAmbr->uplink); - sess->pdn.ambr.downlink = + sess->session.ambr.downlink = ogs_sbi_bitrate_from_string(sessionAmbr->downlink); _5gQoSProfile = dnnConfiguration->_5g_qos_profile; if (_5gQoSProfile) { - sess->pdn.qos.qci = _5gQoSProfile->_5qi; - sess->pdn.qos.arp.priority_level = + sess->session.qos.index = _5gQoSProfile->_5qi; + sess->session.qos.arp.priority_level = _5gQoSProfile->priority_level; - sess->pdn.qos.arp.pre_emption_capability = - OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED; - sess->pdn.qos.arp.pre_emption_vulnerability = - OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED; if (_5gQoSProfile->arp) { - sess->pdn.qos.arp.priority_level = + sess->session.qos.arp.priority_level = _5gQoSProfile->arp->priority_level; if (_5gQoSProfile->arp->preempt_cap == OpenAPI_preemption_capability_MAY_PREEMPT) - sess->pdn.qos.arp.pre_emption_capability = - OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED; + sess->session.qos.arp.pre_emption_capability = + OGS_5GC_PRE_EMPTION_ENABLED; + else if (_5gQoSProfile->arp->preempt_cap == + OpenAPI_preemption_capability_NOT_PREEMPT) + sess->session.qos.arp.pre_emption_capability = + OGS_5GC_PRE_EMPTION_DISABLED; + ogs_assert(sess->session.qos.arp.pre_emption_capability); + if (_5gQoSProfile->arp->preempt_vuln == - OpenAPI_preemption_vulnerability_PREEMPTABLE) { - sess->pdn.qos.arp.pre_emption_vulnerability = - OGS_PDN_PRE_EMPTION_VULNERABILITY_ENABLED; - } + OpenAPI_preemption_vulnerability_PREEMPTABLE) + sess->session.qos.arp.pre_emption_vulnerability = + OGS_5GC_PRE_EMPTION_ENABLED; + else if (_5gQoSProfile->arp->preempt_vuln == + OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE) + sess->session.qos.arp.pre_emption_vulnerability = + OGS_5GC_PRE_EMPTION_DISABLED; + ogs_assert(sess->session.qos.arp.pre_emption_vulnerability); } } @@ -204,13 +213,13 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream, } if (ipv4 && ipv6) { - sess->pdn.ue_ip.addr = ipsub4.sub[0]; - memcpy(sess->pdn.ue_ip.addr6, + sess->session.ue_ip.addr = ipsub4.sub[0]; + memcpy(sess->session.ue_ip.addr6, ipsub6.sub, OGS_IPV6_LEN); } else if (ipv4) { - sess->pdn.ue_ip.addr = ipsub4.sub[0]; + sess->session.ue_ip.addr = ipsub4.sub[0]; } else if (ipv6) { - memcpy(sess->pdn.ue_ip.addr6, + memcpy(sess->session.ue_ip.addr6, ipsub6.sub, OGS_IPV6_LEN); } } @@ -219,15 +228,14 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream, } /* Succeeded to get PDU Session */ - ogs_cpystrn(sess->pdn.dnn, dnnConfigurationMap->key, - ogs_min(strlen(dnnConfigurationMap->key), - OGS_MAX_DNN_LEN)+1); + if (!sess->session.name) + sess->session.name = ogs_strdup(dnnConfigurationMap->key); break; } } - if (!strlen(sess->pdn.dnn)) { + if (!sess->session.name) { strerror = ogs_msprintf("[%s:%d] No dnnConfiguration", smf_ue->supi, sess->psi); return false; diff --git a/src/smf/s5c-build.c b/src/smf/s5c-build.c index 3927697c5..6516edff7 100644 --- a/src/smf/s5c-build.c +++ b/src/smf/s5c-build.c @@ -76,7 +76,7 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response( len = len; /* PDN Address Allocation */ - rsp->pdn_address_allocation.data = &sess->pdn.paa; + rsp->pdn_address_allocation.data = &sess->session.paa; if (sess->ipv4 && sess->ipv6) rsp->pdn_address_allocation.len = OGS_PAA_IPV4V6_LEN; else if (sess->ipv4) @@ -95,8 +95,8 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response( * if PCRF changes APN-AMBR, this should be included. */ if (sess->gtp.create_session_response_apn_ambr == true) { memset(&ambr, 0, sizeof(ogs_gtp_ambr_t)); - ambr.uplink = htobe32(sess->pdn.ambr.uplink / 1000); - ambr.downlink = htobe32(sess->pdn.ambr.downlink / 1000); + ambr.uplink = htobe32(sess->session.ambr.uplink / 1000); + ambr.downlink = htobe32(sess->session.ambr.downlink / 1000); rsp->aggregate_maximum_bit_rate.presence = 1; rsp->aggregate_maximum_bit_rate.data = &ambr; rsp->aggregate_maximum_bit_rate.len = sizeof(ambr); @@ -127,12 +127,12 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response( * if PCRF changes Bearer QoS, this should be included. */ if (sess->gtp.create_session_response_bearer_qos == true) { memset(&bearer_qos, 0, sizeof(bearer_qos)); - bearer_qos.qci = sess->pdn.qos.qci; - bearer_qos.priority_level = sess->pdn.qos.arp.priority_level; + bearer_qos.qci = sess->session.qos.index; + bearer_qos.priority_level = sess->session.qos.arp.priority_level; bearer_qos.pre_emption_capability = - sess->pdn.qos.arp.pre_emption_capability; + sess->session.qos.arp.pre_emption_capability; bearer_qos.pre_emption_vulnerability = - sess->pdn.qos.arp.pre_emption_vulnerability; + sess->session.qos.arp.pre_emption_vulnerability; rsp->bearer_contexts_created.bearer_level_qos.presence = 1; ogs_gtp_build_bearer_qos(&rsp->bearer_contexts_created.bearer_level_qos, @@ -249,7 +249,7 @@ ogs_pkbuf_t *smf_s5c_build_create_bearer_request( /* Bearer QoS */ memset(&bearer_qos, 0, sizeof(bearer_qos)); - bearer_qos.qci = bearer->qos.qci; + bearer_qos.qci = bearer->qos.index; bearer_qos.priority_level = bearer->qos.arp.priority_level; bearer_qos.pre_emption_capability = bearer->qos.arp.pre_emption_capability; @@ -304,7 +304,7 @@ ogs_pkbuf_t *smf_s5c_build_update_bearer_request( req->bearer_contexts.eps_bearer_id.presence = 1; req->bearer_contexts.eps_bearer_id.u8 = bearer->ebi; - if (sess->pdn.ambr.uplink || sess->pdn.ambr.downlink) { + if (sess->session.ambr.uplink || sess->session.ambr.downlink) { /* * Ch 8.7. Aggregate Maximum Bit Rate(AMBR) in TS 29.274 V15.9.0 * @@ -313,8 +313,8 @@ ogs_pkbuf_t *smf_s5c_build_update_bearer_request( * Unsigned32 binary integer values in kbps (1000 bits per second). */ memset(&ambr, 0, sizeof(ogs_gtp_ambr_t)); - ambr.uplink = htobe32(sess->pdn.ambr.uplink / 1000); - ambr.downlink = htobe32(sess->pdn.ambr.downlink / 1000); + ambr.uplink = htobe32(sess->session.ambr.uplink / 1000); + ambr.downlink = htobe32(sess->session.ambr.downlink / 1000); req->aggregate_maximum_bit_rate.presence = 1; req->aggregate_maximum_bit_rate.data = &ambr; req->aggregate_maximum_bit_rate.len = sizeof(ambr); @@ -329,7 +329,7 @@ ogs_pkbuf_t *smf_s5c_build_update_bearer_request( /* Bearer QoS */ if (qos_presence == 1) { memset(&bearer_qos, 0, sizeof(bearer_qos)); - bearer_qos.qci = bearer->qos.qci; + bearer_qos.qci = bearer->qos.index; bearer_qos.priority_level = bearer->qos.arp.priority_level; bearer_qos.pre_emption_capability = bearer->qos.arp.pre_emption_capability; diff --git a/src/smf/s5c-handler.c b/src/smf/s5c-handler.c index 6ce8c7626..1f6fced26 100644 --- a/src/smf/s5c-handler.c +++ b/src/smf/s5c-handler.c @@ -148,15 +148,16 @@ void smf_s5c_handle_create_session_request( /* UE IP Address */ ogs_assert(req->pdn_address_allocation.data); - sess->pdn.pdn_type = req->pdn_type.u8; + sess->session.session_type = req->pdn_type.u8; ogs_gtp_paa_to_ip( - (ogs_paa_t *)req->pdn_address_allocation.data, &sess->pdn.ue_ip); + (ogs_paa_t *)req->pdn_address_allocation.data, + &sess->session.ue_ip); smf_sess_set_ue_ip(sess); ogs_info("UE IMSI[%s] APN[%s] IPv4[%s] IPv6[%s]", smf_ue->imsi_bcd, - sess->pdn.apn, + sess->session.name, sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); @@ -192,11 +193,11 @@ void smf_s5c_handle_create_session_request( &req->bearer_contexts_to_be_created.bearer_level_qos); ogs_assert(req->bearer_contexts_to_be_created.bearer_level_qos.len == decoded); - sess->pdn.qos.qci = bearer_qos.qci; - sess->pdn.qos.arp.priority_level = bearer_qos.priority_level; - sess->pdn.qos.arp.pre_emption_capability = + sess->session.qos.index = bearer_qos.qci; + sess->session.qos.arp.priority_level = bearer_qos.priority_level; + sess->session.qos.arp.pre_emption_capability = bearer_qos.pre_emption_capability; - sess->pdn.qos.arp.pre_emption_vulnerability = + sess->session.qos.arp.pre_emption_vulnerability = bearer_qos.pre_emption_vulnerability; /* Set AMBR if available */ @@ -209,8 +210,8 @@ void smf_s5c_handle_create_session_request( * Unsigned32 binary integer values in kbps (1000 bits per second). */ ambr = req->aggregate_maximum_bit_rate.data; - sess->pdn.ambr.downlink = be32toh(ambr->downlink) * 1000; - sess->pdn.ambr.uplink = be32toh(ambr->uplink) * 1000; + sess->session.ambr.downlink = be32toh(ambr->downlink) * 1000; + sess->session.ambr.uplink = be32toh(ambr->uplink) * 1000; } /* PCO */ diff --git a/src/smf/sbi-path.c b/src/smf/sbi-path.c index dbb34b597..054f8d623 100644 --- a/src/smf/sbi-path.c +++ b/src/smf/sbi-path.c @@ -114,6 +114,23 @@ void smf_sbi_close(void) ogs_sbi_server_stop_all(); } +void smf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + request = smf_nnrf_nfm_build_register(nf_instance); + if (!request) { + ogs_error("smf_nnrf_nfm_send_nf_register() failed"); + return; + } + ogs_sbi_client_send_request(client, client->cb, request, nf_instance); +} + void smf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact) { ogs_sbi_send(nf_instance, client_cb, xact); @@ -209,7 +226,7 @@ void smf_sbi_send_sm_context_create_error( ogs_sbi_response_t *response = NULL; OpenAPI_sm_context_create_error_t SmContextCreateError; - OpenAPI_problem_details_t problem; + OpenAPI_ext_problem_details_t problem; OpenAPI_ref_to_binary_data_t n1SmMsg; ogs_assert(stream); @@ -325,7 +342,7 @@ void smf_sbi_send_sm_context_update_error( ogs_sbi_response_t *response = NULL; OpenAPI_sm_context_update_error_t SmContextUpdateError; - OpenAPI_problem_details_t problem; + OpenAPI_ext_problem_details_t problem; OpenAPI_ref_to_binary_data_t n1SmMsg; OpenAPI_ref_to_binary_data_t n2SmInfo; diff --git a/src/smf/sbi-path.h b/src/smf/sbi-path.h index 82cf9c0ec..e46ceb4a8 100644 --- a/src/smf/sbi-path.h +++ b/src/smf/sbi-path.h @@ -20,6 +20,7 @@ #ifndef SMF_SBI_PATH_H #define SMF_SBI_PATH_H +#include "nnrf-build.h" #include "nudm-build.h" #include "namf-build.h" #include "gsm-build.h" @@ -33,6 +34,8 @@ extern "C" { int smf_sbi_open(void); void smf_sbi_close(void); +void smf_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); + void smf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact); void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type, diff --git a/src/udm/context.c b/src/udm/context.c index 225ac84d2..c2489f8c4 100644 --- a/src/udm/context.c +++ b/src/udm/context.c @@ -229,3 +229,14 @@ udm_ue_t *udm_ue_cycle(udm_ue_t *udm_ue) { return ogs_pool_cycle(&udm_ue_pool, udm_ue); } + +void udm_ue_select_nf(udm_ue_t *udm_ue, OpenAPI_nf_type_e nf_type) +{ + ogs_assert(udm_ue); + ogs_assert(nf_type); + + if (nf_type == OpenAPI_nf_type_NRF) + ogs_sbi_select_nrf(&udm_ue->sbi, udm_nf_state_registered); + else + ogs_sbi_select_first_nf(&udm_ue->sbi, nf_type, udm_nf_state_registered); +} diff --git a/src/udm/context.h b/src/udm/context.h index bd379cb75..16ed47ec3 100644 --- a/src/udm/context.h +++ b/src/udm/context.h @@ -108,6 +108,8 @@ udm_ue_t *udm_ue_find_by_ctx_id(char *ctx_id); udm_ue_t *udm_ue_cycle(udm_ue_t *udm_ue); +void udm_ue_select_nf(udm_ue_t *udm_ue, OpenAPI_nf_type_e nf_type); + #ifdef __cplusplus } #endif diff --git a/src/udm/meson.build b/src/udm/meson.build index e7512342e..33d8396d2 100644 --- a/src/udm/meson.build +++ b/src/udm/meson.build @@ -20,6 +20,7 @@ libudm_sources = files(''' event.c timer.c + nnrf-build.c nnrf-handler.c nf-sm.c diff --git a/src/udm/nf-sm.c b/src/udm/nf-sm.c index a1e628531..ee601e7d8 100644 --- a/src/udm/nf-sm.c +++ b/src/udm/nf-sm.c @@ -109,7 +109,7 @@ void udm_nf_state_will_register(ogs_fsm_t *s, udm_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + udm_nnrf_nfm_send_nf_register(nf_instance); break; case OGS_FSM_EXIT_SIG: @@ -164,7 +164,7 @@ void udm_nf_state_will_register(ogs_fsm_t *s, udm_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + udm_nnrf_nfm_send_nf_register(nf_instance); break; default: diff --git a/src/udm/nnrf-build.c b/src/udm/nnrf-build.c new file mode 100644 index 000000000..155c95fc9 --- /dev/null +++ b/src/udm/nnrf-build.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnrf-build.h" + +ogs_sbi_request_t *udm_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); + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return request; +} diff --git a/src/udm/nnrf-build.h b/src/udm/nnrf-build.h new file mode 100644 index 000000000..95dedd152 --- /dev/null +++ b/src/udm/nnrf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef UDM_NNRF_BUILD_H +#define UDM_NNRF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *udm_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* UDM_NNRF_BUILD_H */ diff --git a/src/udm/nnrf-handler.c b/src/udm/nnrf-handler.c index 1d1a4dc72..62cf919f6 100644 --- a/src/udm/nnrf-handler.c +++ b/src/udm/nnrf-handler.c @@ -285,6 +285,8 @@ void udm_nnrf_handle_nf_discover( } if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { + udm_ue_t *udm_ue = NULL; + handled = ogs_sbi_nnrf_handle_nf_profile( nf_instance, NFProfile, NULL, NULL); if (!handled) { @@ -301,10 +303,9 @@ void udm_nnrf_handle_nf_discover( continue; } - if (!OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, nf_instance->nf_type)) - ogs_sbi_nf_instance_associate(sbi_object->nf_type_array, - nf_instance->nf_type, udm_nf_state_registered); + udm_ue = (udm_ue_t *)sbi_object; + ogs_assert(udm_ue); + udm_ue_select_nf(udm_ue, nf_instance->nf_type); /* TIME : Update validity from NRF */ if (SearchResult->validity_period) { @@ -324,8 +325,7 @@ void udm_nnrf_handle_nf_discover( } ogs_assert(xact->target_nf_type); - nf_instance = OGS_SBI_NF_INSTANCE_GET( - sbi_object->nf_type_array, xact->target_nf_type); + nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, xact->target_nf_type); if (!nf_instance) { ogs_error("(NF discover) No [%s]", OpenAPI_nf_type_ToString(xact->target_nf_type)); diff --git a/src/udm/nudr-build.c b/src/udm/nudr-build.c index d7a957431..2e3867ddb 100644 --- a/src/udm/nudr-build.c +++ b/src/udm/nudr-build.c @@ -173,8 +173,8 @@ ogs_sbi_request_t *udm_nudr_dr_build_query_subscription_provisioned( sendmsg.param.dnn = recvmsg->param.dnn; if (recvmsg->param.single_nssai_presence) { sendmsg.param.single_nssai_presence = true; - memcpy(&sendmsg.param.single_nssai, &recvmsg->param.single_nssai, - sizeof(sendmsg.param.single_nssai)); + memcpy(&sendmsg.param.s_nssai, &recvmsg->param.s_nssai, + sizeof(sendmsg.param.s_nssai)); } break; diff --git a/src/udm/sbi-path.c b/src/udm/sbi-path.c index 0b2b4f9af..68e355b85 100644 --- a/src/udm/sbi-path.c +++ b/src/udm/sbi-path.c @@ -122,6 +122,23 @@ void udm_sbi_close(void) ogs_sbi_server_stop_all(); } +void udm_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + request = udm_nnrf_nfm_build_register(nf_instance); + if (!request) { + ogs_error("udm_nnrf_nfm_send_nf_register() failed"); + return; + } + ogs_sbi_client_send_request(client, client->cb, request, nf_instance); +} + void udm_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact) { ogs_sbi_send(nf_instance, client_cb, xact); diff --git a/src/udm/sbi-path.h b/src/udm/sbi-path.h index 778a29521..371a16ad0 100644 --- a/src/udm/sbi-path.h +++ b/src/udm/sbi-path.h @@ -20,6 +20,7 @@ #ifndef UDM_SBI_PATH_H #define UDM_SBI_PATH_H +#include "nnrf-build.h" #include "nudr-build.h" #ifdef __cplusplus @@ -29,6 +30,8 @@ extern "C" { int udm_sbi_open(void); void udm_sbi_close(void); +void udm_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); + void udm_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact); void udm_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type, udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, void *data, diff --git a/src/udr/meson.build b/src/udr/meson.build index 19c7076a9..2a77ea4ae 100644 --- a/src/udr/meson.build +++ b/src/udr/meson.build @@ -20,6 +20,7 @@ libudr_sources = files(''' event.c timer.c + nnrf-build.c nnrf-handler.c nf-sm.c diff --git a/src/udr/nf-sm.c b/src/udr/nf-sm.c index ce011e11a..17712bc3a 100644 --- a/src/udr/nf-sm.c +++ b/src/udr/nf-sm.c @@ -109,7 +109,7 @@ void udr_nf_state_will_register(ogs_fsm_t *s, udr_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + udr_nnrf_nfm_send_nf_register(nf_instance); break; case OGS_FSM_EXIT_SIG: @@ -164,7 +164,7 @@ void udr_nf_state_will_register(ogs_fsm_t *s, udr_event_t *e) ogs_timer_start(nf_instance->t_registration_interval, ogs_app()->time.message.sbi.nf_register_interval); - ogs_nnrf_nfm_send_nf_register(nf_instance); + udr_nnrf_nfm_send_nf_register(nf_instance); break; default: diff --git a/src/udr/nnrf-build.c b/src/udr/nnrf-build.c new file mode 100644 index 000000000..080c07f63 --- /dev/null +++ b/src/udr/nnrf-build.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "nnrf-build.h" + +ogs_sbi_request_t *udr_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); + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return request; +} diff --git a/src/udr/nnrf-build.h b/src/udr/nnrf-build.h new file mode 100644 index 000000000..e8a053c47 --- /dev/null +++ b/src/udr/nnrf-build.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef UDR_NNRF_BUILD_H +#define UDR_NNRF_BUILD_H + +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *udr_nnrf_nfm_build_register( + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* UDR_NNRF_BUILD_H */ diff --git a/src/udr/nudr-handler.c b/src/udr/nudr-handler.c index 4c4ef1a51..1499e5d18 100644 --- a/src/udr/nudr-handler.c +++ b/src/udr/nudr-handler.c @@ -304,77 +304,68 @@ bool udr_nudr_dr_handle_subscription_context( return false; } -static OpenAPI_pdu_session_type_e pdu_session_type_from_dbi(uint8_t pdn_type) -{ - if (pdn_type == OGS_DIAM_PDN_TYPE_IPV4) - return OpenAPI_pdu_session_type_IPV4; - else if (pdn_type == OGS_DIAM_PDN_TYPE_IPV6) - return OpenAPI_pdu_session_type_IPV6; - else if (pdn_type == OGS_DIAM_PDN_TYPE_IPV4V6) - return OpenAPI_pdu_session_type_IPV4V6; - else { - ogs_fatal("Unsupported PDN_TYPE[%d]", pdn_type); - ogs_assert_if_reached(); - } -} - bool udr_nudr_dr_handle_subscription_provisioned( ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg) { - int rv, i; + int rv, status = 0; + char *strerror = NULL; ogs_sbi_message_t sendmsg; ogs_sbi_response_t *response = NULL; ogs_subscription_data_t subscription_data; + ogs_slice_data_t *slice_data = NULL; char *supi = NULL; ogs_assert(stream); ogs_assert(recvmsg); + memset(&subscription_data, 0, sizeof(ogs_subscription_data_t)); + supi = recvmsg->h.resource.component[1]; if (!supi) { - ogs_error("No SUPI"); - ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No SUPI", NULL); - return false; + strerror = ogs_msprintf("No SUPI"); + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + goto cleanup; } if (strncmp(supi, OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) { - ogs_error("[%s] Unknown SUPI Type", supi); - ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN, - recvmsg, "Unknwon SUPI Type", supi); - return false; + strerror = ogs_msprintf("[%s] Unknown SUPI Type", supi); + status = OGS_SBI_HTTP_STATUS_FORBIDDEN; + goto cleanup; } rv = ogs_dbi_subscription_data(supi, &subscription_data); if (rv != OGS_OK) { - ogs_error("[%s] Cannot find SUPI in DB", supi); - ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_NOT_FOUND, - recvmsg, "Cannot find SUPI Type", supi); - return false; + strerror = ogs_msprintf("[%s] Cannot find SUPI in DB", supi); + status = OGS_SBI_HTTP_STATUS_NOT_FOUND; + goto cleanup; } if (!subscription_data.ambr.uplink && !subscription_data.ambr.downlink) { - ogs_error("[%s] No UE-AMBR", supi); - ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_NOT_FOUND, - recvmsg, "No UE-AMBR", supi); - - return false; + strerror = ogs_msprintf("[%s] No UE-AMBR", supi); + status = OGS_SBI_HTTP_STATUS_NOT_FOUND; + goto cleanup; } SWITCH(recvmsg->h.resource.component[4]) CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) + int i; + OpenAPI_access_and_mobility_subscription_data_t AccessAndMobilitySubscriptionData; OpenAPI_list_t *GpsiList = NULL; OpenAPI_ambr_rm_t SubscribedUeAmbr; - OpenAPI_list_t *SubscribedDnnList = NULL; + + OpenAPI_nssai_t NSSAI; + OpenAPI_list_t *DefaultSingleNssaiList = NULL; + OpenAPI_list_t *SingleNssaiList = NULL; + OpenAPI_snssai_t *Snssai = NULL; + OpenAPI_lnode_t *node = NULL; GpsiList = OpenAPI_list_create(); - for (i = 0; i < subscription_data.num_of_msisdn; i++) { char *gpsi = ogs_msprintf("%s-%s", OGS_ID_GPSI_TYPE_MSISDN, subscription_data.msisdn[i].bcd); @@ -387,26 +378,69 @@ bool udr_nudr_dr_handle_subscription_provisioned( SubscribedUeAmbr.downlink = ogs_sbi_bitrate_to_string( subscription_data.ambr.downlink, OGS_SBI_BITRATE_KBPS); - SubscribedDnnList = OpenAPI_list_create(); - for (i = 0; i < subscription_data.num_of_pdn; i++) { - OpenAPI_list_add(SubscribedDnnList, subscription_data.pdn[i].dnn); + memset(&NSSAI, 0, sizeof(NSSAI)); + DefaultSingleNssaiList = OpenAPI_list_create(); + for (i = 0; i < subscription_data.num_of_slice; i++) { + slice_data = &subscription_data.slice[i]; + + if (slice_data->default_indicator == false) + continue; + + Snssai = ogs_calloc(1, sizeof(*Snssai)); + ogs_assert(Snssai); + + Snssai->sst = slice_data->s_nssai.sst; + Snssai->sd = ogs_s_nssai_sd_to_string(slice_data->s_nssai.sd); + + OpenAPI_list_add(DefaultSingleNssaiList, Snssai); + } + if (DefaultSingleNssaiList->count) { + NSSAI.default_single_nssais = DefaultSingleNssaiList; + } + + SingleNssaiList = OpenAPI_list_create(); + for (i = 0; i < subscription_data.num_of_slice; i++) { + slice_data = &subscription_data.slice[i]; + + if (slice_data->default_indicator == true) + continue; + + Snssai = ogs_calloc(1, sizeof(*Snssai)); + ogs_assert(Snssai); + + Snssai->sst = slice_data->s_nssai.sst; + Snssai->sd = ogs_s_nssai_sd_to_string(slice_data->s_nssai.sd); + + OpenAPI_list_add(SingleNssaiList, Snssai); + } + + if (DefaultSingleNssaiList->count) { + if (SingleNssaiList->count) { + NSSAI.single_nssais = SingleNssaiList; + } + } else { + if (SingleNssaiList->count) { + ogs_fatal("No Default S-NSSAI"); + ogs_assert_if_reached(); + } } memset(&AccessAndMobilitySubscriptionData, 0, sizeof(AccessAndMobilitySubscriptionData)); + + if (GpsiList->count) + AccessAndMobilitySubscriptionData.gpsis = GpsiList; + AccessAndMobilitySubscriptionData.subscribed_ue_ambr = &SubscribedUeAmbr; + if (DefaultSingleNssaiList->count) + AccessAndMobilitySubscriptionData.nssai = &NSSAI; + memset(&sendmsg, 0, sizeof(sendmsg)); sendmsg.AccessAndMobilitySubscriptionData = &AccessAndMobilitySubscriptionData; - if (GpsiList->count) - AccessAndMobilitySubscriptionData.gpsis = GpsiList; - if (SubscribedDnnList->count) - AccessAndMobilitySubscriptionData.subscribed_dnn_list = - SubscribedDnnList; - response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK); ogs_assert(response); ogs_sbi_server_send_response(stream, response); @@ -419,16 +453,91 @@ bool udr_nudr_dr_handle_subscription_provisioned( ogs_free(SubscribedUeAmbr.uplink); ogs_free(SubscribedUeAmbr.downlink); - OpenAPI_list_free(SubscribedDnnList); - + OpenAPI_list_for_each(DefaultSingleNssaiList, node) { + OpenAPI_snssai_t *Snssai = node->data; + if (Snssai) { + if (Snssai->sd) + ogs_free(Snssai->sd); + ogs_free(Snssai); + } + } + OpenAPI_list_free(DefaultSingleNssaiList); + OpenAPI_list_for_each(SingleNssaiList, node) { + OpenAPI_snssai_t *Snssai = node->data; + if (Snssai) { + if (Snssai->sd) + ogs_free(Snssai->sd); + ogs_free(Snssai); + } + } + OpenAPI_list_free(SingleNssaiList); break; CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECTION_SUBSCRIPTION_DATA) + int i, j; + OpenAPI_smf_selection_subscription_data_t SmfSelectionSubscriptionData; + OpenAPI_list_t *SubscribedSnssaiInfoList = NULL; + OpenAPI_map_t *SubscribedSnssaiInfoMap = NULL; + OpenAPI_snssai_info_t *SubscribedSnssaiInfo = NULL; + + OpenAPI_list_t *DnnInfoList = NULL; + OpenAPI_dnn_info_t *DnnInfo = NULL; + + OpenAPI_lnode_t *node = NULL, *node2 = NULL; + memset(&SmfSelectionSubscriptionData, 0, sizeof(SmfSelectionSubscriptionData)); + SubscribedSnssaiInfoList = OpenAPI_list_create(); + ogs_assert(SubscribedSnssaiInfoList); + + for (i = 0; i < subscription_data.num_of_slice; i++) { + slice_data = &subscription_data.slice[i]; + + DnnInfoList = OpenAPI_list_create(); + ogs_assert(DnnInfoList); + + for (j = 0; j < slice_data->num_of_session; j++) { + ogs_session_t *session = &slice_data->session[j]; + ogs_assert(session); + ogs_assert(session->name); + + DnnInfo = ogs_calloc(1, sizeof(*DnnInfo)); + ogs_assert(DnnInfo); + + DnnInfo->dnn = session->name; + + /* 0-index DNN becomes the default DNN */ + if (j == 0) + DnnInfo->default_dnn_indicator = 1; + + OpenAPI_list_add(DnnInfoList, DnnInfo); + } + + SubscribedSnssaiInfo = ogs_calloc(1, sizeof(*SubscribedSnssaiInfo)); + ogs_assert(SubscribedSnssaiInfo); + + if (DnnInfoList->count) + SubscribedSnssaiInfo->dnn_infos = DnnInfoList; + else + OpenAPI_list_free(DnnInfoList); + + SubscribedSnssaiInfoMap = OpenAPI_map_create( + ogs_sbi_s_nssai_to_string(&slice_data->s_nssai), + SubscribedSnssaiInfo); + ogs_assert(SubscribedSnssaiInfoMap); + + OpenAPI_list_add(SubscribedSnssaiInfoList, SubscribedSnssaiInfoMap); + } + + if (SubscribedSnssaiInfoList->count) + SmfSelectionSubscriptionData.subscribed_snssai_infos = + SubscribedSnssaiInfoList; + else + OpenAPI_list_free(SubscribedSnssaiInfoList); + memset(&sendmsg, 0, sizeof(sendmsg)); sendmsg.SmfSelectionSubscriptionData = &SmfSelectionSubscriptionData; @@ -436,9 +545,36 @@ bool udr_nudr_dr_handle_subscription_provisioned( ogs_assert(response); ogs_sbi_server_send_response(stream, response); + SubscribedSnssaiInfoList = + SmfSelectionSubscriptionData.subscribed_snssai_infos; + OpenAPI_list_for_each(SubscribedSnssaiInfoList, node) { + SubscribedSnssaiInfoMap = node->data; + if (SubscribedSnssaiInfoMap) { + SubscribedSnssaiInfo = SubscribedSnssaiInfoMap->value; + if (SubscribedSnssaiInfo) { + DnnInfoList = SubscribedSnssaiInfo->dnn_infos; + if (DnnInfoList) { + OpenAPI_list_for_each(DnnInfoList, node2) { + DnnInfo = node2->data; + if (DnnInfo) { + ogs_free(DnnInfo); + } + } + OpenAPI_list_free(DnnInfoList); + } + ogs_free(SubscribedSnssaiInfo); + } + if (SubscribedSnssaiInfoMap->key) + ogs_free(SubscribedSnssaiInfoMap->key); + ogs_free(SubscribedSnssaiInfoMap); + } + } + OpenAPI_list_free(SubscribedSnssaiInfoList); break; CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) + int i; + OpenAPI_session_management_subscription_data_t SessionManagementSubscriptionData; OpenAPI_snssai_t singleNSSAI; @@ -454,36 +590,48 @@ bool udr_nudr_dr_handle_subscription_provisioned( OpenAPI_lnode_t *node = NULL, *node2 = NULL; if (!recvmsg->param.single_nssai_presence) { - ogs_error("[%s] Cannot find S_NSSAI", supi); - ogs_sbi_server_send_error(stream, - OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "Cannot find S_NSSAI", supi); - return false; + strerror = ogs_msprintf("[%s] No S_NSSAI", supi); + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + goto cleanup; + }; + + slice_data = ogs_slice_find_by_s_nssai( + subscription_data.slice, subscription_data.num_of_slice, + &recvmsg->param.s_nssai); + + if (!slice_data) { + strerror = ogs_msprintf("[%s] Cannot find S_NSSAI[SST:%d SD:0x%x]", + supi, + recvmsg->param.s_nssai.sst, + recvmsg->param.s_nssai.sd.v); + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + goto cleanup; } - singleNSSAI.sst = recvmsg->param.single_nssai.sst; - singleNSSAI.sd = ogs_s_nssai_sd_to_string( - recvmsg->param.single_nssai.sd); + singleNSSAI.sst = slice_data->s_nssai.sst; + singleNSSAI.sd = ogs_s_nssai_sd_to_string(slice_data->s_nssai.sd); dnnConfigurationList = OpenAPI_list_create(); - for (i = 0; i < subscription_data.num_of_pdn; i++) { - ogs_pdn_t *pdn = &subscription_data.pdn[i]; - ogs_assert(pdn); + for (i = 0; i < slice_data->num_of_session; i++) { + ogs_session_t *session = &slice_data->session[i]; + ogs_assert(session); + ogs_assert(session->name); if (recvmsg->param.dnn && - ogs_strcasecmp(recvmsg->param.dnn, pdn->apn) != 0) continue; + ogs_strcasecmp(recvmsg->param.dnn, session->name) != 0) + continue; - if (!pdn->qos.qci) { - ogs_error("No QCI"); + if (!session->qos.index) { + ogs_error("No 5QI"); continue; } - if (!pdn->qos.arp.priority_level) { + if (!session->qos.arp.priority_level) { ogs_error("No Priority Level"); continue; } - if (!pdn->ambr.uplink && !pdn->ambr.downlink) { + if (!session->ambr.uplink && !session->ambr.downlink) { ogs_error("No Session-AMBR"); continue; } @@ -493,8 +641,7 @@ bool udr_nudr_dr_handle_subscription_provisioned( pduSessionTypeList = ogs_calloc(1, sizeof(*pduSessionTypeList)); ogs_assert(pduSessionTypeList); - pduSessionTypeList->default_session_type = - pdu_session_type_from_dbi(pdn->pdn_type); + pduSessionTypeList->default_session_type = session->session_type; pduSessionTypeList->allowed_session_types = OpenAPI_list_create(); ogs_assert(pduSessionTypeList->allowed_session_types); @@ -540,49 +687,57 @@ bool udr_nudr_dr_handle_subscription_provisioned( _5gQoSProfile = ogs_calloc(1, sizeof(*_5gQoSProfile)); ogs_assert(_5gQoSProfile); - _5gQoSProfile->_5qi = pdn->qos.qci; - _5gQoSProfile->priority_level = pdn->qos.arp.priority_level; + _5gQoSProfile->_5qi = session->qos.index; + _5gQoSProfile->priority_level = session->qos.arp.priority_level; _5gQoSProfile->arp = ogs_calloc(1, sizeof(OpenAPI_arp_t)); ogs_assert(_5gQoSProfile->arp); - _5gQoSProfile->arp->priority_level = pdn->qos.arp.priority_level; - if (pdn->qos.arp.pre_emption_capability == - OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED) - _5gQoSProfile->arp->preempt_cap = - OpenAPI_preemption_capability_NOT_PREEMPT; - else + _5gQoSProfile->arp->priority_level = + session->qos.arp.priority_level; + if (session->qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_ENABLED) _5gQoSProfile->arp->preempt_cap = OpenAPI_preemption_capability_MAY_PREEMPT; - if (pdn->qos.arp.pre_emption_vulnerability == - OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED) - _5gQoSProfile->arp->preempt_vuln = - OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE; - else + else if (session->qos.arp.pre_emption_capability == + OGS_5GC_PRE_EMPTION_DISABLED) + _5gQoSProfile->arp->preempt_cap = + OpenAPI_preemption_capability_NOT_PREEMPT; + ogs_assert(_5gQoSProfile->arp->preempt_cap); + + if (session->qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_ENABLED) _5gQoSProfile->arp->preempt_vuln = OpenAPI_preemption_vulnerability_PREEMPTABLE; + else if (session->qos.arp.pre_emption_vulnerability == + OGS_5GC_PRE_EMPTION_DISABLED) + _5gQoSProfile->arp->preempt_vuln = + OpenAPI_preemption_vulnerability_NOT_PREEMPTABLE; + ogs_assert(_5gQoSProfile->arp->preempt_vuln); dnnConfiguration->_5g_qos_profile = _5gQoSProfile; - ogs_assert(pdn->ambr.uplink || pdn->ambr.downlink); + ogs_assert(session->ambr.uplink || session->ambr.downlink); sessionAmbr = ogs_calloc(1, sizeof(*sessionAmbr)); ogs_assert(sessionAmbr); sessionAmbr->uplink = ogs_sbi_bitrate_to_string( - pdn->ambr.uplink, OGS_SBI_BITRATE_KBPS); + session->ambr.uplink, OGS_SBI_BITRATE_KBPS); sessionAmbr->downlink = ogs_sbi_bitrate_to_string( - pdn->ambr.downlink, OGS_SBI_BITRATE_KBPS); + session->ambr.downlink, OGS_SBI_BITRATE_KBPS); dnnConfiguration->session_ambr = sessionAmbr; staticIpAddress = OpenAPI_list_create(); ogs_assert(staticIpAddress); - if (pdn->ue_ip.ipv4 || pdn->ue_ip.ipv6) { + if (session->ue_ip.ipv4 || session->ue_ip.ipv6) { ipAddress = ogs_calloc(1, sizeof(*ipAddress)); ogs_assert(ipAddress); - if (pdn->ue_ip.ipv4) - ipAddress->ipv4_addr = ogs_ipv4_to_string(pdn->ue_ip.addr); - if (pdn->ue_ip.ipv6) - ipAddress->ipv6_addr = ogs_ipv6_to_string(pdn->ue_ip.addr6); + if (session->ue_ip.ipv4) + ipAddress->ipv4_addr = + ogs_ipv4_to_string(session->ue_ip.addr); + if (session->ue_ip.ipv6) + ipAddress->ipv6_addr = + ogs_ipv6_to_string(session->ue_ip.addr6); if (ipAddress->ipv4_addr || ipAddress->ipv6_addr) OpenAPI_list_add(staticIpAddress, ipAddress); @@ -596,7 +751,7 @@ bool udr_nudr_dr_handle_subscription_provisioned( OpenAPI_list_free(staticIpAddress); dnnConfigurationMap = OpenAPI_map_create( - pdn->apn, dnnConfiguration); + session->name, dnnConfiguration); ogs_assert(dnnConfigurationMap); OpenAPI_list_add(dnnConfigurationList, dnnConfigurationMap); } @@ -677,50 +832,64 @@ bool udr_nudr_dr_handle_subscription_provisioned( } OpenAPI_list_free(dnnConfigurationList); + break; DEFAULT - ogs_error("Invalid resource name [%s]", + strerror = ogs_msprintf("Invalid resource name [%s]", recvmsg->h.resource.component[3]); - ogs_sbi_server_send_error(stream, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, - recvmsg, "Unknown resource name", - recvmsg->h.resource.component[3]); - return false; + status = OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED; + goto cleanup; END + ogs_subscription_data_free(&subscription_data); + return true; + +cleanup: + ogs_assert(strerror); + ogs_assert(status); + ogs_error("%s", strerror); + ogs_sbi_server_send_error(stream, status, recvmsg, strerror, NULL); + ogs_free(strerror); + + ogs_subscription_data_free(&subscription_data); + + return false; } bool udr_nudr_dr_handle_policy_data( ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg) { - int rv, i; + int rv, i, status = 0; + char *strerror = NULL; ogs_sbi_message_t sendmsg; ogs_sbi_response_t *response = NULL; + ogs_subscription_data_t subscription_data; + ogs_slice_data_t *slice_data = NULL; + ogs_assert(stream); ogs_assert(recvmsg); + memset(&subscription_data, 0, sizeof(ogs_subscription_data_t)); + SWITCH(recvmsg->h.resource.component[1]) CASE(OGS_SBI_RESOURCE_NAME_UES) - ogs_subscription_data_t subscription_data; char *supi = recvmsg->h.resource.component[2]; if (!supi) { - ogs_error("No SUPI"); - ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "No SUPI", NULL); - return false; + strerror = ogs_msprintf("No SUPI"); + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + goto cleanup; } if (strncmp(supi, OGS_ID_SUPI_TYPE_IMSI, strlen(OGS_ID_SUPI_TYPE_IMSI)) != 0) { - ogs_error("[%s] Unknown SUPI Type", supi); - ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_FORBIDDEN, - recvmsg, "Unknwon SUPI Type", supi); - return false; + strerror = ogs_msprintf("[%s] Unknown SUPI Type", supi); + status = OGS_SBI_HTTP_STATUS_FORBIDDEN; + goto cleanup; } SWITCH(recvmsg->h.method) @@ -729,10 +898,9 @@ bool udr_nudr_dr_handle_policy_data( rv = ogs_dbi_subscription_data(supi, &subscription_data); if (rv != OGS_OK) { - ogs_error("[%s] Cannot find SUPI in DB", supi); - ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_NOT_FOUND, - recvmsg, "Cannot find SUPI Type", supi); - return false; + strerror = ogs_msprintf("[%s] Cannot find SUPI in DB", supi); + status = OGS_SBI_HTTP_STATUS_NOT_FOUND; + goto cleanup; } SWITCH(recvmsg->h.resource.component[3]) @@ -749,7 +917,7 @@ bool udr_nudr_dr_handle_policy_data( ogs_assert(response); ogs_sbi_server_send_response(stream, response); - return true; + break; CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) OpenAPI_sm_policy_data_t SmPolicyData; @@ -765,36 +933,51 @@ bool udr_nudr_dr_handle_policy_data( OpenAPI_sm_policy_dnn_data_t *SmPolicyDnnData = NULL; if (!recvmsg->param.snssai_presence) { - ogs_error("[%s] Cannot find S_NSSAI", supi); - ogs_sbi_server_send_error(stream, - OGS_SBI_HTTP_STATUS_BAD_REQUEST, - recvmsg, "Cannot find S_NSSAI", supi); - return false; + strerror = ogs_msprintf("[%s] No S_NSSAI", supi); + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + goto cleanup; + } + + slice_data = ogs_slice_find_by_s_nssai( + subscription_data.slice, subscription_data.num_of_slice, + &recvmsg->param.s_nssai); + + if (!slice_data) { + strerror = ogs_msprintf( + "[%s] Cannot find S_NSSAI[SST:%d SD:0x%x]", + supi, + recvmsg->param.s_nssai.sst, + recvmsg->param.s_nssai.sd.v); + status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; + goto cleanup; } sNSSAI = ogs_calloc(1, sizeof(*sNSSAI)); ogs_assert(sNSSAI); - sNSSAI->sst = recvmsg->param.snssai.sst; - sNSSAI->sd = ogs_s_nssai_sd_to_string(recvmsg->param.snssai.sd); + sNSSAI->sst = slice_data->s_nssai.sst; + sNSSAI->sd = ogs_s_nssai_sd_to_string(slice_data->s_nssai.sd); SmPolicyDnnDataList = OpenAPI_list_create(); ogs_assert(SmPolicyDnnDataList); - for (i = 0; i < subscription_data.num_of_pdn; i++) { - ogs_pdn_t *pdn = &subscription_data.pdn[i]; - ogs_assert(pdn); + slice_data = &subscription_data.slice[0]; + + for (i = 0; i < slice_data->num_of_session; i++) { + ogs_session_t *session = &slice_data->session[i]; + ogs_assert(session); + ogs_assert(session->name); if (recvmsg->param.dnn && - ogs_strcasecmp(recvmsg->param.dnn, pdn->apn) != 0) + ogs_strcasecmp(recvmsg->param.dnn, session->name) != 0) continue; SmPolicyDnnData = ogs_calloc(1, sizeof(*SmPolicyDnnData)); ogs_assert(SmPolicyDnnData); - SmPolicyDnnData->dnn = pdn->apn; + SmPolicyDnnData->dnn = session->name; SmPolicyDnnDataMap = OpenAPI_map_create( - pdn->apn, SmPolicyDnnData); + session->name, SmPolicyDnnData); ogs_assert(SmPolicyDnnDataMap); OpenAPI_list_add(SmPolicyDnnDataList, SmPolicyDnnDataMap); @@ -811,7 +994,7 @@ bool udr_nudr_dr_handle_policy_data( OpenAPI_list_free(SmPolicyDnnDataList); SmPolicySnssaiDataMap = OpenAPI_map_create( - ogs_sbi_s_nssai_to_string(&recvmsg->param.snssai), + ogs_sbi_s_nssai_to_string(&recvmsg->param.s_nssai), SmPolicySnssaiData); ogs_assert(SmPolicySnssaiDataMap); @@ -872,34 +1055,45 @@ bool udr_nudr_dr_handle_policy_data( } OpenAPI_list_free(SmPolicySnssaiDataList); - return true; + break; DEFAULT - ogs_error("Invalid resource name [%s]", - recvmsg->h.resource.component[3]); - ogs_sbi_server_send_error(stream, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, - recvmsg, "Unknown resource name", + strerror = ogs_msprintf("Invalid resource name [%s]", recvmsg->h.resource.component[3]); + status = OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED; + goto cleanup; END + break; DEFAULT - ogs_error("Invalid HTTP method [%s]", recvmsg->h.method); - ogs_sbi_server_send_error(stream, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, - recvmsg, "Invalid HTTP method", recvmsg->h.method); + strerror = ogs_msprintf("Invalid HTTP method [%s]", + recvmsg->h.method); + status = OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED; + goto cleanup; END + break; DEFAULT - ogs_error("Invalid resource name [%s]", - recvmsg->h.resource.component[1]); - ogs_sbi_server_send_error(stream, - OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, - recvmsg, "Unknown resource name", + strerror = ogs_msprintf("Invalid resource name [%s]", recvmsg->h.resource.component[1]); + status = OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED; + goto cleanup; END + ogs_subscription_data_free(&subscription_data); + + return true; + +cleanup: + ogs_assert(strerror); + ogs_assert(status); + ogs_error("%s", strerror); + ogs_sbi_server_send_error(stream, status, recvmsg, strerror, NULL); + ogs_free(strerror); + + ogs_subscription_data_free(&subscription_data); + return false; } diff --git a/src/udr/sbi-path.c b/src/udr/sbi-path.c index 69358b1b6..0b36173a9 100644 --- a/src/udr/sbi-path.c +++ b/src/udr/sbi-path.c @@ -111,3 +111,20 @@ void udr_sbi_close(void) { ogs_sbi_server_stop_all(); } + +void udr_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + request = udr_nnrf_nfm_build_register(nf_instance); + if (!request) { + ogs_error("udr_nnrf_nfm_send_nf_register() failed"); + return; + } + ogs_sbi_client_send_request(client, client->cb, request, nf_instance); +} diff --git a/src/udr/sbi-path.h b/src/udr/sbi-path.h index 75ac470e0..79c3c2101 100644 --- a/src/udr/sbi-path.h +++ b/src/udr/sbi-path.h @@ -20,7 +20,7 @@ #ifndef UDR_SBI_PATH_H #define UDR_SBI_PATH_H -#include "context.h" +#include "nnrf-build.h" #ifdef __cplusplus extern "C" { @@ -29,6 +29,8 @@ extern "C" { int udr_sbi_open(void); void udr_sbi_close(void); +void udr_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); + #ifdef __cplusplus } #endif diff --git a/src/upf/context.c b/src/upf/context.c index 00ba6b56a..b9e69ab0c 100644 --- a/src/upf/context.c +++ b/src/upf/context.c @@ -98,7 +98,7 @@ static int upf_context_validation(void) return OGS_ERROR; } if (ogs_list_first(&ogs_pfcp_self()->subnet_list) == NULL) { - ogs_error("No upf.pdn: in '%s'", ogs_app()->file); + ogs_error("No upf.subnet: in '%s'", ogs_app()->file); return OGS_ERROR; } return OGS_OK; @@ -205,7 +205,7 @@ int upf_context_parse_config(void) 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 ( @@ -228,7 +228,7 @@ int upf_context_parse_config(void) break; } - ogs_assert(adv_num <= + ogs_assert(adv_num < OGS_MAX_NUM_OF_HOSTNAME); adv_hostname[adv_num++] = ogs_yaml_iter_value(&adv_hostname_iter); @@ -407,9 +407,12 @@ int upf_context_parse_config(void) ogs_list_for_each_safe(&list6, next_iter, iter) ogs_list_add(&self.gtpu_list, iter); } - } else if (!strcmp(upf_key, "pdn")) { + } else if (!strcmp(upf_key, "pfcp")) { /* handle config in pfcp library */ - } + } else if (!strcmp(upf_key, "subnet")) { + /* handle config in pfcp library */ + } else + ogs_warn("unknown key `%s`", upf_key); } } } @@ -541,22 +544,21 @@ upf_sess_t *upf_sess_add_by_message(ogs_pfcp_message_t *message) } void upf_sess_set_ue_ip(upf_sess_t *sess, - uint8_t pdn_type, ogs_pfcp_pdr_t *pdr) + uint8_t session_type, ogs_pfcp_pdr_t *pdr) { ogs_pfcp_ue_ip_addr_t *ue_ip = NULL; char buf1[OGS_ADDRSTRLEN]; char buf2[OGS_ADDRSTRLEN]; ogs_assert(sess); - ogs_assert(pdn_type); + ogs_assert(session_type); ogs_assert(pdr); ogs_assert(pdr->ue_ip_addr_len); ue_ip = &pdr->ue_ip_addr; ogs_assert(ue_ip); /* Set PDN-Type and UE IP Address */ - sess->pdn.pdn_type = pdn_type; - if (pdn_type == OGS_GTP_PDN_TYPE_IPV4) { + if (session_type == OGS_PDU_SESSION_TYPE_IPV4) { if (ue_ip->ipv4 || pdr->dnn) { sess->ipv4 = ogs_pfcp_ue_ip_alloc( AF_INET, pdr->dnn, (uint8_t *)&(ue_ip->addr)); @@ -564,18 +566,20 @@ void upf_sess_set_ue_ip(upf_sess_t *sess, ogs_hash_set(self.ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, sess); } else { ogs_warn("Cannot support PDN-Type[%d], [IPv4:%d IPv6:%d DNN:%s]", - pdn_type, ue_ip->ipv4, ue_ip->ipv6, pdr->dnn ? pdr->dnn : ""); + session_type, ue_ip->ipv4, ue_ip->ipv6, + pdr->dnn ? pdr->dnn : ""); } - } else if (pdn_type == OGS_GTP_PDN_TYPE_IPV6) { + } else if (session_type == OGS_PDU_SESSION_TYPE_IPV6) { if (ue_ip->ipv6 || pdr->dnn) { sess->ipv6 = ogs_pfcp_ue_ip_alloc(AF_INET6, pdr->dnn, ue_ip->addr6); ogs_assert(sess->ipv6); ogs_hash_set(self.ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, sess); } else { ogs_warn("Cannot support PDN-Type[%d], [IPv4:%d IPv6:%d DNN:%s]", - pdn_type, ue_ip->ipv4, ue_ip->ipv6, pdr->dnn ? pdr->dnn : ""); + session_type, ue_ip->ipv4, ue_ip->ipv6, + pdr->dnn ? pdr->dnn : ""); } - } else if (pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) { + } else if (session_type == OGS_PDU_SESSION_TYPE_IPV4V6) { if (ue_ip->ipv4 || pdr->dnn) { sess->ipv4 = ogs_pfcp_ue_ip_alloc( AF_INET, pdr->dnn, (uint8_t *)&(ue_ip->both.addr)); @@ -583,7 +587,8 @@ void upf_sess_set_ue_ip(upf_sess_t *sess, ogs_hash_set(self.ipv4_hash, sess->ipv4->addr, OGS_IPV4_LEN, sess); } else { ogs_warn("Cannot support PDN-Type[%d], [IPv4:%d IPv6:%d DNN:%s]", - pdn_type, ue_ip->ipv4, ue_ip->ipv6, pdr->dnn ? pdr->dnn : ""); + session_type, ue_ip->ipv4, ue_ip->ipv6, + pdr->dnn ? pdr->dnn : ""); } if (ue_ip->ipv6 || pdr->dnn) { @@ -593,17 +598,19 @@ void upf_sess_set_ue_ip(upf_sess_t *sess, ogs_hash_set(self.ipv6_hash, sess->ipv6->addr, OGS_IPV6_LEN, sess); } else { ogs_warn("Cannot support PDN-Type[%d], [IPv4:%d IPv6:%d DNN:%s]", - pdn_type, ue_ip->ipv4, ue_ip->ipv6, pdr->dnn ? pdr->dnn : ""); + session_type, ue_ip->ipv4, ue_ip->ipv6, + pdr->dnn ? pdr->dnn : ""); } } else { ogs_warn("Cannot support PDN-Type[%d], [IPv4:%d IPv6:%d DNN:%s]", - pdn_type, ue_ip->ipv4, ue_ip->ipv6, pdr->dnn ? pdr->dnn : ""); + session_type, ue_ip->ipv4, ue_ip->ipv6, + pdr->dnn ? pdr->dnn : ""); } ogs_info("UE F-SEID[CP:0x%lx UP:0x%lx] " "APN[%s] PDN-Type[%d] IPv4[%s] IPv6[%s]", (long)sess->upf_n4_seid, (long)sess->smf_n4_seid, - pdr->dnn, pdn_type, + pdr->dnn, session_type, sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); } diff --git a/src/upf/context.h b/src/upf/context.h index 2194c61e1..a0f60df68 100644 --- a/src/upf/context.h +++ b/src/upf/context.h @@ -72,7 +72,6 @@ typedef struct upf_sess_s { uint64_t smf_n4_seid; /* SMF SEID is received from Peer */ /* APN Configuration */ - ogs_pdn_t pdn; ogs_pfcp_ue_ip_t *ipv4; ogs_pfcp_ue_ip_t *ipv6; @@ -98,7 +97,7 @@ upf_sess_t *upf_sess_find_by_ipv4(uint32_t addr); upf_sess_t *upf_sess_find_by_ipv6(uint32_t *addr6); void upf_sess_set_ue_ip(upf_sess_t *sess, - uint8_t pdn_type, ogs_pfcp_pdr_t *pdr); + uint8_t session_type, ogs_pfcp_pdr_t *pdr); #ifdef __cplusplus } diff --git a/tests/310014/epc-test.c b/tests/310014/epc-test.c index 3a89b36c4..d12f420b1 100644 --- a/tests/310014/epc-test.c +++ b/tests/310014/epc-test.c @@ -35,61 +35,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "4d060eab0a7743bc8eede608a94b63de"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "7c0f7d5a427048a86fb429cc003c117c"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"310014987654004\", " -#if 0 - "\"msisdn\" : [\"821012345678\", \"82107654321\" ], " - "\"msisdn\" : [\"82107654321\", \"821012345678\" ], " -#endif - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," -#if 0 - "\"ue\" : { \"addr\" : \"10.45.0.2\", \"addr6\" : \"cafe::2\" }," -#endif - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"4d060eab0a7743bc8eede608a94b63de\", " - "\"opc\" : \"7c0f7d5a427048a86fb429cc003c117c\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -115,8 +61,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_EPS_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "INTERNET"); ogs_assert(sess); @@ -142,37 +88,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ sess->pdn_connectivity_param.eit = 1; @@ -280,13 +198,7 @@ static void test1_func(abts_case *tc, void *data) ogs_pkbuf_free(recvbuf); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/app/5gc-init.c b/tests/app/5gc-init.c index 3c31e16ca..57ff013f3 100644 --- a/tests/app/5gc-init.c +++ b/tests/app/5gc-init.c @@ -26,6 +26,7 @@ static ogs_thread_t *amf_thread = NULL; static ogs_thread_t *ausf_thread = NULL; static ogs_thread_t *udm_thread = NULL; static ogs_thread_t *pcf_thread = NULL; +static ogs_thread_t *nssf_thread = NULL; static ogs_thread_t *udr_thread = NULL; int app_initialize(const char *const argv[]) @@ -65,6 +66,8 @@ int app_initialize(const char *const argv[]) udm_thread = test_child_create("udm", argv_out); if (ogs_app()->parameter.no_pcf == 0) pcf_thread = test_child_create("pcf", argv_out); + if (ogs_app()->parameter.no_nssf == 0) + nssf_thread = test_child_create("nssf", argv_out); if (ogs_app()->parameter.no_udr == 0) udr_thread = test_child_create("udr", argv_out); @@ -73,7 +76,7 @@ int app_initialize(const char *const argv[]) * * If freeDiameter is not used, it uses a delay of less than 4 seconds. */ - ogs_msleep(5000); + ogs_msleep(500); return OGS_OK;; } @@ -86,6 +89,7 @@ void app_terminate(void) if (upf_thread) ogs_thread_destroy(upf_thread); if (udr_thread) ogs_thread_destroy(udr_thread); + if (nssf_thread) ogs_thread_destroy(nssf_thread); if (pcf_thread) ogs_thread_destroy(pcf_thread); if (udm_thread) ogs_thread_destroy(udm_thread); if (ausf_thread) ogs_thread_destroy(ausf_thread); diff --git a/tests/app/app-init.c b/tests/app/app-init.c index 2172af1fb..6bce4b69c 100644 --- a/tests/app/app-init.c +++ b/tests/app/app-init.c @@ -31,6 +31,7 @@ static ogs_thread_t *amf_thread = NULL; static ogs_thread_t *ausf_thread = NULL; static ogs_thread_t *udm_thread = NULL; static ogs_thread_t *pcf_thread = NULL; +static ogs_thread_t *nssf_thread = NULL; static ogs_thread_t *udr_thread = NULL; int app_initialize(const char *const argv[]) @@ -81,6 +82,8 @@ int app_initialize(const char *const argv[]) udm_thread = test_child_create("udm", argv_out); if (ogs_app()->parameter.no_pcf == 0) pcf_thread = test_child_create("pcf", argv_out); + if (ogs_app()->parameter.no_nssf == 0) + nssf_thread = test_child_create("nssf", argv_out); if (ogs_app()->parameter.no_udr == 0) udr_thread = test_child_create("udr", argv_out); @@ -106,6 +109,7 @@ void app_terminate(void) if (upf_thread) ogs_thread_destroy(upf_thread); if (udr_thread) ogs_thread_destroy(udr_thread); + if (nssf_thread) ogs_thread_destroy(nssf_thread); if (pcf_thread) ogs_thread_destroy(pcf_thread); if (udm_thread) ogs_thread_destroy(udm_thread); if (ausf_thread) ogs_thread_destroy(ausf_thread); diff --git a/tests/attach/auth-test.c b/tests/attach/auth-test.c index dcbd56955..e01dfbb0c 100644 --- a/tests/attach/auth-test.c +++ b/tests/attach/auth-test.c @@ -38,54 +38,7 @@ static void test1_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -111,8 +64,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -138,37 +91,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -482,13 +407,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/attach/emm-status-test.c b/tests/attach/emm-status-test.c index 3ec0636b4..f2eb44168 100644 --- a/tests/attach/emm-status-test.c +++ b/tests/attach/emm-status-test.c @@ -35,54 +35,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -108,8 +61,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -135,37 +88,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ sess->pdn_connectivity_param.pco = 1; @@ -245,13 +170,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/attach/guti-test.c b/tests/attach/guti-test.c index b7f055fda..940e8264a 100644 --- a/tests/attach/guti-test.c +++ b/tests/attach/guti-test.c @@ -38,54 +38,7 @@ static void test1_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -111,8 +64,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -138,37 +91,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -507,13 +432,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/attach/idle-test.c b/tests/attach/idle-test.c index 7e648d926..934d4f5ec 100644 --- a/tests/attach/idle-test.c +++ b/tests/attach/idle-test.c @@ -38,54 +38,7 @@ static void test1_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -111,8 +64,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_EPS_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -138,37 +91,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -416,13 +341,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -452,54 +371,7 @@ static void test2_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -525,8 +397,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_EPS_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -552,37 +424,9 @@ static void test2_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -785,13 +629,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -821,54 +659,7 @@ static void test3_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -894,8 +685,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_EPS_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -921,37 +712,9 @@ static void test3_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1230,13 +993,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/attach/reset-test.c b/tests/attach/reset-test.c index 7a1d2442c..87cb820a0 100644 --- a/tests/attach/reset-test.c +++ b/tests/attach/reset-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Service Request */ emmbuf = testemm_build_service_request(test_ue); @@ -337,13 +262,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -354,9 +273,10 @@ static void test1_func(abts_case *tc, void *data) test_ue_remove(test_ue); } +#define NUM_OF_TEST_UE 3 + static void test2_func(abts_case *tc, void *data) { -#define NUM_OF_TEST_UE 3 int rv, i; ogs_socknode_t *s1ap; ogs_socknode_t *gtpu; @@ -371,136 +291,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json[NUM_OF_TEST_UE] = { - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}", - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"imsi\" : \"901707364000061\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c8\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}", - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c8\" }, " - "\"imsi\" : \"901707364000062\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c9\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}", - }; - - /* Get DB collection */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); /* eNB connects to MME */ s1ap = tests1ap_client(AF_INET); @@ -523,6 +314,8 @@ static void test2_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); for (i = 0; i < NUM_OF_TEST_UE; i++) { + uint64_t imsi_index; + /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -534,19 +327,9 @@ static void test2_func(abts_case *tc, void *data) mobile_identity_suci.routing_indicator4 = 0xf; mobile_identity_suci.protection_scheme_id = OGS_NAS_5GS_NULL_SCHEME; mobile_identity_suci.home_network_pki_value = 0; - mobile_identity_suci.scheme_output[0] = 0x37; - mobile_identity_suci.scheme_output[1] = 0x46; - mobile_identity_suci.scheme_output[2] = 0; - mobile_identity_suci.scheme_output[3] = 0; - /* Multiple IMSI */ - if (i == 0) - mobile_identity_suci.scheme_output[4] = 0x06; - else if (i == 1) - mobile_identity_suci.scheme_output[4] = 0x16; - else if (i == 2) - mobile_identity_suci.scheme_output[4] = 0x26; - else - ogs_assert_if_reached(); + + imsi_index = i + 1; + ogs_uint64_to_buffer(imsi_index, 5, mobile_identity_suci.scheme_output); test_ue[i] = test_ue_add_by_suci(&mobile_identity_suci, 13); ogs_assert(test_ue[i]); @@ -558,37 +341,16 @@ static void test2_func(abts_case *tc, void *data) test_ue[i]->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue[i]->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue[i]->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue[i]->opc); + test_ue[i]->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue[i]->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue[i], "internet"); ogs_assert(sess); /********** Insert Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue[i]->imsi)); + doc = test_db_new_simple(test_ue[i]); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json[i], -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue[i]->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue[i], doc)); } for (i = 0; i < NUM_OF_TEST_UE; i++) { @@ -722,11 +484,7 @@ static void test2_func(abts_case *tc, void *data) for (i = 0; i < NUM_OF_TEST_UE; i++) { /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue[i]->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue[i])); } /* eNB disonncect from MME */ @@ -735,15 +493,11 @@ static void test2_func(abts_case *tc, void *data) /* eNB disonncect from SGW */ test_gtpu_close(gtpu); - /* Destroy DB collection */ - mongoc_collection_destroy(collection); - test_ue_remove_all(); } static void test3_func(abts_case *tc, void *data) { -#define NUM_OF_TEST_UE 3 int rv, i; ogs_socknode_t *s1ap; ogs_socknode_t *gtpu; @@ -760,136 +514,7 @@ static void test3_func(abts_case *tc, void *data) S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json[NUM_OF_TEST_UE] = { - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}", - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"imsi\" : \"901707364000061\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c8\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}", - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c8\" }, " - "\"imsi\" : \"901707364000062\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c9\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}", - }; - - /* Get DB collection */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); /* eNB connects to MME */ s1ap = tests1ap_client(AF_INET); @@ -912,6 +537,8 @@ static void test3_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); for (i = 0; i < NUM_OF_TEST_UE; i++) { + uint64_t imsi_index; + /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -923,19 +550,9 @@ static void test3_func(abts_case *tc, void *data) mobile_identity_suci.routing_indicator4 = 0xf; mobile_identity_suci.protection_scheme_id = OGS_NAS_5GS_NULL_SCHEME; mobile_identity_suci.home_network_pki_value = 0; - mobile_identity_suci.scheme_output[0] = 0x37; - mobile_identity_suci.scheme_output[1] = 0x46; - mobile_identity_suci.scheme_output[2] = 0; - mobile_identity_suci.scheme_output[3] = 0; - /* Multiple IMSI */ - if (i == 0) - mobile_identity_suci.scheme_output[4] = 0x06; - else if (i == 1) - mobile_identity_suci.scheme_output[4] = 0x16; - else if (i == 2) - mobile_identity_suci.scheme_output[4] = 0x26; - else - ogs_assert_if_reached(); + + imsi_index = i + 1; + ogs_uint64_to_buffer(imsi_index, 5, mobile_identity_suci.scheme_output); test_ue[i] = test_ue_add_by_suci(&mobile_identity_suci, 13); ogs_assert(test_ue[i]); @@ -947,37 +564,16 @@ static void test3_func(abts_case *tc, void *data) test_ue[i]->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue[i]->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue[i]->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue[i]->opc); + test_ue[i]->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue[i]->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue[i], "internet"); ogs_assert(sess); /********** Insert Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue[i]->imsi)); + doc = test_db_new_simple(test_ue[i]); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json[i], -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue[i]->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue[i], doc)); } for (i = 0; i < NUM_OF_TEST_UE; i++) { @@ -1134,11 +730,7 @@ static void test3_func(abts_case *tc, void *data) for (i = 0; i < NUM_OF_TEST_UE; i++) { /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue[i]->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue[i])); } /* eNB disonncect from MME */ @@ -1147,9 +739,6 @@ static void test3_func(abts_case *tc, void *data) /* eNB disonncect from SGW */ test_gtpu_close(gtpu); - /* Destroy DB collection */ - mongoc_collection_destroy(collection); - test_ue_remove_all(); } diff --git a/tests/attach/ue-context-test.c b/tests/attach/ue-context-test.c index 1673b2bef..5d8a0530a 100644 --- a/tests/attach/ue-context-test.c +++ b/tests/attach/ue-context-test.c @@ -35,54 +35,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -108,8 +61,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -135,37 +88,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -246,13 +171,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -282,54 +201,7 @@ static void test2_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -355,8 +227,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_EPS_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -382,37 +254,9 @@ static void test2_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -611,13 +455,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -647,54 +485,7 @@ static void test3_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -720,8 +511,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_EPS_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -747,37 +538,9 @@ static void test3_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1055,13 +818,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/common/context.c b/tests/common/context.c index 2bbd90491..4e7f700d2 100644 --- a/tests/common/context.c +++ b/tests/common/context.c @@ -447,7 +447,7 @@ int test_context_parse_config(void) self.plmn_support[ self.num_of_plmn_support]. num_of_s_nssai <= - OGS_MAX_NUM_OF_S_NSSAI); + OGS_MAX_NUM_OF_SLICE); s_nssai = &self.plmn_support[ self.num_of_plmn_support].s_nssai[ self.plmn_support[ @@ -497,10 +497,6 @@ int test_context_parse_config(void) s_nssai->sd.v = OGS_S_NSSAI_NO_SD_VALUE; - s_nssai->mapped_hplmn_sst = 0; - s_nssai->mapped_hplmn_sd.v = - OGS_S_NSSAI_NO_SD_VALUE; - self.plmn_support[ self.num_of_plmn_support]. num_of_s_nssai++; @@ -862,6 +858,7 @@ test_ue_t *test_ue_add_by_suci( ogs_nas_5gs_mobile_identity_suci_t *mobile_identity_suci, uint16_t mobile_identity_suci_length) { + int i, j; test_ue_t *test_ue = NULL; ogs_assert(mobile_identity_suci); @@ -896,6 +893,23 @@ test_ue_t *test_ue_add_by_suci( ogs_nas_from_plmn_id( &mobile_identity_suci->nas_plmn_id, &test_ue->e_tai.plmn_id); + for (i = 0; i < test_self()->num_of_plmn_support; i++) { + for (j = 0; j < test_self()->plmn_support[i].num_of_s_nssai; j++) { + ogs_nas_s_nssai_ie_t *s_nssai = &test_ue->requested_nssai. + s_nssai[test_ue->requested_nssai.num_of_s_nssai]; + + s_nssai->sst = 0; + s_nssai->sd.v = OGS_S_NSSAI_NO_SD_VALUE; + s_nssai->mapped_hplmn_sst = 0; + s_nssai->mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE; + + memcpy(s_nssai, &test_self()->plmn_support[i].s_nssai[j], + sizeof(ogs_s_nssai_t)); + + test_ue->requested_nssai.num_of_s_nssai++; + } + } + test_ue_set_mobile_identity_suci( test_ue, mobile_identity_suci, mobile_identity_suci_length); @@ -1143,3 +1157,1722 @@ test_bearer_t *test_qos_flow_find_by_qfi(test_sess_t *sess, uint8_t qfi) return NULL; } + +int test_db_insert_ue(test_ue_t *test_ue, bson_t *doc) +{ + mongoc_collection_t *collection = NULL; + bson_t *key = NULL; + int64_t count = 0; + bson_error_t error; + + ogs_assert(test_ue); + ogs_assert(doc); + + OGS_HEX(test_ue->k_string, strlen(test_ue->k_string), test_ue->k); + OGS_HEX(test_ue->opc_string, strlen(test_ue->opc_string), test_ue->opc); + + collection = mongoc_client_get_collection( + ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); + if (!collection) { + ogs_error("mongoc_client_get_collection() failed"); + return OGS_ERROR; + } + key = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + ogs_assert(key); + + count = mongoc_collection_count ( + collection, MONGOC_QUERY_NONE, key, 0, 0, NULL, &error); + if (count) { + if (mongoc_collection_remove(collection, + MONGOC_REMOVE_SINGLE_REMOVE, key, NULL, &error) != true) { + ogs_error("mongoc_collection_remove() failed"); + bson_destroy(key); + return OGS_ERROR; + } + } + bson_destroy(key); + + if (mongoc_collection_insert(collection, + MONGOC_INSERT_NONE, doc, NULL, &error) != true) { + ogs_error("mongoc_collection_insert() failed"); + bson_destroy(doc); + return OGS_ERROR; + } + bson_destroy(doc); + + key = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + ogs_assert(key); + do { + count = mongoc_collection_count( + collection, MONGOC_QUERY_NONE, key, 0, 0, NULL, &error); + } while (count == 0); + bson_destroy(key); + + mongoc_collection_destroy(collection); + + return OGS_OK; +} + +int test_db_remove_ue(test_ue_t *test_ue) +{ + mongoc_collection_t *collection = NULL; + bson_t *key = NULL; + bson_error_t error; + + ogs_assert(test_ue); + + collection = mongoc_client_get_collection( + ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); + if (!collection) { + ogs_error("mongoc_client_get_collection() failed"); + return OGS_ERROR; + } + + key = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + ogs_assert(key); + if (mongoc_collection_remove(collection, + MONGOC_REMOVE_SINGLE_REMOVE, key, NULL, &error) != true) { + ogs_error("mongoc_collection_remove() failed"); + bson_destroy(key); + return OGS_ERROR; + } + bson_destroy(key); + + mongoc_collection_destroy(collection); + + return OGS_OK; +} + +bson_t *test_db_new_simple(test_ue_t *test_ue) +{ + bson_t *doc = NULL; + + ogs_assert(test_ue); + +#if 1 + doc = BCON_NEW( + "imsi", BCON_UTF8(test_ue->imsi), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "slice", "[", "{", + "sst", BCON_INT32(1), + "default_indicator", BCON_BOOL(true), + "session", "[", "{", + "name", BCON_UTF8("internet"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(9), + "arp", "{", + "priority_level", BCON_INT32(8), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "}", "]", + "}", "]", + "security", "{", + "k", BCON_UTF8(test_ue->k_string), + "opc", BCON_UTF8(test_ue->opc_string), + "amf", BCON_UTF8("8000"), + "sqn", BCON_INT64(64), + "}", + "subscribed_rau_tau_timer", BCON_INT32(12), + "network_access_mode", BCON_INT32(2), + "subscriber_status", BCON_INT32(0), + "access_restriction_data", BCON_INT32(32) + ); +#else /* For verify WebUI */ + bson_error_t error; + const char *json = + "{" + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " + "\"imsi\" : \"901700000021309\"," +#if 0 + "\"msisdn\" : [\"821012345678\", \"82107654321\" ], " + "\"msisdn\" : [\"82107654321\", \"821012345678\" ], " +#endif + "\"ambr\" : { " + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"slice\" : [" + "{" + "\"sst\" : 1," + "\"default_indicator\" : true," + "\"session\" : [" + "{" + "\"name\" : \"internet\", " + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 9, " + "\"arp\" : { " + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"type\" : 3" + "}" + "]" + "}" + "]," + "\"security\" : { " + "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " + "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " + "\"amf\" : \"8000\", " + "\"sqn\" : { \"$numberLong\" : \"64\" } " + "}, " + "\"subscribed_rau_tau_timer\" : 12," + "\"network_access_mode\" : 2, " + "\"subscriber_status\" : 0, " + "\"access_restriction_data\" : 32, " + "\"__v\" : 0 " + "}"; + + doc = bson_new_from_json((const uint8_t *)json, -1, &error);; +#endif + ogs_assert(doc); + + return doc; +} + +bson_t *test_db_new_qos_flow(test_ue_t *test_ue) +{ + bson_t *doc = NULL; + + ogs_assert(test_ue); + +#if 1 + doc = BCON_NEW( + "imsi", BCON_UTF8(test_ue->imsi), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "slice", "[", "{", + "sst", BCON_INT32(1), + "default_indicator", BCON_BOOL(true), + "session", "[", "{", + "name", BCON_UTF8("internet"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(9), + "arp", "{", + "priority_level", BCON_INT32(8), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "pcc_rule", "[", "{", + "qos", "{", + "index", BCON_INT32(1), + "arp", "{", + "priority_level", BCON_INT32(2), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(64), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(44), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(64), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(44), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "flow", "[", + "{", "direction", BCON_INT32(2), + "description", BCON_UTF8("permit out udp from 10.200.136.98/32 23454 to assigned 1-65535"), "}", + "{", "direction", BCON_INT32(1), + "description", BCON_UTF8("permit out icmp from any to assigned"), "}", + "{", "direction", BCON_INT32(2), + "description", BCON_UTF8("permit out udp from 10.200.136.98/32 23455 to assigned 1-65535"), "}", + "{", "direction", BCON_INT32(1), + "description", BCON_UTF8("permit out udp from 10.200.136.98/32 1-65535 to assigned 50021"), "}", + "]", + "}", "]", + "}", "]", + "}", "]", + "security", "{", + "k", BCON_UTF8(test_ue->k_string), + "opc", BCON_UTF8(test_ue->opc_string), + "amf", BCON_UTF8("8000"), + "sqn", BCON_INT64(64), + "}", + "subscribed_rau_tau_timer", BCON_INT32(12), + "network_access_mode", BCON_INT32(2), + "subscriber_status", BCON_INT32(0), + "access_restriction_data", BCON_INT32(32) + ); +#else /* For verify WebUI */ + bson_error_t error; + const char *json = + "{" + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " + "\"imsi\" : \"901700000021309\"," + "\"ambr\" : { " + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"slice\" : [" + "{" + "\"sst\" : 1," + "\"default_indicator\" : true," + "\"session\" : [" + "{" + "\"name\" : \"internet\", " + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 9, " + "\"arp\" : { " + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"type\" : 3," + "\"pcc_rule\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," + "\"qos\" : {" + "\"index\" : 1," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 64," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 44," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 64," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 44," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 3," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}," + "\"flow\" : [" + "{ \"direction\" : 2," + "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," + "{ \"direction\" : 1," + "\"description\" : \"permit out icmp from any to assigned\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," + "{ \"direction\" : 2," + "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," + "{ \"direction\" : 1," + "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" + "]" + "}" + "]" + "}" + "]" + "}" + "]," + "\"security\" : { " + "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " + "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " + "\"amf\" : \"8000\", " + "\"sqn\" : { \"$numberLong\" : \"64\" } " + "}, " + "\"subscribed_rau_tau_timer\" : 12," + "\"network_access_mode\" : 2, " + "\"subscriber_status\" : 0, " + "\"access_restriction_data\" : 32, " + "\"__v\" : 0 " + "}"; + + doc = bson_new_from_json((const uint8_t *)json, -1, &error);; +#endif + ogs_assert(doc); + + return doc; +} + +bson_t *test_db_new_session(test_ue_t *test_ue) +{ + bson_t *doc = NULL; + + ogs_assert(test_ue); + +#if 1 + doc = BCON_NEW( + "imsi", BCON_UTF8(test_ue->imsi), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "slice", "[", "{", + "sst", BCON_INT32(1), + "default_indicator", BCON_BOOL(true), + "session", "[", + "{", + "name", BCON_UTF8("internet"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(9), + "arp", "{", + "priority_level", BCON_INT32(8), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "}", + "{", + "name", BCON_UTF8("ims"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(6), + "arp", "{", + "priority_level", BCON_INT32(6), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "pcc_rule", "[", "{", + "qos", "{", + "index", BCON_INT32(1), + "arp", "{", + "priority_level", BCON_INT32(3), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(64), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(44), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(64), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(44), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "flow", "[", + "{", "direction", BCON_INT32(2), + "description", BCON_UTF8("permit out udp from 10.200.136.98/32 23454 to assigned 1-65535"), "}", + "{", "direction", BCON_INT32(1), + "description", BCON_UTF8("permit out udp from 10.200.136.98/32 1-65535 to assigned 50020"), "}", + "{", "direction", BCON_INT32(2), + "description", BCON_UTF8("permit out udp from 10.200.136.98/32 23455 to assigned 1-65535"), "}", + "{", "direction", BCON_INT32(1), + "description", BCON_UTF8("permit out udp from 10.200.136.98/32 1-65535 to assigned 50021"), "}", + "]", + "}", "]", + "}", + "]", + "}", "]", + "security", "{", + "k", BCON_UTF8(test_ue->k_string), + "opc", BCON_UTF8(test_ue->opc_string), + "amf", BCON_UTF8("8000"), + "sqn", BCON_INT64(64), + "}", + "subscribed_rau_tau_timer", BCON_INT32(12), + "network_access_mode", BCON_INT32(2), + "subscriber_status", BCON_INT32(0), + "access_restriction_data", BCON_INT32(32) + ); +#else /* For verify WebUI */ + bson_error_t error; + const char *json = + "{" + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " + "\"imsi\" : \"901700000021309\"," + "\"ambr\" : { " + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"slice\" : [" + "{" + "\"sst\" : 1," + "\"default_indicator\" : true," + "\"session\" : [" + "{" + "\"name\" : \"internet\", " + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 9, " + "\"arp\" : { " + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"type\" : 3" + "}," + "{" + "\"name\" : \"ims\", " + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 6, " + "\"arp\" : { " + "\"priority_level\" : 6," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"type\" : 3," + "\"pcc_rule\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," + "\"qos\" : {" + "\"index\" : 1," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 64," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 44," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 64," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 44," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 3," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}," + "\"flow\" : [" + "{ \"direction\" : 2," + "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," + "{ \"direction\" : 1," + "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," + "{ \"direction\" : 2," + "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," + "{ \"direction\" : 1," + "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" + "]" + "}" + "]" + "}" + "]" + "}" + "]," + "\"security\" : { " + "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " + "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " + "\"amf\" : \"8000\", " + "\"sqn\" : { \"$numberLong\" : \"64\" } " + "}, " + "\"subscribed_rau_tau_timer\" : 12," + "\"network_access_mode\" : 2, " + "\"subscriber_status\" : 0, " + "\"access_restriction_data\" : 32, " + "\"__v\" : 0 " + "}"; + + doc = bson_new_from_json((const uint8_t *)json, -1, &error);; +#endif + ogs_assert(doc); + + return doc; +} + +bson_t *test_db_new_ims(test_ue_t *test_ue) +{ + bson_t *doc = NULL; + + ogs_assert(test_ue); + +#if 1 + doc = BCON_NEW( + "imsi", BCON_UTF8(test_ue->imsi), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "slice", "[", "{", + "sst", BCON_INT32(1), + "default_indicator", BCON_BOOL(true), + "session", "[", + "{", + "name", BCON_UTF8("internet"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(9), + "arp", "{", + "priority_level", BCON_INT32(8), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "}", + "{", + "name", BCON_UTF8("ims"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(5), + "arp", "{", + "priority_level", BCON_INT32(1), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "pcc_rule", "[", + "{", + "qos", "{", + "index", BCON_INT32(1), + "arp", "{", + "priority_level", BCON_INT32(3), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "{", + "qos", "{", + "index", BCON_INT32(2), + "arp", "{", + "priority_level", BCON_INT32(4), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "]", + "}", + "]", + "}", "]", + "security", "{", + "k", BCON_UTF8(test_ue->k_string), + "opc", BCON_UTF8(test_ue->opc_string), + "amf", BCON_UTF8("8000"), + "sqn", BCON_INT64(64), + "}", + "subscribed_rau_tau_timer", BCON_INT32(12), + "network_access_mode", BCON_INT32(2), + "subscriber_status", BCON_INT32(0), + "access_restriction_data", BCON_INT32(32) + ); +#else /* For verify WebUI */ + bson_error_t error; + const char *json = + "{" + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " + "\"imsi\" : \"001010123456819\", " + "\"ambr\" : { " + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"slice\" : [" + "{" + "\"sst\" : 1," + "\"default_indicator\" : true," + "\"session\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," + "\"name\" : \"internet\"," + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : {" + "\"index\" : 9," + "\"arp\" : {" + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1," + "\"pre_emption_capability\" : 1" + "}" + "}," + "\"type\" : 3" + "}," + "{" + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " + "\"name\" : \"ims\", " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 5, " + "\"arp\" : { " + "\"priority_level\" : 1," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"pcc_rule\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," + "\"qos\" : {" + "\"index\" : 1," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 2," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}," + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd4d\" }," + "\"qos\" : {" + "\"index\" : 2," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 4," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}" + "]," + "\"type\" : 3" + "}" + "]" + "}" + "]," + "\"subscribed_rau_tau_timer\" : 12," + "\"network_access_mode\" : 2, " + "\"subscriber_status\" : 0, " + "\"access_restriction_data\" : 32, " + "\"security\" : { " + "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " + "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " + "\"amf\" : \"8000\", " + "\"sqn\" : { \"$numberLong\" : \"64\" } " + "}, " + "\"__v\" : 0 " + "}"; + + doc = bson_new_from_json((const uint8_t *)json, -1, &error);; +#endif + ogs_assert(doc); + + return doc; +} + +bson_t *test_db_new_slice(test_ue_t *test_ue) +{ + bson_t *doc = NULL; + + ogs_assert(test_ue); + +#if 1 + doc = BCON_NEW( + "imsi", BCON_UTF8(test_ue->imsi), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "slice", "[", + "{", + "sst", BCON_INT32(1), + "default_indicator", BCON_BOOL(true), + "session", "[", + "{", + "name", BCON_UTF8("internet"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(9), + "arp", "{", + "priority_level", BCON_INT32(8), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "}", + "{", + "name", BCON_UTF8("ims"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(5), + "arp", "{", + "priority_level", BCON_INT32(1), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "pcc_rule", "[", + "{", + "qos", "{", + "index", BCON_INT32(1), + "arp", "{", + "priority_level", BCON_INT32(3), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "{", + "qos", "{", + "index", BCON_INT32(2), + "arp", "{", + "priority_level", BCON_INT32(4), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "]", + "}", + "]", + "}", + "{", + "sst", BCON_INT32(1), + "sd", BCON_UTF8("000080"), + "session", "[", + "{", + "name", BCON_UTF8("internet"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(9), + "arp", "{", + "priority_level", BCON_INT32(8), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "}", + "{", + "name", BCON_UTF8("ims"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(5), + "arp", "{", + "priority_level", BCON_INT32(1), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "pcc_rule", "[", + "{", + "qos", "{", + "index", BCON_INT32(1), + "arp", "{", + "priority_level", BCON_INT32(3), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "{", + "qos", "{", + "index", BCON_INT32(2), + "arp", "{", + "priority_level", BCON_INT32(4), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "]", + "}", + "]", + "}", + "{", + "sst", BCON_INT32(1), + "sd", BCON_UTF8("009000"), + "session", "[", + "{", + "name", BCON_UTF8("internet"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(9), + "arp", "{", + "priority_level", BCON_INT32(8), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "}", + "{", + "name", BCON_UTF8("ims"), + "type", BCON_INT32(3), + "ambr", "{", + "downlink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "uplink", "{", + "value", BCON_INT32(1), + "unit", BCON_INT32(3), + "}", + "}", + "qos", "{", + "index", BCON_INT32(5), + "arp", "{", + "priority_level", BCON_INT32(1), + "pre_emption_vulnerability", BCON_INT32(1), + "pre_emption_capability", BCON_INT32(1), + "}", + "}", + "pcc_rule", "[", + "{", + "qos", "{", + "index", BCON_INT32(1), + "arp", "{", + "priority_level", BCON_INT32(3), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(82), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "{", + "qos", "{", + "index", BCON_INT32(2), + "arp", "{", + "priority_level", BCON_INT32(4), + "pre_emption_vulnerability", BCON_INT32(2), + "pre_emption_capability", BCON_INT32(2), + "}", + "mbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "gbr", "{", + "downlink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "uplink", "{", + "value", BCON_INT32(802), + "unit", BCON_INT32(1), + "}", + "}", + "}", + "}", + "]", + "}", + "]", + "}", + "]", + "security", "{", + "k", BCON_UTF8(test_ue->k_string), + "opc", BCON_UTF8(test_ue->opc_string), + "amf", BCON_UTF8("8000"), + "sqn", BCON_INT64(64), + "}", + "subscribed_rau_tau_timer", BCON_INT32(12), + "network_access_mode", BCON_INT32(2), + "subscriber_status", BCON_INT32(0), + "access_restriction_data", BCON_INT32(32) + ); +#else /* For verify WebUI */ + bson_error_t error; + const char *json = + "{" + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " + "\"imsi\" : \"9017000007487\", " + "\"ambr\" : { " + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"slice\" : [" + "{" + "\"sst\" : 1," + "\"default_indicator\" : true," + "\"session\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," + "\"name\" : \"internet\"," + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : {" + "\"index\" : 9," + "\"arp\" : {" + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1," + "\"pre_emption_capability\" : 1" + "}" + "}," + "\"type\" : 3" + "}," + "{" + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " + "\"name\" : \"ims\", " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 5, " + "\"arp\" : { " + "\"priority_level\" : 1," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"pcc_rule\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," + "\"qos\" : {" + "\"index\" : 1," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 2," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}," + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd4d\" }," + "\"qos\" : {" + "\"index\" : 2," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 4," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}" + "]," + "\"type\" : 3" + "}" + "]" + "}," + "{" + "\"sst\" : 1," + "\"sd\" : \"000080\"," + "\"session\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," + "\"name\" : \"internet\"," + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : {" + "\"index\" : 9," + "\"arp\" : {" + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1," + "\"pre_emption_capability\" : 1" + "}" + "}," + "\"type\" : 3" + "}," + "{" + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " + "\"name\" : \"ims\", " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 5, " + "\"arp\" : { " + "\"priority_level\" : 1," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"pcc_rule\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," + "\"qos\" : {" + "\"index\" : 1," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 2," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}," + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd4d\" }," + "\"qos\" : {" + "\"index\" : 2," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 4," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}" + "]," + "\"type\" : 3" + "}" + "]" + "}," + "{" + "\"sst\" : 1," + "\"sd\" : \"009000\"," + "\"session\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," + "\"name\" : \"internet\"," + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : {" + "\"index\" : 9," + "\"arp\" : {" + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1," + "\"pre_emption_capability\" : 1" + "}" + "}," + "\"type\" : 3" + "}," + "{" + "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " + "\"name\" : \"ims\", " + "\"ambr\" : {" + "\"downlink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}," + "\"uplink\" : {" + "\"value\" : 1," + "\"unit\" : 3" + "}" + "}," + "\"qos\" : { " + "\"index\" : 5, " + "\"arp\" : { " + "\"priority_level\" : 1," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"pcc_rule\" : [" + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," + "\"qos\" : {" + "\"index\" : 1," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 82," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 2," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}," + "{" + "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd4d\" }," + "\"qos\" : {" + "\"index\" : 2," + "\"mbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"gbr\" : {" + "\"downlink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}," + "\"uplink\" : {" + "\"value\" : 802," + "\"unit\" : 1" + "}" + "}," + "\"arp\" : {" + "\"priority_level\" : 4," + "\"pre_emption_vulnerability\" : 2," + "\"pre_emption_capability\" : 2 }" + "}" + "}" + "]," + "\"type\" : 3" + "}" + "]" + "}" + "]," + "\"subscribed_rau_tau_timer\" : 12," + "\"network_access_mode\" : 2, " + "\"subscriber_status\" : 0, " + "\"access_restriction_data\" : 32, " + "\"security\" : { " + "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " + "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " + "\"amf\" : \"8000\", " + "\"sqn\" : { \"$numberLong\" : \"64\" } " + "}, " + "\"__v\" : 0 " + "}"; + + doc = bson_new_from_json((const uint8_t *)json, -1, &error);; +#endif + ogs_assert(doc); + + return doc; +} diff --git a/tests/common/context.h b/tests/common/context.h index 655377e97..58cb3a528 100644 --- a/tests/common/context.h +++ b/tests/common/context.h @@ -63,7 +63,7 @@ typedef struct test_context_s { struct { ogs_plmn_id_t plmn_id; int num_of_s_nssai; - ogs_s_nssai_t s_nssai[OGS_MAX_NUM_OF_S_NSSAI]; + ogs_s_nssai_t s_nssai[OGS_MAX_NUM_OF_SLICE]; } plmn_support[OGS_MAX_NUM_OF_PLMN]; /* Served EPC TAI */ @@ -304,7 +304,9 @@ typedef struct test_ue_s { ogs_nr_cgi_t nr_cgi; uint8_t k[OGS_KEY_LEN]; + const char *k_string; uint8_t opc[OGS_KEY_LEN]; + const char *opc_string; uint8_t rand[OGS_RAND_LEN]; uint8_t autn[OGS_AUTN_LEN]; @@ -365,6 +367,16 @@ typedef struct test_ue_s { ogs_nas_ue_security_capability_t ue_security_capability; ogs_nas_ue_network_capability_t ue_network_capability; + struct { + int num_of_s_nssai; + ogs_nas_s_nssai_ie_t s_nssai[OGS_MAX_NUM_OF_SLICE]; + } requested_nssai, allowed_nssai; + + struct { + int num_of_s_nssai; + ogs_nas_rejected_s_nssai_t s_nssai[OGS_MAX_NUM_OF_SLICE]; + } rejected_nssai; + test_initial_ue_param_t initial_ue_param; test_registration_request_param_t registration_request_param; @@ -483,6 +495,15 @@ test_bearer_t *test_bearer_find_by_ue_ebi(test_ue_t *test_ue, uint8_t ebi); test_bearer_t *test_qos_flow_find_by_qfi(test_sess_t *sess, uint8_t qfi); +int test_db_insert_ue(test_ue_t *test_ue, bson_t *doc); +int test_db_remove_ue(test_ue_t *test_ue); + +bson_t *test_db_new_simple(test_ue_t *test_ue); +bson_t *test_db_new_qos_flow(test_ue_t *test_ue); +bson_t *test_db_new_session(test_ue_t *test_ue); +bson_t *test_db_new_ims(test_ue_t *test_ue); +bson_t *test_db_new_slice(test_ue_t *test_ue); + #ifdef __cplusplus } #endif diff --git a/tests/common/emm-build.c b/tests/common/emm-build.c index 19f7afb4d..0f39300c8 100644 --- a/tests/common/emm-build.c +++ b/tests/common/emm-build.c @@ -291,6 +291,9 @@ ogs_pkbuf_t *testemm_build_authentication_response(test_ue_t *test_ue) message.emm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM; message.emm.h.message_type = OGS_NAS_EPS_AUTHENTICATION_RESPONSE; + OGS_HEX(test_ue->k_string, strlen(test_ue->k_string), test_ue->k); + OGS_HEX(test_ue->opc_string, strlen(test_ue->opc_string), test_ue->opc); + milenage_f2345(test_ue->opc, test_ue->k, test_ue->rand, res, ck, ik, ak, NULL); @@ -339,6 +342,9 @@ ogs_pkbuf_t *testemm_build_authentication_failure( authentication_failure->presencemask |= OGS_NAS_EPS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT; + OGS_HEX(test_ue->k_string, strlen(test_ue->k_string), test_ue->k); + OGS_HEX(test_ue->opc_string, strlen(test_ue->opc_string), test_ue->opc); + milenage_f2345(test_ue->opc, test_ue->k, test_ue->rand, NULL, NULL, NULL, NULL, ak); diff --git a/tests/common/gmm-build.c b/tests/common/gmm-build.c index 798b6a650..74e71011e 100644 --- a/tests/common/gmm-build.c +++ b/tests/common/gmm-build.c @@ -24,7 +24,7 @@ ogs_pkbuf_t *testgmm_build_registration_request( { int i; uint16_t psimask = 0; - ogs_s_nssai_t *s_nssai = NULL; + ogs_nas_s_nssai_ie_t *s_nssai = NULL; ogs_nas_5gs_message_t message; ogs_pkbuf_t *pkbuf = NULL; @@ -162,11 +162,9 @@ ogs_pkbuf_t *testgmm_build_registration_request( OGS_NAS_5GS_REGISTRATION_REQUEST_REQUESTED_NSSAI_PRESENT; requested_nssai->length = 0; - for (i = 0; i < test_self()->num_of_plmn_support; i++) { - ogs_nas_build_nssai(requested_nssai, - test_self()->plmn_support[i].s_nssai, - test_self()->plmn_support[i].num_of_s_nssai); - } + ogs_nas_build_nssai(requested_nssai, + test_ue->requested_nssai.s_nssai, + test_ue->requested_nssai.num_of_s_nssai); } if (test_ue->registration_request_param.last_visited_registered_tai) { @@ -637,7 +635,9 @@ ogs_pkbuf_t *testgmm_build_ul_nas_transport(test_sess_t *test_sess, ul_nas_transport->presencemask |= OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT; ogs_nas_build_s_nssai( - nas_s_nssai, &test_self()->plmn_support[0].s_nssai[0]); + nas_s_nssai, + &test_ue->allowed_nssai. + s_nssai[test_ue->allowed_nssai.num_of_s_nssai-1]); } if (test_sess->ul_nas_transport_param.dnn) { diff --git a/tests/common/gmm-handler.c b/tests/common/gmm-handler.c index d1b7f90a9..36e7cff6e 100644 --- a/tests/common/gmm-handler.c +++ b/tests/common/gmm-handler.c @@ -49,11 +49,24 @@ void testgmm_handle_registration_accept(test_ue_t *test_ue, test_ue->pdu_session_status = 0; test_ue->pdu_session_reactivation_result = 0; + if (registration_accept->presencemask & + OGS_NAS_5GS_REGISTRATION_ACCEPT_ALLOWED_NSSAI_PRESENT) { + test_ue->allowed_nssai.num_of_s_nssai = + ogs_nas_parse_nssai( + test_ue->allowed_nssai.s_nssai, + ®istration_accept->allowed_nssai); + } + if (registration_accept->presencemask & + OGS_NAS_5GS_REGISTRATION_ACCEPT_REJECTED_NSSAI_PRESENT) { + test_ue->rejected_nssai.num_of_s_nssai = + ogs_nas_parse_rejected_nssai( + test_ue->rejected_nssai.s_nssai, + ®istration_accept->rejected_nssai); + } if (registration_accept->presencemask & OGS_NAS_5GS_REGISTRATION_ACCEPT_PDU_SESSION_STATUS_PRESENT) test_ue->pdu_session_status = pdu_session_status->psi; - if (registration_accept->presencemask & - OGS_NAS_5GS_REGISTRATION_ACCEPT_PDU_SESSION_REACTIVATION_RESULT_PRESENT) + if (registration_accept->presencemask & OGS_NAS_5GS_REGISTRATION_ACCEPT_PDU_SESSION_REACTIVATION_RESULT_PRESENT) test_ue->pdu_session_reactivation_result = pdu_session_reactivation_result->psi; } diff --git a/tests/common/gsm-build.c b/tests/common/gsm-build.c index ab89f8fa6..1e286c5c2 100644 --- a/tests/common/gsm-build.c +++ b/tests/common/gsm-build.c @@ -40,8 +40,6 @@ ogs_pkbuf_t *testgsm_build_pdu_session_establishment_request( "\x83\x06\x00\x00\x00\x00\x00\x0c\x00\x00\x0d\x00\x00\x02\x00\x00" "\x0a\x00\x00\x10\x00"; - ogs_s_nssai_t *s_nssai = NULL; - test_ue_t *test_ue = NULL; ogs_pkbuf_t *pkbuf = NULL; @@ -86,9 +84,6 @@ ogs_pkbuf_t *testgsm_build_pdu_session_establishment_request( extended_protocol_configuration_options->length = sizeof(ue_pco); extended_protocol_configuration_options->buffer = ue_pco; - s_nssai = &test_self()->plmn_support[0].s_nssai[0]; - ogs_assert(s_nssai); - return ogs_nas_5gs_plain_encode(&message); } diff --git a/tests/common/ngap-build.c b/tests/common/ngap-build.c index a88809396..16082ef81 100644 --- a/tests/common/ngap-build.c +++ b/tests/common/ngap-build.c @@ -137,16 +137,15 @@ ogs_pkbuf_t *testngap_build_ng_setup_request(uint32_t gnb_id, uint8_t bitsize) for (j = 0; j < test_self()->plmn_support[i].num_of_s_nssai; j++) { ogs_s_nssai_t *s_nssai = &test_self()->plmn_support[i].s_nssai[j]; - ogs_uint24_t sd; SliceSupportItem = CALLOC(1, sizeof(NGAP_SliceSupportItem_t)); ogs_asn_uint8_to_OCTET_STRING(s_nssai->sst, &SliceSupportItem->s_NSSAI.sST); - sd.v = s_nssai->sd.v; - if (sd.v == OGS_S_NSSAI_NO_SD_VALUE) - sd.v = 0x010000; - SliceSupportItem->s_NSSAI.sD = CALLOC(1, sizeof(NGAP_SD_t)); - ogs_asn_uint24_to_OCTET_STRING(sd, SliceSupportItem->s_NSSAI.sD); + if (s_nssai->sd.v != OGS_S_NSSAI_NO_SD_VALUE) { + SliceSupportItem->s_NSSAI.sD = CALLOC(1, sizeof(NGAP_SD_t)); + ogs_asn_uint24_to_OCTET_STRING( + s_nssai->sd, SliceSupportItem->s_NSSAI.sD); + } ASN_SEQUENCE_ADD(&BroadcastPLMNItem->tAISliceSupportList.list, SliceSupportItem); diff --git a/tests/csfb/crash-test.c b/tests/csfb/crash-test.c index 4743780ea..66e8b9d18 100644 --- a/tests/csfb/crash-test.c +++ b/tests/csfb/crash-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -416,13 +341,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/csfb/mo-active-test.c b/tests/csfb/mo-active-test.c index 95ca57dd5..b7f739090 100644 --- a/tests/csfb/mo-active-test.c +++ b/tests/csfb/mo-active-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -349,13 +274,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/csfb/mo-idle-test.c b/tests/csfb/mo-idle-test.c index d7046a126..fc6fd5d8a 100644 --- a/tests/csfb/mo-idle-test.c +++ b/tests/csfb/mo-idle-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -373,13 +298,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -406,54 +325,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -479,8 +351,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -506,37 +378,9 @@ static void test2_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -653,13 +497,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -686,54 +524,7 @@ static void test3_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -759,8 +550,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -786,37 +577,9 @@ static void test3_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1019,13 +782,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -1052,54 +809,7 @@ static void test4_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1125,8 +835,8 @@ static void test4_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -1152,37 +862,9 @@ static void test4_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1288,13 +970,7 @@ static void test4_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/csfb/mo-sms-test.c b/tests/csfb/mo-sms-test.c index f4c415ddf..21d4053a2 100644 --- a/tests/csfb/mo-sms-test.c +++ b/tests/csfb/mo-sms-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -342,13 +267,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/csfb/mt-active-test.c b/tests/csfb/mt-active-test.c index de18d2640..6188329dd 100644 --- a/tests/csfb/mt-active-test.c +++ b/tests/csfb/mt-active-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -360,13 +285,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/csfb/mt-idle-test.c b/tests/csfb/mt-idle-test.c index 0f19cc37d..149a2f6a4 100644 --- a/tests/csfb/mt-idle-test.c +++ b/tests/csfb/mt-idle-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -392,13 +317,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/csfb/mt-sms-test.c b/tests/csfb/mt-sms-test.c index 000714d1f..d0b900958 100644 --- a/tests/csfb/mt-sms-test.c +++ b/tests/csfb/mt-sms-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -110,8 +63,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -137,37 +90,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -394,13 +319,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(100); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/handover/5gc-n2-test.c b/tests/handover/5gc-n2-test.c index 9bf8882d1..4fa6e735d 100644 --- a/tests/handover/5gc-n2-test.c +++ b/tests/handover/5gc-n2-test.c @@ -42,105 +42,7 @@ static void failure_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -168,8 +70,8 @@ static void failure_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ ngap1 = testngap_client(AF_INET); @@ -206,33 +108,9 @@ static void failure_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -515,13 +393,7 @@ static void failure_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Two gNB disonncect from UPF */ testgnb_gtpu_close(gtpu1); @@ -561,105 +433,7 @@ static void direct_complete_func(abts_case *tc, void *data) uint32_t ran_ue_ngap_id; uint64_t amf_ue_ngap_id; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -687,8 +461,8 @@ static void direct_complete_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ ngap1 = testngap_client(AF_INET); @@ -725,33 +499,9 @@ static void direct_complete_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1253,13 +1003,7 @@ static void direct_complete_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Two gNB disonncect from UPF */ testgnb_gtpu_close(gtpu1); @@ -1296,105 +1040,7 @@ static void direct_cancel_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1422,8 +1068,8 @@ static void direct_cancel_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ ngap1 = testngap_client(AF_INET); @@ -1460,33 +1106,9 @@ static void direct_cancel_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1784,13 +1406,7 @@ static void direct_cancel_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Two gNB disonncect from UPF */ testgnb_gtpu_close(gtpu1); @@ -1831,105 +1447,7 @@ static void indirect_complete_func(abts_case *tc, void *data) uint32_t ran_ue_ngap_id; uint64_t amf_ue_ngap_id; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1957,8 +1475,8 @@ static void indirect_complete_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ ngap1 = testngap_client(AF_INET); @@ -1995,33 +1513,9 @@ static void indirect_complete_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -2555,13 +2049,7 @@ static void indirect_complete_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Two gNB disonncect from UPF */ testgnb_gtpu_close(gtpu1); @@ -2602,105 +2090,7 @@ static void indirect_cancel_func(abts_case *tc, void *data) uint32_t ran_ue_ngap_id; uint64_t amf_ue_ngap_id; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -2728,8 +2118,8 @@ static void indirect_cancel_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ ngap1 = testngap_client(AF_INET); @@ -2766,33 +2156,9 @@ static void indirect_cancel_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -3263,13 +2629,7 @@ static void indirect_cancel_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Two gNB disonncect from UPF */ testgnb_gtpu_close(gtpu1); diff --git a/tests/handover/5gc-xn-test.c b/tests/handover/5gc-xn-test.c index 16c8191ee..61cdbf2f6 100644 --- a/tests/handover/5gc-xn-test.c +++ b/tests/handover/5gc-xn-test.c @@ -42,88 +42,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -151,8 +70,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* Two gNB connects to AMF */ ngap1 = testngap_client(AF_INET); @@ -189,33 +108,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -523,13 +418,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Two gNB disonncect from UPF */ testgnb_gtpu_close(gtpu1); diff --git a/tests/handover/epc-s1-test.c b/tests/handover/epc-s1-test.c index 4507d724f..3f063124a 100644 --- a/tests/handover/epc-s1-test.c +++ b/tests/handover/epc-s1-test.c @@ -38,88 +38,7 @@ static void test1_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"internet\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23454\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50020 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23455\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50021 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -145,8 +64,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -188,37 +107,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -686,13 +577,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from SGW */ testgnb_gtpu_close(gtpu2); @@ -721,88 +606,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"internet\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23454\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50020 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23455\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50021 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -828,8 +632,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -871,37 +675,9 @@ static void test2_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1127,13 +903,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from SGW */ testgnb_gtpu_close(gtpu2); @@ -1162,88 +932,7 @@ static void test3_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"internet\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23454\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50020 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23455\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50021 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1269,8 +958,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -1312,37 +1001,9 @@ static void test3_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1552,13 +1213,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from SGW */ testgnb_gtpu_close(gtpu2); diff --git a/tests/handover/epc-x2-test.c b/tests/handover/epc-x2-test.c index 6ad4420b2..84a4a01d8 100644 --- a/tests/handover/epc-x2-test.c +++ b/tests/handover/epc-x2-test.c @@ -35,88 +35,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"901707364000060\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"internet\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23454\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50020 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from any 1-65535 to 10.200.136.98/32 23455\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from any 50021 to 10.200.136.98/32 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -142,8 +61,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -185,37 +104,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -467,13 +358,7 @@ static void test1_func(abts_case *tc, void *data) ogs_pkbuf_free(recvbuf); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Two eNB disonncect from SGW */ testgnb_gtpu_close(gtpu1); diff --git a/tests/meson.build b/tests/meson.build index d2872d58c..d2ebe12f1 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -25,7 +25,7 @@ subdir('common') subdir('app') subdir('registration') subdir('vonr') -subdir('minimal') +subdir('slice') subdir('attach') subdir('volte') subdir('csfb') diff --git a/tests/registration/auth-test.c b/tests/registration/auth-test.c index ec61ff4b9..0a91c4a65 100644 --- a/tests/registration/auth-test.c +++ b/tests/registration/auth-test.c @@ -36,54 +36,7 @@ static void test1_func(abts_case *tc, void *data) test_ue_t *test_ue = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -111,8 +64,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -134,33 +87,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.gmm_capability = 1; @@ -269,13 +198,7 @@ static void test1_func(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, OGS_OK, rv); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/dereg-test.c b/tests/registration/dereg-test.c index 461adf67f..51a16c399 100644 --- a/tests/registration/dereg-test.c +++ b/tests/registration/dereg-test.c @@ -37,58 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," -#if 0 - "\"msisdn\" : [\"821012345678\", \"82107654321\" ], " - "\"msisdn\" : [\"82107654321\", \"821012345678\" ], " -#endif - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -116,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -139,33 +88,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -333,13 +258,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -368,58 +287,7 @@ static void test2_func(abts_case *tc, void *data) test_ue_t *test_ue = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," -#if 0 - "\"msisdn\" : [\"821012345678\", \"82107654321\" ], " - "\"msisdn\" : [\"82107654321\", \"821012345678\" ], " -#endif - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -447,8 +315,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -470,33 +338,9 @@ static void test2_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -599,13 +443,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -635,54 +473,7 @@ static void test3_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -710,8 +501,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -733,33 +524,9 @@ static void test3_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.gmm_capability = 0; @@ -1079,13 +846,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1115,54 +876,7 @@ static void test4_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1190,8 +904,8 @@ static void test4_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_dnn_and_psi(test_ue, "internet", 5); ogs_assert(sess); @@ -1216,33 +930,9 @@ static void test4_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); for (i = 0; i < 10; i++) { /* Send Registration request */ @@ -1437,13 +1127,7 @@ static void test4_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/gmm-status-test.c b/tests/registration/gmm-status-test.c index ce18935d5..361214cd0 100644 --- a/tests/registration/gmm-status-test.c +++ b/tests/registration/gmm-status-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -112,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -135,33 +88,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -299,13 +228,7 @@ static void test1_func(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, OGS_OK, rv); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/guti-test.c b/tests/registration/guti-test.c index a5f023fb1..4d3bfa042 100644 --- a/tests/registration/guti-test.c +++ b/tests/registration/guti-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -112,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -135,33 +88,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -540,13 +469,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -576,54 +499,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -651,8 +527,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -674,33 +550,9 @@ static void test2_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -911,7 +763,6 @@ static void test2_func(abts_case *tc, void *data) rv = testgnb_ngap_send(ngap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); -#if 0 /* Send GTP-U ICMP Packet */ qos_flow = test_qos_flow_find_by_qfi(sess, 1); ogs_assert(qos_flow); @@ -965,7 +816,6 @@ static void test2_func(abts_case *tc, void *data) ABTS_PTR_NOTNULL(tc, sendbuf); rv = testgnb_ngap_send(ngap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); -#endif /* Send PDU session establishment request */ sess->ul_nas_transport_param.request_type = @@ -1035,13 +885,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/identity-test.c b/tests/registration/identity-test.c index beb056f3f..b110d8df2 100644 --- a/tests/registration/identity-test.c +++ b/tests/registration/identity-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -112,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -135,33 +88,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -408,13 +337,7 @@ static void test1_func(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, OGS_OK, rv); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/idle-test.c b/tests/registration/idle-test.c index 913fc21cd..3a7b213fb 100644 --- a/tests/registration/idle-test.c +++ b/tests/registration/idle-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -112,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -135,33 +88,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -471,13 +400,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -506,54 +429,7 @@ static void test2_func(abts_case *tc, void *data) test_ue_t *test_ue = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -581,8 +457,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -604,33 +480,9 @@ static void test2_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -793,13 +645,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -829,54 +675,7 @@ static void test3_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -904,8 +703,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -927,33 +726,9 @@ static void test3_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -1221,13 +996,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1261,54 +1030,7 @@ static void test4_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1336,8 +1058,8 @@ static void test4_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -1359,33 +1081,9 @@ static void test4_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1750,13 +1448,7 @@ static void test4_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1786,54 +1478,7 @@ static void test5_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1861,8 +1506,8 @@ static void test5_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_dnn_and_psi(test_ue, "internet", 5); ogs_assert(sess); @@ -1887,33 +1532,9 @@ static void test5_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -2178,13 +1799,7 @@ static void test5_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -2214,54 +1829,7 @@ static void test6_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -2289,8 +1857,8 @@ static void test6_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_dnn_and_psi(test_ue, "internet", 5); ogs_assert(sess); @@ -2315,33 +1883,9 @@ static void test6_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* To start RAN-UE-NGAP-ID : 0 */ test_ue->ran_ue_ngap_id = -1; @@ -2605,13 +2149,7 @@ static void test6_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/paging-test.c b/tests/registration/paging-test.c index 0f28489aa..e0e91fbc8 100644 --- a/tests/registration/paging-test.c +++ b/tests/registration/paging-test.c @@ -37,54 +37,7 @@ static void cm_idle_paging_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -112,8 +65,8 @@ static void cm_idle_paging_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -135,33 +88,9 @@ static void cm_idle_paging_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -613,13 +542,7 @@ static void cm_idle_paging_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -649,54 +572,7 @@ static void cm_idle_error_indication_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -724,8 +600,8 @@ static void cm_idle_error_indication_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -747,33 +623,9 @@ static void cm_idle_error_indication_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -1017,13 +869,7 @@ static void cm_idle_error_indication_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1053,54 +899,7 @@ static void cm_connected_error_indication_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1128,8 +927,8 @@ static void cm_connected_error_indication_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -1151,33 +950,9 @@ static void cm_connected_error_indication_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -1366,13 +1141,7 @@ static void cm_connected_error_indication_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1407,88 +1176,7 @@ static void vonr_qos_flow_test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out icmp from any to assigned\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1516,8 +1204,8 @@ static void vonr_qos_flow_test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -1539,33 +1227,9 @@ static void vonr_qos_flow_test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1869,13 +1533,7 @@ static void vonr_qos_flow_test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1910,105 +1568,7 @@ static void vonr_session_test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -2036,8 +1596,8 @@ static void vonr_session_test2_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -2059,33 +1619,9 @@ static void vonr_session_test2_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -2473,13 +2009,7 @@ static void vonr_session_test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -2509,54 +2039,7 @@ static void registration_ue_context_test4_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -2584,8 +2067,8 @@ static void registration_ue_context_test4_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -2607,33 +2090,9 @@ static void registration_ue_context_test4_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -2940,13 +2399,7 @@ static void registration_ue_context_test4_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -2976,54 +2429,7 @@ static void registration_idle_test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -3051,8 +2457,8 @@ static void registration_idle_test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -3074,33 +2480,9 @@ static void registration_idle_test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -3447,13 +2829,7 @@ static void registration_idle_test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/reset-test.c b/tests/registration/reset-test.c index a548e1e08..d5d09afc7 100644 --- a/tests/registration/reset-test.c +++ b/tests/registration/reset-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -112,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -135,33 +88,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* * Send InitialUEMessage + @@ -374,13 +303,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -410,54 +333,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -485,8 +361,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -508,33 +384,9 @@ static void test2_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -710,13 +562,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/registration/ue-context-test.c b/tests/registration/ue-context-test.c index c5a64df37..e6e86bf24 100644 --- a/tests/registration/ue-context-test.c +++ b/tests/registration/ue-context-test.c @@ -37,54 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -112,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -135,33 +88,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -236,13 +165,7 @@ static void test1_func(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, OGS_OK, rv); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -272,54 +195,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -347,8 +223,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -370,33 +246,9 @@ static void test2_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ gmmbuf = testgmm_build_registration_request(test_ue, NULL); @@ -595,13 +447,7 @@ static void test2_func(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, OGS_OK, rv); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -631,54 +477,7 @@ static void test3_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -706,8 +505,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -729,33 +528,9 @@ static void test3_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1090,13 +865,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1126,54 +895,7 @@ static void test4_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1201,8 +923,8 @@ static void test4_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -1224,33 +946,9 @@ static void test4_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1538,13 +1236,7 @@ static void test4_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/minimal/abts-main.c b/tests/slice/abts-main.c similarity index 92% rename from tests/minimal/abts-main.c rename to tests/slice/abts-main.c index f9115b036..8c7b482f2 100644 --- a/tests/minimal/abts-main.c +++ b/tests/slice/abts-main.c @@ -19,12 +19,12 @@ #include "test-app.h" -abts_suite *test_minimal(abts_suite *suite); +abts_suite *test_nssai(abts_suite *suite); const struct testlist { abts_suite *(*func)(abts_suite *suite); } alltests[] = { - {test_minimal}, + {test_nssai}, {NULL}, }; @@ -57,7 +57,7 @@ int main(int argc, const char *const argv[]) abts_suite *suite = NULL; atexit(terminate); - test_app_run(argc, argv, "minimal.yaml", initialize); + test_app_run(argc, argv, "slice.yaml", initialize); for (i = 0; alltests[i].func; i++) suite = alltests[i].func(suite); diff --git a/tests/minimal/meson.build b/tests/slice/meson.build similarity index 80% rename from tests/minimal/meson.build rename to tests/slice/meson.build index d5d0a64f2..70595f5f9 100644 --- a/tests/minimal/meson.build +++ b/tests/slice/meson.build @@ -15,12 +15,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -test5gc_minimal_sources = files(''' +test5gc_slice_sources = files(''' abts-main.c - minimal-test.c + nssai-test.c '''.split()) -test5gc_minimal_exe = executable('minimal', - sources : test5gc_minimal_sources, +test5gc_slice_exe = executable('slice', + sources : test5gc_slice_sources, c_args : testunit_core_cc_flags, dependencies : libtest5gc_dep) + +test('slice', + test5gc_slice_exe, + is_parallel : false, + suite: '5gc') diff --git a/tests/minimal/minimal-test.c b/tests/slice/nssai-test.c similarity index 71% rename from tests/minimal/minimal-test.c rename to tests/slice/nssai-test.c index 574673c79..f5d1885e5 100644 --- a/tests/minimal/minimal-test.c +++ b/tests/slice/nssai-test.c @@ -37,59 +37,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "5122250214c33e723a5dd523fc145fc0"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "981d464c7c52eb6e5036234984ad0bcf"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"2089300007487\", " -#if 0 - "\"msisdn\" : [\"821012345678\", \"82107654321\" ], " - "\"msisdn\" : [\"82107654321\", \"821012345678\" ], " -#endif - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"5122250214c33e723a5dd523fc145fc0\", " - "\"opc\" : \"981d464c7c52eb6e5036234984ad0bcf\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" }, " - "\"rand\" : \"20080C38 18183B52 2614162C 07601D0D\" " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -116,8 +64,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -139,36 +87,37 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_slice(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.gmm_capability = 1; + + test_ue->registration_request_param.requested_nssai = 1; + + test_ue->requested_nssai.s_nssai[1].sd.v = 0x000070; + + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + sst = 2; + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + sd.v = OGS_S_NSSAI_NO_SD_VALUE; + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + mapped_hplmn_sst = 0; + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE; + test_ue->requested_nssai.num_of_s_nssai++; + + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + sst = 3; + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + sd.v = 0x000080; + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + mapped_hplmn_sst = 0; + test_ue->requested_nssai.s_nssai[test_ue->requested_nssai.num_of_s_nssai]. + mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE; + test_ue->requested_nssai.num_of_s_nssai++; + gmmbuf = testgmm_build_registration_request(test_ue, NULL); ABTS_PTR_NOTNULL(tc, gmmbuf); sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, false, true); @@ -299,13 +248,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* Clear Test UE Context */ test_ue_remove(test_ue); @@ -317,7 +260,7 @@ static void test1_func(abts_case *tc, void *data) testgnb_ngap_close(ngap); } -abts_suite *test_minimal(abts_suite *suite) +abts_suite *test_nssai(abts_suite *suite) { suite = ADD_SUITE(suite) diff --git a/tests/unit/gtp-message-test.c b/tests/unit/gtp-message-test.c index 7d1c56498..9abab4d15 100644 --- a/tests/unit/gtp-message-test.c +++ b/tests/unit/gtp-message-test.c @@ -117,10 +117,10 @@ static void gtp_message_test1(abts_case *tc, void *data) OGS_GTP_SELECTION_MODE_MS_OR_NETWORK_PROVIDED_APN | 0xfc; req.pdn_type.presence = 1; - req.pdn_type.u8 = OGS_GTP_PDN_TYPE_IPV4; + req.pdn_type.u8 = OGS_PDU_SESSION_TYPE_IPV4; memset(&paa, 0, sizeof(ogs_paa_t)); - paa.pdn_type = OGS_GTP_PDN_TYPE_IPV4; + paa.session_type = OGS_PDU_SESSION_TYPE_IPV4; req.pdn_address_allocation.presence = 1; req.pdn_address_allocation.data = &paa; req.pdn_address_allocation.len = OGS_PAA_IPV4_LEN; diff --git a/tests/volte/bearer-test.c b/tests/volte/bearer-test.c index 78b731b85..c04919d56 100644 --- a/tests/volte/bearer-test.c +++ b/tests/volte/bearer-test.c @@ -35,88 +35,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"internet\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 15," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -142,8 +61,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -169,37 +88,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -360,13 +251,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/volte/pcscf-fd-path.c b/tests/volte/pcscf-fd-path.c index 748b242d7..a479a31fb 100644 --- a/tests/volte/pcscf-fd-path.c +++ b/tests/volte/pcscf-fd-path.c @@ -254,7 +254,7 @@ void pcscf_rx_send_aar_audio(uint8_t **rx_sid, memset(&paa, 0, sizeof(ogs_paa_t)); memcpy(paa.addr6, ipsub.sub, OGS_IPV6_LEN); - paa.pdn_type = 0x03; + paa.session_type = 0x03; #define FRAMED_IPV6_PREFIX_LENGTH 128 /* from spec document */ paa.len = FRAMED_IPV6_PREFIX_LENGTH; val.os.data = (uint8_t*)&paa; @@ -1032,7 +1032,7 @@ void pcscf_rx_send_aar_video(uint8_t **rx_sid, test_sess_t *sess, int id_type) memset(&paa, 0, sizeof(ogs_paa_t)); memcpy(paa.addr6, ipsub.sub, OGS_IPV6_LEN); - paa.pdn_type = 0x03; + paa.session_type = 0x03; #define FRAMED_IPV6_PREFIX_LENGTH 128 /* from spec document */ paa.len = FRAMED_IPV6_PREFIX_LENGTH; val.os.data = (uint8_t*)&paa; @@ -1477,7 +1477,7 @@ void pcscf_rx_send_aar_ctrl(uint8_t **rx_sid, test_sess_t *sess, int id_type) memset(&paa, 0, sizeof(ogs_paa_t)); memcpy(paa.addr6, ipsub.sub, OGS_IPV6_LEN); - paa.pdn_type = 0x03; + paa.session_type = 0x03; #define FRAMED_IPV6_PREFIX_LENGTH 128 /* from spec document */ paa.len = FRAMED_IPV6_PREFIX_LENGTH; val.os.data = (uint8_t*)&paa; diff --git a/tests/volte/rx-test.c b/tests/volte/rx-test.c index f4a81a8dd..54dbf4464 100644 --- a/tests/volte/rx-test.c +++ b/tests/volte/rx-test.c @@ -41,87 +41,7 @@ static void test1_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," - "\"apn\" : \"internet\"," - "\"qos\" : {" - "\"qci\" : 9," - "\"arp\" : {" - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1," - "\"pre_emption_capability\" : 1" - "}" - "}," - "\"type\" : 2" - "}," - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"ims\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -147,8 +67,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -174,37 +94,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_ims(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -613,13 +505,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -648,101 +534,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," - "\"apn\" : \"internet\"," - "\"qos\" : {" - "\"qci\" : 9," - "\"arp\" : {" - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1," - "\"pre_emption_capability\" : 1" - "}" - "}," - "\"type\" : 2" - "}," - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"ims\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -768,8 +560,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -795,37 +587,9 @@ static void test2_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1074,13 +838,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -1112,87 +870,7 @@ static void test3_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," - "\"apn\" : \"internet\"," - "\"qos\" : {" - "\"qci\" : 9," - "\"arp\" : {" - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1," - "\"pre_emption_capability\" : 1" - "}" - "}," - "\"type\" : 2" - "}," - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"ims\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 5, " - "\"arp\" : { " - "\"priority_level\" : 1," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1218,8 +896,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -1245,37 +923,9 @@ static void test3_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_ims(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1555,13 +1205,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -1593,87 +1237,7 @@ static void test4_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," - "\"apn\" : \"internet\"," - "\"qos\" : {" - "\"qci\" : 9," - "\"arp\" : {" - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1," - "\"pre_emption_capability\" : 1" - "}" - "}," - "\"type\" : 2" - "}," - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"ims\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 5, " - "\"arp\" : { " - "\"priority_level\" : 1," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1699,8 +1263,8 @@ static void test4_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -1726,37 +1290,9 @@ static void test4_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_ims(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -2181,13 +1717,7 @@ static void test4_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); @@ -2219,87 +1749,7 @@ static void test5_func(abts_case *tc, void *data) uint32_t enb_ue_s1ap_id; uint64_t mme_ue_s1ap_id; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," - "\"apn\" : \"internet\"," - "\"qos\" : {" - "\"qci\" : 9," - "\"arp\" : {" - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1," - "\"pre_emption_capability\" : 1" - "}" - "}," - "\"type\" : 2" - "}," - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"ims\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 5, " - "\"arp\" : { " - "\"priority_level\" : 1," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -2325,8 +1775,8 @@ static void test5_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -2352,37 +1802,9 @@ static void test5_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_ims(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -2787,13 +2209,7 @@ static void test5_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/volte/session-test.c b/tests/volte/session-test.c index 8de5f19ae..ed0950e94 100644 --- a/tests/volte/session-test.c +++ b/tests/volte/session-test.c @@ -35,101 +35,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," - "\"apn\" : \"internet\"," - "\"qos\" : {" - "\"qci\" : 9," - "\"arp\" : {" - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1," - "\"pre_emption_capability\" : 1" - "}" - "}," - "\"type\" : 2" - "}," - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"ims\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -155,8 +61,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -182,37 +88,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -467,13 +345,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/volte/video-test.c b/tests/volte/video-test.c index 5ce54498a..39b645639 100644 --- a/tests/volte/video-test.c +++ b/tests/volte/video-test.c @@ -39,105 +39,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *bearer = NULL; - const char *_k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "e8ed289deba952e4283b54e88e6183ca"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c6\" }, " - "\"imsi\" : \"001010123456819\", " - "\"pdn\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd32\" }," - "\"apn\" : \"internet\"," - "\"qos\" : {" - "\"qci\" : 9," - "\"arp\" : {" - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1," - "\"pre_emption_capability\" : 1" - "}" - "}," - "\"type\" : 2" - "}," - "{" - "\"_id\" : { \"$oid\" : \"310014158b8861d7605378c7\" }, " - "\"apn\" : \"ims\", " - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"82\" }," - "\"uplink\" : { \"$numberLong\" : \"82\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"82\" }," - "\"uplink\" : { \"$numberLong\" : \"82\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 2," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}" - "}," - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd4d\" }," - "\"qos\" : {" - "\"qci\" : 2," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"802\" }," - "\"uplink\" : { \"$numberLong\" : \"802\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"802\" }," - "\"uplink\" : { \"$numberLong\" : \"802\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 4," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}" - "}" - "]," - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1000000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1000000\" } " - "}," - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"security\" : { " - "\"k\" : \"465B5CE8 B199B49F AA5F0A2E E238A6BC\", " - "\"opc\" : \"E8ED289D EBA952E4 283B54E8 8E6183CA\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"64\" } " - "}, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -163,8 +65,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.ksi = 0; test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; sess = test_sess_add_by_apn(test_ue, "internet"); ogs_assert(sess); @@ -190,37 +92,9 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(NULL, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_ims(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); - - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Attach Request */ memset(&sess->pdn_connectivity_param, @@ -1283,13 +1157,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* eNB disonncect from MME */ testenb_s1ap_close(s1ap); diff --git a/tests/vonr/qos-flow-test.c b/tests/vonr/qos-flow-test.c index 7616e51a9..83aba5cca 100644 --- a/tests/vonr/qos-flow-test.c +++ b/tests/vonr/qos-flow-test.c @@ -42,88 +42,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out icmp from any to assigned\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -151,8 +70,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -174,33 +93,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_qos_flow(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -497,13 +392,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/tests/vonr/session-test.c b/tests/vonr/session-test.c index b267aae99..c75a3b57c 100644 --- a/tests/vonr/session-test.c +++ b/tests/vonr/session-test.c @@ -42,105 +42,7 @@ static void test1_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -168,8 +70,8 @@ static void test1_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -191,33 +93,9 @@ static void test1_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -586,13 +464,7 @@ static void test1_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -627,105 +499,7 @@ static void test2_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -753,8 +527,8 @@ static void test2_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -776,33 +550,9 @@ static void test2_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1133,13 +883,7 @@ static void test2_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1174,105 +918,7 @@ static void test3_func(abts_case *tc, void *data) test_sess_t *sess = NULL; test_bearer_t *qos_flow = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1300,8 +946,8 @@ static void test3_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -1323,33 +969,9 @@ static void test3_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -1666,13 +1288,7 @@ static void test3_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -1707,105 +1323,7 @@ static void test4_func(abts_case *tc, void *data) test_sess_t *sess5 = NULL, *sess6 = NULL; test_bearer_t *qos_flow1 = NULL, *qos_flow2 = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}," - "{" - "\"apn\" : \"ims\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 6, " - "\"arp\" : { " - "\"priority_level\" : 6," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2," - "\"pcc_rule\" : [" - "{" - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2d\" }," - "\"qos\" : {" - "\"qci\" : 1," - "\"gbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"mbr\" : {" - "\"downlink\" : { \"$numberLong\" : \"64\" }," - "\"uplink\" : { \"$numberLong\" : \"44\" }" - "}," - "\"arp\" : {" - "\"priority_level\" : 3," - "\"pre_emption_vulnerability\" : 0," - "\"pre_emption_capability\" : 0 }" - "}," - "\"flow\" : [" - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23454 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd31\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50020\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd30\" } }," - "{ \"direction\" : 2," - "\"description\" : \"permit out udp from 10.200.136.98/32 23455 to assigned 1-65535\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2f\" } }," - "{ \"direction\" : 1," - "\"description\" : \"permit out udp from 10.200.136.98/32 1-65535 to assigned 50021\"," - "\"_id\" : { \"$oid\" : \"599eb929c850caabcbfdcd2e\" } }" - "]" - "}" - "]" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -1833,8 +1351,8 @@ static void test4_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -1856,33 +1374,9 @@ static void test4_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_session(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -2126,13 +1620,7 @@ static void test4_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -2167,54 +1655,7 @@ static void test5_func(abts_case *tc, void *data) test_sess_t *sess5 = NULL, *sess6 = NULL; test_bearer_t *qos_flow1 = NULL, *qos_flow2 = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -2242,8 +1683,8 @@ static void test5_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -2265,33 +1706,9 @@ static void test5_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -2464,100 +1881,10 @@ static void test5_func(abts_case *tc, void *data) rv = testgnb_ngap_send(ngap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); -#if 0 - /* Send PDU session establishment request */ - sess5 = test_sess_add_by_dnn_and_psi(test_ue, "ims", 5); - ogs_assert(sess5); - - sess5->ul_nas_transport_param.request_type = - OGS_NAS_5GS_REQUEST_TYPE_INITIAL; - sess5->ul_nas_transport_param.dnn = 1; - sess5->ul_nas_transport_param.s_nssai = 1; - - gsmbuf = testgsm_build_pdu_session_establishment_request(sess5); - ABTS_PTR_NOTNULL(tc, gsmbuf); - gmmbuf = testgmm_build_ul_nas_transport(sess5, - OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); - ABTS_PTR_NOTNULL(tc, gmmbuf); - sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); - ABTS_PTR_NOTNULL(tc, sendbuf); - rv = testgnb_ngap_send(ngap, sendbuf); - ABTS_INT_EQUAL(tc, OGS_OK, rv); - - /* Receive PDU session establishment reject */ - recvbuf = testgnb_ngap_read(ngap); - ABTS_PTR_NOTNULL(tc, recvbuf); - testngap_recv(test_ue, recvbuf); - - /* Test Session Remove */ - test_sess_remove(sess5); - - /* Send PDU session establishment request */ - sess6 = test_sess_add_by_dnn_and_psi(test_ue, "internet", 6); - ogs_assert(sess6); - - sess6->ul_nas_transport_param.request_type = - OGS_NAS_5GS_REQUEST_TYPE_INITIAL; - sess6->ul_nas_transport_param.dnn = 1; - sess6->ul_nas_transport_param.s_nssai = 1; - - gsmbuf = testgsm_build_pdu_session_establishment_request(sess6); - ABTS_PTR_NOTNULL(tc, gsmbuf); - gmmbuf = testgmm_build_ul_nas_transport(sess6, - OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, gsmbuf); - ABTS_PTR_NOTNULL(tc, gmmbuf); - sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); - ABTS_PTR_NOTNULL(tc, sendbuf); - rv = testgnb_ngap_send(ngap, sendbuf); - ABTS_INT_EQUAL(tc, OGS_OK, rv); -#endif - -#if 0 - /* Receive PDUSessionResourceSetupRequest + - * DL NAS transport + - * PDU session establishment accept */ - recvbuf = testgnb_ngap_read(ngap); - ABTS_PTR_NOTNULL(tc, recvbuf); - testngap_recv(test_ue, recvbuf); - ABTS_INT_EQUAL(tc, - NGAP_ProcedureCode_id_PDUSessionResourceSetup, - test_ue->ngap_procedure_code); -#endif - -#if 0 - /* Send UEContextReleaseRequest */ - sendbuf = testngap_build_ue_context_release_request(test_ue, - NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity, - true); - ABTS_PTR_NOTNULL(tc, sendbuf); - rv = testgnb_ngap_send(ngap, sendbuf); - ABTS_INT_EQUAL(tc, OGS_OK, rv); - - /* Receive UEContextReleaseCommand */ - recvbuf = testgnb_ngap_read(ngap); - ABTS_PTR_NOTNULL(tc, recvbuf); - testngap_recv(test_ue, recvbuf); - ABTS_INT_EQUAL(tc, - NGAP_ProcedureCode_id_UEContextRelease, - test_ue->ngap_procedure_code); - - /* Send UEContextReleaseComplete */ - sendbuf = testngap_build_ue_context_release_complete(test_ue); - ABTS_PTR_NOTNULL(tc, sendbuf); - rv = testgnb_ngap_send(ngap, sendbuf); - ABTS_INT_EQUAL(tc, OGS_OK, rv); -#endif - ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); @@ -2592,54 +1919,7 @@ static void test6_func(abts_case *tc, void *data) test_sess_t *sess5 = NULL, *sess6 = NULL; test_bearer_t *qos_flow1 = NULL, *qos_flow2 = NULL; - const char *_k_string = "70d49a71dd1a2b806a25abe0ef749f1e"; - uint8_t k[OGS_KEY_LEN]; - const char *_opc_string = "6f1bf53d624b3a43af6592854e2444c7"; - uint8_t opc[OGS_KEY_LEN]; - - mongoc_collection_t *collection = NULL; bson_t *doc = NULL; - int64_t count = 0; - bson_error_t error; - const char *json = - "{" - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c6\" }, " - "\"imsi\" : \"901700000021309\"," - "\"ambr\" : { " - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"pdn\" : [" - "{" - "\"apn\" : \"internet\", " - "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " - "\"ambr\" : {" - "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " - "\"downlink\" : { \"$numberLong\" : \"1024000\" } " - "}," - "\"qos\" : { " - "\"qci\" : 9, " - "\"arp\" : { " - "\"priority_level\" : 8," - "\"pre_emption_vulnerability\" : 1, " - "\"pre_emption_capability\" : 1" - "} " - "}, " - "\"type\" : 2" - "}" - "]," - "\"security\" : { " - "\"k\" : \"70d49a71dd1a2b806a25abe0ef749f1e\", " - "\"opc\" : \"6f1bf53d624b3a43af6592854e2444c7\", " - "\"amf\" : \"8000\", " - "\"sqn\" : { \"$numberLong\" : \"25235952177090\" } " - "}, " - "\"subscribed_rau_tau_timer\" : 12," - "\"network_access_mode\" : 2, " - "\"subscriber_status\" : 0, " - "\"access_restriction_data\" : 32, " - "\"__v\" : 0 " - "}"; /* Setup Test UE & Session Context */ memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); @@ -2667,8 +1947,8 @@ static void test6_func(abts_case *tc, void *data) test_ue->nas.registration.follow_on_request = 1; test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; - OGS_HEX(_k_string, strlen(_k_string), test_ue->k); - OGS_HEX(_opc_string, strlen(_opc_string), test_ue->opc); + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; /* gNB connects to AMF */ ngap = testngap_client(AF_INET); @@ -2690,33 +1970,9 @@ static void test6_func(abts_case *tc, void *data) testngap_recv(test_ue, recvbuf); /********** Insert Subscriber in Database */ - collection = mongoc_client_get_collection( - ogs_mongoc()->client, ogs_mongoc()->name, "subscribers"); - ABTS_PTR_NOTNULL(tc, collection); - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); + doc = test_db_new_simple(test_ue); ABTS_PTR_NOTNULL(tc, doc); - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - if (count) { - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - } - bson_destroy(doc); - - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_insert(collection, - MONGOC_INSERT_NONE, doc, NULL, &error)); - bson_destroy(doc); - - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - do { - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); - } while (count == 0); - bson_destroy(doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); /* Send Registration request */ test_ue->registration_request_param.guti = 1; @@ -2951,13 +2207,7 @@ static void test6_func(abts_case *tc, void *data) ogs_msleep(300); /********** Remove Subscriber in Database */ - doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi)); - ABTS_PTR_NOTNULL(tc, doc); - ABTS_TRUE(tc, mongoc_collection_remove(collection, - MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) - bson_destroy(doc); - - mongoc_collection_destroy(collection); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue)); /* gNB disonncect from UPF */ testgnb_gtpu_close(gtpu); diff --git a/webui/package-lock.json b/webui/package-lock.json index 5f4384543..f1b94c6d5 100644 --- a/webui/package-lock.json +++ b/webui/package-lock.json @@ -1,6 +1,6 @@ { "name": "open5gs", - "version": "2.0.19", + "version": "2.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/webui/package.json b/webui/package.json index cd9dd738a..78815d0e4 100644 --- a/webui/package.json +++ b/webui/package.json @@ -1,6 +1,6 @@ { "name": "open5gs", - "version": "2.0.19", + "version": "2.2.0", "description": "Open5gs", "main": "index.js", "repository": "https://github.com/open5gs/open5gs/webui", diff --git a/webui/server/models/profile.js b/webui/server/models/profile.js index 70726867e..d5a496a4a 100644 --- a/webui/server/models/profile.js +++ b/webui/server/models/profile.js @@ -3,6 +3,12 @@ const Schema = mongoose.Schema; require('mongoose-long')(mongoose); const Profile = new Schema({ + + schema_version: { + $type: Number, + default: 1 // Current Schema Version + }, + title: { $type: String, required: true }, security: { @@ -13,64 +19,59 @@ const Profile = new Schema({ }, ambr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } }, - pdn: [{ - apn: { $type: String, required: true }, - type: { - $type: Number, default: 2 // IPv4, IPv6 and dualstack IPv4v6 - }, - qos: { - qci: Number, - arp: { - priority_level: Number, - pre_emption_capability: { - $type: Number, default: 1 // Capability Disabled - }, - pre_emption_vulnerability: { - $type : Number, default: 1 // Vulnerability Disabled - } - } - }, - ambr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long - }, - ue: { - addr: String, - addr6: String - }, - pgw: { - addr: String, - addr6: String - }, - pcc_rule: [{ - flow: [{ - direction: Number, - description: String - }], + slice: [{ + sst: { $type: Number, required: true }, + sd: String, + default_indicator: Boolean, + session: [{ + name: { $type: String, required: true }, // DNN or APN + type: Number, qos: { - qci: Number, + index: Number, // 5QI or QCI arp: { priority_level: Number, - pre_emption_capability: { - $type: Number, default: 1 // Capability Disabled - }, - pre_emption_vulnerability: { - $type : Number, default: 1 // Vulnerability Disabled - } - }, - mbr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long - }, - gbr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long - }, + pre_emption_capability: Number, + pre_emption_vulnerability: Number, + } }, + ambr: { + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } + }, + ue: { + addr: String, + addr6: String + }, + smf: { + addr: String, + addr6: String + }, + pcc_rule: [{ + flow: [{ + direction: Number, + description: String + }], + qos: { + index: Number, + arp: { + priority_level: Number, + pre_emption_capability: Number, + pre_emption_vulnerability: Number, + }, + mbr: { + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } + }, + gbr: { + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } + }, + }, + }] }] }] }, { typeKey: '$type' }); diff --git a/webui/server/models/subscriber.js b/webui/server/models/subscriber.js index da74c7b8b..3f03d2473 100644 --- a/webui/server/models/subscriber.js +++ b/webui/server/models/subscriber.js @@ -3,6 +3,12 @@ const Schema = mongoose.Schema; require('mongoose-long')(mongoose); const Subscriber = new Schema({ + + schema_version: { + $type: Number, + default: 1 // Current Schema Version + }, + imsi: { $type: String, unique: true, required: true }, security: { @@ -14,11 +20,68 @@ const Subscriber = new Schema({ sqn: Schema.Types.Long }, - access_restriction_data: { - $type: Number, + ambr: { + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } + }, + + slice: [{ + sst: { $type: Number, required: true }, + sd: String, + default_indicator: Boolean, + session: [{ + name: { $type: String, required: true }, // DNN or APN + type: Number, + qos: { + index: Number, // 5QI or QCI + arp: { + priority_level: Number, + pre_emption_capability: Number, + pre_emption_vulnerability: Number, + } + }, + ambr: { + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } + }, + ue: { + addr: String, + addr6: String + }, + smf: { + addr: String, + addr6: String + }, + pcc_rule: [{ + flow: [{ + direction: Number, + description: String + }], + qos: { + index: Number, // 5QI or QCI + arp: { + priority_level: Number, + pre_emption_capability: Number, + pre_emption_vulnerability: Number, + }, + mbr: { + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } + }, + gbr: { + downlink: { value: Number, unit: Number }, + uplink: { value: Number, unit: Number } + }, + }, + }] + }] + }], + + access_restriction_data: { + $type: Number, default: 32 // Handover to Non-3GPP Access Not Allowed }, - subscriber_status: { + subscriber_status: { $type: Number, default: 0 // Service Granted }, @@ -26,73 +89,11 @@ const Subscriber = new Schema({ $type: Number, default: 2 // Only Packet }, - subscribed_rau_tau_timer: { $type: Number, default: 12 // minites - }, + } - ambr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long - }, - - pdn: [{ - apn: { $type: String, required: true }, - type: { - $type: Number, default: 2 // IPv4, IPv6 and dualstack IPv4v6 - }, - qos: { - qci: Number, - arp: { - priority_level: Number, - pre_emption_capability: { - $type: Number, default: 1 // Capability Disabled - }, - pre_emption_vulnerability: { - $type : Number, default: 0 // Vulnerability Disabled - } - } - }, - ambr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long - }, - ue: { - addr: String, - addr6: String - }, - pgw: { - addr: String, - addr6: String - }, - pcc_rule: [{ - flow: [{ - direction: Number, - description: String - }], - qos: { - qci: Number, - arp: { - priority_level: Number, - pre_emption_capability: { - $type: Number, default: 1 // Capability Disabled - }, - pre_emption_vulnerability: { - $type : Number, default: 0 // Vulnerability Disabled - } - }, - mbr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long - }, - gbr: { - downlink: Schema.Types.Long, - uplink: Schema.Types.Long - }, - }, - }] - }] }, { typeKey: '$type' }); module.exports = mongoose.model('Subscriber', Subscriber); diff --git a/webui/src/components/Profile/Edit.js b/webui/src/components/Profile/Edit.js index 2330f4980..282495317 100644 --- a/webui/src/components/Profile/Edit.js +++ b/webui/src/components/Profile/Edit.js @@ -59,178 +59,108 @@ const schema = { "title": "", "properties": { "downlink": { - "type": "number", - "title": "UE-AMBR Downlink (Kbps)*", - "required": true + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "UE-AMBR Downlink*", + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } }, "uplink": { - "type": "number", - "title": "UE-AMBR Uplink (Kbps)*", - "required": true + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "UE-AMBR Uplink*", + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } } } }, - "pdn": { + "slice": { "type": "array", - "title": "APN Configurations", + "title": "Slice Configurations", "minItems": 1, - "maxItems": 4, + "maxItems": 8, "messages": { - "minItems": "At least 1 APN is required", - "maxItems": "4 APNs are supported" + "minItems": "At least 1 Slice is required", + "maxItems": "8 Slices are supported" }, "items": { "type": "object", "properties": { - "apn": { - "type": "string", - "title": "Access Point Name (APN)*", + "sst": { + "type": "number", + "title": "SST*", + "enum": [ 1, 2, 3, 4 ], "required": true }, - "type": { - "type": "number", - "title": "Type*", - "enum": [0, 1, 2], - "enumNames": ["IPv4", "IPv6", "IPv4v6"], - "default": 2, - }, - "qos": { - "type": "object", - "title": "", - "properties": { - "qci": { - "type": "number", - "title": "QoS Class Identifier (QCI)*", - "enum": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 65, 66, 69, 70 ], - "default": 5, - }, - "arp" : { - "type": "object", - "title": "", - "properties": { - "priority_level": { - "type": "number", - "title": "ARP Priority Level (1-15)*", - "default": 1, - "minimum": 1, - "maximum": 15, - "required": true - }, - "pre_emption_capability": { - "type": "number", - "title": "Capability*", - "enum": [1, 0], - "enumNames": ["Disabled", "Enabled"], - "default": 1, - }, - "pre_emption_vulnerability": { - "type": "number", - "title": "Vulnerability*", - "enum": [1, 0], - "enumNames": ["Disabled", "Enabled"], - "default": 1, - }, - } - } - } - }, - "ambr": { - "type": "object", - "title": "", - "properties": { - "downlink": { - "type": "number", - "title": "APN-AMBR Downlink (Kbps)*", - "required": true - }, - "uplink": { - "type": "number", - "title": "APN-AMBR Uplink (Kbps)*", - "required": true - }, - } - }, - "ue": { - "type": "object", - "title": "", - "properties": { - "addr": { - "type": "string", - "title": "UE IPv4 Address", - "format" : "ipv4" - }, - "addr6": { - "type": "string", - "title": "UE IPv6 Address", - "format" : "ipv6" - }, - } - }, - "pgw": { - "type": "object", - "title": "", - "properties": { - "addr": { - "type": "string", - "title": "PGW IPv4 Address", - "format" : "ipv4" - }, - "addr6": { - "type": "string", - "title": "PGW IPv6 Address", - "format" : "ipv6" - }, - } - }, - "pcc_rule": { - "type": "array", - "title": "PCC Rules", - "maxItems": 8, + "sd": { + "type": "string", + "title": "SD", + "pattern": "^[0-9a-fA-F]+$", + "minLength": 6, + "maxLength": 6, "messages": { - "maxItems": "8 PCC Rules are supported" + "pattern": "Only hexadecimal digits are allowed" + } + }, + "default_indicator": { + "type": "boolean", + "title": "Default S-NSSAI", + }, + "session": { + "type": "array", + "title": "Session Configurations", + "minItems": 1, + "maxItems": 4, + "messages": { + "minItems": "At least 1 Session is required", + "maxItems": "4 Sessions are supported" }, "items": { "type": "object", "properties": { - "flow": { - "type": "array", - "title": "", - "maxItems": 8, - "messages": { - "maxItems": "8 Flows are supported" - }, - "items": { - "type": "object", - "properties": { - "direction": { - "type": "number", - "title": "Flow Direction*", - "enum": [1, 2], - "enumNames": ["Downlink", "Uplink"], - "default": 1, - }, - "description": { - "type": "string", - "title": "Description*", - "default": "permit out udp from any 1-65535 to 45.45.45.45", - "required": true, - "pattern": "^permit\\s+out", - "messages": { - "pattern": "Begin with reserved keyword 'permit out'." - } - } - } - } + "name": { + "type": "string", + "title": "DNN/APN*", + "required": true + }, + "type": { + "type": "number", + "title": "Type*", + "enum": [1, 2, 3], + "enumNames": ["IPv4", "IPv6", "IPv4v6"], + "default": 3, }, "qos": { "type": "object", "title": "", "properties": { - "qci": { + "index": { "type": "number", - "title": "QoS Class Identifier (QCI)*", - "enum": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 65, 66, 69, 70 ], - "default": 1, + "title": "5QI/QCI*", + "enum": [ 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 ], + "default": 5, }, "arp" : { "type": "object", @@ -239,69 +169,264 @@ const schema = { "priority_level": { "type": "number", "title": "ARP Priority Level (1-15)*", - "default": 2, - "minimum": 1, - "maximum": 15, - "required": true + "enum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + "default": 1, }, - // 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 "pre_emption_capability": { "type": "number", "title": "Capability*", - "enum": [1, 0], + "enum": [1, 2], "enumNames": ["Disabled", "Enabled"], - "default": 0, + "default": 1 }, "pre_emption_vulnerability": { "type": "number", "title": "Vulnerability*", - "enum": [1, 0], + "enum": [1, 2], "enumNames": ["Disabled", "Enabled"], - "default": 0, + "default": 1 }, } - }, - "mbr": { - "type": "object", - "title": "", - "properties": { - "downlink": { - "type": "number", - "title": "MBR Downlink (Kbps)", - }, - "uplink": { - "type": "number", - "title": "MBR Uplink (Kbps)", - }, - } - }, - "gbr": { - "type": "object", - "title": "", - "properties": { - "downlink": { - "type": "number", - "title": "GBR Downlink (Kbps)", - }, - "uplink": { - "type": "number", - "title": "GBR Uplink (Kbps)", - }, - } - }, - }, + } + } }, + "ambr": { + "type": "object", + "title": "", + "properties": { + "downlink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "Session-AMBR Downlink*", + "default": 1, + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } + }, + "uplink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "Session-AMBR Uplink*", + "default": 1, + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } + } + } + }, + "ue": { + "type": "object", + "title": "", + "properties": { + "addr": { + "type": "string", + "title": "UE IPv4 Address", + "format" : "ipv4" + }, + "addr6": { + "type": "string", + "title": "UE IPv6 Address", + "format" : "ipv6" + }, + } + }, + "smf": { + "type": "object", + "title": "", + "properties": { + "addr": { + "type": "string", + "title": "SMF IPv4 Address", + "format" : "ipv4" + }, + "addr6": { + "type": "string", + "title": "SMF IPv6 Address", + "format" : "ipv6" + }, + } + }, + "pcc_rule": { + "type": "array", + "title": "PCC Rules", + "maxItems": 8, + "messages": { + "maxItems": "8 PCC Rules are supported" + }, + "items": { + "type": "object", + "properties": { + "flow": { + "type": "array", + "title": "", + "maxItems": 8, + "messages": { + "maxItems": "8 Flows are supported" + }, + "items": { + "type": "object", + "properties": { + "direction": { + "type": "number", + "title": "Flow Direction*", + "enum": [1, 2], + "enumNames": ["Downlink", "Uplink"], + "default": 1, + }, + "description": { + "type": "string", + "title": "Description*", + "default": "permit out udp from any 1-65535 to 45.45.45.45", + "required": true, + "pattern": "^permit\\s+out", + "messages": { + "pattern": "Begin with reserved keyword 'permit out'." + } + } + } + } + }, + "qos": { + "type": "object", + "title": "", + "properties": { + "index": { + "type": "number", + "title": "5QI/QCI*", + "enum": [ 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 ], + "default": 1, + }, + "arp" : { + "type": "object", + "title": "", + "properties": { + "priority_level": { + "type": "number", + "title": "ARP Priority Level (1-15)*", + "enum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + "default": 2, + }, + "pre_emption_capability": { + "type": "number", + "title": "Capability*", + "enum": [1, 2], + "enumNames": ["Disabled", "Enabled"], + "default": 2, + }, + "pre_emption_vulnerability": { + "type": "number", + "title": "Vulnerability*", + "enum": [1, 2], + "enumNames": ["Disabled", "Enabled"], + "default": 2, + }, + } + }, + "mbr": { + "type": "object", + "title": "", + "properties": { + "downlink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "MBR Downlink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + }, + "uplink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "MBR Uplink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + } + } + }, + "gbr": { + "type": "object", + "title": "", + "properties": { + "downlink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "GBR Downlink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + }, + "uplink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "GBR Uplink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + } + } + }, + }, + }, + } + } + } } } } @@ -330,114 +455,161 @@ const uiSchema = { }, }, "ambr" : { - "downlink" : { - classNames: "col-xs-6" - }, - "uplink" : { - classNames: "col-xs-6" - }, - }, - "pdn": { - "items": { - "apn": { + "downlink": { + classNames: "col-xs-6", + "value": { classNames: "col-xs-8", }, - "type": { + "unit": { classNames: "col-xs-4", }, - "qos": { - classNames: "col-xs-12", - "qci": { - "ui:widget": "radio", - "ui:options": { - "inline": true - }, - }, - "arp": { - "priority_level": { - classNames: "col-xs-6" - }, - "pre_emption_capability": { - classNames: "col-xs-3" - }, - "pre_emption_vulnerability": { - classNames: "col-xs-3" - } - } + }, + "uplink": { + classNames: "col-xs-6", + "value": { + classNames: "col-xs-8", }, - "ambr" : { - classNames: "col-xs-12", - "downlink" : { - classNames: "col-xs-6" - }, - "uplink" : { - classNames: "col-xs-6" - }, + "unit": { + classNames: "col-xs-4", }, - "ue" : { - classNames: "col-xs-12", - "addr" : { - classNames: "col-xs-6" - }, - "addr6" : { - classNames: "col-xs-6" - }, + } + }, + "slice": { + "items": { + "sst": { + classNames: "col-xs-3", + "ui:widget": "radio", + "ui:options": { "inline": true }, }, - "pgw" : { - classNames: "col-xs-12", - "addr" : { - classNames: "col-xs-6" - }, - "addr6" : { - classNames: "col-xs-6" - }, + "sd": { + classNames: "col-xs-6", }, - "pcc_rule": { + "default_indicator": { + classNames: "col-xs-3", + }, + "session": { classNames: "col-xs-12", "items": { - "flow": { - "items": { - "direction": { - classNames: "col-xs-12" - }, - "description": { - classNames: "col-xs-12", - "ui:help": "Hint: Flow-Description(TS29.212), IPFilterRule(RFC 3588)", - }, - }, + "name": { + classNames: "col-xs-8", + }, + "type": { + classNames: "col-xs-4", }, "qos": { - "qci": { - "ui:widget": "radio", - "ui:options": { - "inline": true - }, + classNames: "col-xs-12", + "index": { }, "arp": { "priority_level": { - classNames: "col-xs-6" }, "pre_emption_capability": { - classNames: "col-xs-3" + classNames: "col-xs-6" }, "pre_emption_vulnerability": { - classNames: "col-xs-3" - } - }, - "mbr": { - "downlink": { - classNames: "col-xs-6" - }, - "uplink": { classNames: "col-xs-6" } - }, - "gbr": { - "downlink": { - classNames: "col-xs-6" + } + }, + "ambr" : { + classNames: "col-xs-12", + "downlink": { + "value": { + classNames: "col-xs-8" }, - "uplink": { - classNames: "col-xs-6" + "unit": { + classNames: "col-xs-4" + }, + }, + "uplink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + }, + }, + "ue" : { + classNames: "col-xs-12", + "addr" : { + classNames: "col-xs-6" + }, + "addr6" : { + classNames: "col-xs-6" + }, + }, + "smf" : { + classNames: "col-xs-12", + "addr" : { + classNames: "col-xs-6" + }, + "addr6" : { + classNames: "col-xs-6" + }, + }, + "pcc_rule": { + classNames: "col-xs-12", + "items": { + "flow": { + "items": { + "direction": { + }, + "description": { + "ui:help": "Hint: 5.4.2 Flow-Description in TS29.212", + }, + }, + }, + "qos": { + "index": { + }, + "arp": { + "priority_level": { + classNames: "col-xs-12" + }, + "pre_emption_capability": { + classNames: "col-xs-6" + }, + "pre_emption_vulnerability": { + classNames: "col-xs-6" + } + }, + "mbr": { + "downlink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + }, + "uplink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + } + }, + "gbr": { + "downlink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + }, + "uplink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + } + } } } } diff --git a/webui/src/components/Profile/Item.js b/webui/src/components/Profile/Item.js index 8c18819fe..68a1cb12f 100644 --- a/webui/src/components/Profile/Item.js +++ b/webui/src/components/Profile/Item.js @@ -82,7 +82,7 @@ const Profile = styled.div` color: ${oc.gray[6]}; width: 240px; } - .apn { + .name { font-size: 1.1rem; color: ${oc.gray[6]}; width: 120px; @@ -166,7 +166,7 @@ class Item extends Component { const { _id, title, - pdn, + slice, ambr } = profile; @@ -174,8 +174,30 @@ class Item extends Component { onView(_id)}>
{title}
-
{ambr.downlink}/{ambr.uplink}
-
{pdn[0].apn}
+
+ {ambr['downlink'] === undefined ? "unlimited" : + ambr.downlink['value'] === undefined ? "unlimited" : + ambr.downlink.value + } {ambr['downlink'] === undefined ? "unlimited" : + ambr.downlink['unit'] === undefined ? "bps" : + ambr.downlink.unit === 0 ? "bps" : + ambr.downlink.unit === 1 ? "Kbps" : + ambr.downlink.unit === 2 ? "Mbps" : + ambr.downlink.unit === 3 ? "Gbps" : + ambr.downlink.unit === 4 ? "Tbps" : + "Unknown Unit" + } / {ambr['uplink'] === undefined ? "unlimited" : + ambr.uplink['value'] === undefined ? "unlimited" : + ambr.uplink.value + } {ambr['uplink'] === undefined ? "unlimited" : + ambr.uplink['unit'] === undefined ? "bps" : + ambr.uplink.unit === 0 ? "bps" : + ambr.uplink.unit === 1 ? "Kbps" : + ambr.uplink.unit === 2 ? "Mbps" : + ambr.uplink.unit === 3 ? "Gbps" : + ambr.uplink.unit === 4 ? "Tbps" : + "Unknown Unit" } +
diff --git a/webui/src/components/Profile/View.js b/webui/src/components/Profile/View.js index a04ee19a0..38e423a33 100644 --- a/webui/src/components/Profile/View.js +++ b/webui/src/components/Profile/View.js @@ -163,12 +163,12 @@ const View = ({ visible, disableOnClickOutside, profile, onEdit, onDelete, onHid const title = (profile || {}).title; const security = ((profile || {}).security || {}); const ambr = ((profile || {}).ambr || {}); - const pdns = ((profile || {}).pdn || []); + const slice_list = ((profile || {}).slice || []); return (
- @@ -230,115 +230,281 @@ const View = ({ visible, disableOnClickOutside, profile, onEdit, onDelete, onHid
- {ambr.downlink} Kbps + {ambr['downlink'] === undefined ? "unlimited" : + ambr.downlink['value'] === undefined ? "unlimited" : + ambr.downlink.value + } {ambr['downlink'] === undefined ? "unlimited" : + ambr.downlink['value'] === undefined ? "" : + ambr.downlink['unit'] === undefined ? "bps" : + ambr.downlink.unit === 0 ? "bps" : + ambr.downlink.unit === 1 ? "Kbps" : + ambr.downlink.unit === 2 ? "Mbps" : + ambr.downlink.unit === 3 ? "Gbps" : + ambr.downlink.unit === 4 ? "Tbps" : + "Unknown Unit" } UL
- {ambr.uplink} Kbps + {ambr['uplink'] === undefined ? "unlimited" : + ambr.uplink['value'] === undefined ? "unlimited" : + ambr.uplink.value + } {ambr['uplink'] === undefined ? "unlimited" : + ambr.uplink['value'] === undefined ? "" : + ambr.uplink['unit'] === undefined ? "bps" : + ambr.uplink.unit === 0 ? "bps" : + ambr.uplink.unit === 1 ? "Kbps" : + ambr.uplink.unit === 2 ? "Mbps" : + ambr.uplink.unit === 3 ? "Gbps" : + ambr.uplink.unit === 4 ? "Tbps" : + "Unknown Unit" } DL
-
- APN Configrations -
-
-
APN
-
Type
-
QCI
-
ARP
-
Capability
-
Vulnerablility
-
MBR DL/UL(Kbps)
-
GBR DL/UL(Kbps)
-
- {pdns.map(pdn => -
-
-
{pdn.apn}
-
{pdn.type === 0 ? "IPv4" : (pdn.type === 1 ? "IPv6" : "IPv4v6")}
-
{pdn.qos.qci}
-
{pdn.qos.arp.priority_level}
-
{pdn.qos.arp.pre_emption_capability === 1 ? "Disabled" : "Enabled"}
-
{pdn.qos.arp.pre_emption_vulnerability === 1 ? "Disabled" : "Enabled"}
- {pdn['ambr'] === undefined ? -
- unlimited/unlimited -
: -
- {pdn.ambr['downlink'] === undefined ? "unlimited" : pdn.ambr.downlink} - / - {pdn.ambr['uplink'] === undefined ? "unlimited" : pdn.ambr.uplink} -
- } -
+ {slice_list.map((slice, index) => +
+ {slice.sd === undefined ? +
+ SST:{slice.sst} {slice.default_indicator == + true ? "(Default S-NSSAI)" : ""} +
: +
+ SST:{slice.sst} SD:{slice.sd} {slice.default_indicator == + true ? "(Default S-NSSAI)" : ""} +
+ } +
+
DNN/APN
+
Type
+
5QI/QCI
+
ARP
+
Capability
+
Vulnerablility
+
MBR DL/UL
+
GBR DL/UL
- {pdn['ue'] !== undefined && -
-
-
{"UE IPv4"}
-
{(pdn.ue || {}).addr}
-
{"UE IPv6"}
-
{(pdn.ue || {}).addr6}
-
- } - {pdn['pgw'] !== undefined && -
-
-
{"PGW IPv4"}
-
{(pdn.pgw || {}).addr}
-
{"PGW IPv6"}
-
{(pdn.pgw || {}).addr6}
-
- } - {pdn['pcc_rule'] !== undefined && - pdn.pcc_rule.map((pcc_rule, index) => -
+ {slice['session'] !== undefined && + slice.session.map(session => +
+
+
{session.name}
+
{ + session.type === 1 ? "IPv4" : + session.type === 2 ? "IPv6" : + session.type === 3 ? "IPv4v6" : + "Unknown" + }
+
{session.qos.index}
+
{session.qos.arp.priority_level}
+
+ {session.qos.arp.pre_emption_capability === + 2 ? "Enabled" : + session.qos.arp.pre_emption_capability === + 1 ? "Disabled" : "Unknown"} +
+
+ {session.qos.arp.pre_emption_vulnerability === + 2 ? "Enabled" : + session.qos.arp.pre_emption_vulnerability === + 1 ? "Disabled" : "Unknown"} +
+ {session['ambr'] === undefined ? +
+ unlimited/unlimited +
: +
+ {session.ambr['downlink'] === undefined ? "unlimited" : + session.ambr.downlink['value'] === undefined ? + "unlimited" : session.ambr.downlink.value + } {session.ambr['downlink'] === undefined ? + "unlimited" : + session.ambr.downlink['value'] === + undefined ? "" : + session.ambr.downlink['unit'] === + undefined ? "bps" : + session.ambr.downlink.unit === 0 ? "bps" : + session.ambr.downlink.unit === 1 ? "Kbps" : + session.ambr.downlink.unit === 2 ? "Mbps" : + session.ambr.downlink.unit === 3 ? "Gbps" : + session.ambr.downlink.unit === 4 ? "Tbps" : + "Unknown Unit" + } / {session.ambr['uplink'] === + undefined ? "unlimited" : + session.ambr.uplink['value'] === undefined ? + "unlimited" : session.ambr.uplink.value + } {session.ambr['uplink'] === undefined ? + "unlimited" : + session.ambr.uplink['value'] === + undefined ? "" : + session.ambr.uplink['unit'] === + undefined ? "bps" : + session.ambr.uplink.unit === 0 ? "bps" : + session.ambr.uplink.unit === 1 ? "Kbps" : + session.ambr.uplink.unit === 2 ? "Mbps" : + session.ambr.uplink.unit === 3 ? "Gbps" : + session.ambr.uplink.unit === 4 ? "Tbps" : + "Unknown Unit" + } +
+ } +
+
+ {session['ue'] !== undefined &&
-
-
{pcc_rule.qos.qci}
-
{pcc_rule.qos.arp.priority_level}
-
{pcc_rule.qos.arp.pre_emption_capability === 1 ? "Disabled" : "Enabled"}
-
{pcc_rule.qos.arp.pre_emption_vulnerability === 1 ? "Disabled" : "Enabled"}
- {pcc_rule.qos['mbr'] === undefined ? -
- unlimited/unlimited -
: -
- {pcc_rule.qos.mbr['downlink'] === undefined ? "unlimited" : pcc_rule.qos.mbr.downlink} - / - {pcc_rule.qos.mbr['uplink'] === undefined ? "unlimited" : pcc_rule.qos.mbr.uplink} -
- } - {pcc_rule.qos['gbr'] === undefined ? -
- unlimited/unlimited -
: -
- {pcc_rule.qos.gbr['downlink'] === undefined ? "unlimited" : pcc_rule.qos.gbr.downlink} - / - {pcc_rule.qos.gbr['uplink'] === undefined ? "unlimited" : pcc_rule.qos.gbr.uplink} -
- } +
{"UE IPv4"}
+
{(session.ue || {}).addr}
+
{"UE IPv6"}
+
{(session.ue || {}).addr6}
- {pcc_rule['flow'] !== undefined && - pcc_rule.flow.map((flow, index) => -
+ } + {session['smf'] !== undefined && +
+
+
{"SMF IPv4"}
+
{(session.smf || {}).addr}
+
{"SMF IPv6"}
+
{(session.smf || {}).addr6}
+
+ } + {session['pcc_rule'] !== undefined && + session.pcc_rule.map((pcc_rule, index) => +
+
-
- {flow.direction == 1 && "Downlink"} - {flow.direction == 2 && "Uplink"} +
+
{pcc_rule.qos.index}
+
{pcc_rule.qos.arp.priority_level}
+
+ {pcc_rule.qos.arp.pre_emption_capability === + 2 ? "Enabled" : + pcc_rule.qos.arp.pre_emption_capability === + 1 ? "Disabled" : "Unknown"}
-
{flow.description}
+
+ {pcc_rule.qos.arp.pre_emption_vulnerability === + 2 ? "Enabled" : + pcc_rule.qos.arp.pre_emption_vulnerability === + 1 ? "Disabled" : "Unknown"} +
+ {pcc_rule.qos['mbr'] === undefined ? +
+ unlimited/unlimited +
: +
+ {pcc_rule.qos.mbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.downlink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.downlink.value + } {pcc_rule.qos.mbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.downlink['value'] === + undefined ? "" : + pcc_rule.qos.mbr.downlink['unit'] === + undefined ? "bps" : + pcc_rule.qos.mbr.downlink.unit === 0 ? + "bps" : + pcc_rule.qos.mbr.downlink.unit === 1 ? + "Kbps" : + pcc_rule.qos.mbr.downlink.unit === 2 ? + "Mbps" : + pcc_rule.qos.mbr.downlink.unit === 3 ? + "Gbps" : + pcc_rule.qos.mbr.downlink.unit === 4 ? + "Tbps" : "Unknown Unit" + } / {pcc_rule.qos.mbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.uplink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.uplink.value + } {pcc_rule.qos.mbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.uplink['value'] === + undefined ? "" : + pcc_rule.qos.mbr.uplink['unit'] === + undefined ? "bps" : + pcc_rule.qos.mbr.uplink.unit === 0 ? + "bps" : + pcc_rule.qos.mbr.uplink.unit === 1 ? + "Kbps" : + pcc_rule.qos.mbr.uplink.unit === 2 ? + "Mbps" : + pcc_rule.qos.mbr.uplink.unit === 3 ? + "Gbps" : + pcc_rule.qos.mbr.uplink.unit === 4 ? + "Tbps" : "Unknown Unit" + } +
+ } + {pcc_rule.qos['gbr'] === undefined ? +
+ unlimited/unlimited +
: +
+ {pcc_rule.qos.gbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.downlink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.downlink.value + } {pcc_rule.qos.gbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.downlink['value'] === + undefined ? "" : + pcc_rule.qos.gbr.downlink['unit'] === + undefined ? "bps" : + pcc_rule.qos.gbr.downlink.unit === 0 ? + "bps" : + pcc_rule.qos.gbr.downlink.unit === 1 ? + "Kbps" : + pcc_rule.qos.gbr.downlink.unit === 2 ? + "Mbps" : + pcc_rule.qos.gbr.downlink.unit === 3 ? + "Gbps" : + pcc_rule.qos.gbr.downlink.unit === 4 ? + "Tbps" : "Unknown Unit" + } / {pcc_rule.qos.gbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.uplink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.uplink.value + } {pcc_rule.qos.gbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.uplink['value'] === + undefined ? "" : + pcc_rule.qos.gbr.uplink['unit'] === + undefined ? "bps" : + pcc_rule.qos.gbr.uplink.unit === 0 ? + "bps" : + pcc_rule.qos.gbr.uplink.unit === 1 ? + "Kbps" : + pcc_rule.qos.gbr.uplink.unit === 2 ? + "Mbps" : + pcc_rule.qos.gbr.uplink.unit === 3 ? + "Gbps" : + pcc_rule.qos.gbr.uplink.unit === 4 ? + "Tbps" : "Unknown Unit" + } +
+ }
- ) - } -
- ) - } + {pcc_rule['flow'] !== undefined && + pcc_rule.flow.map((flow, index) => +
+
+
+ {flow.direction == 1 && "Downlink"} + {flow.direction == 2 && "Uplink"} +
+
{flow.description}
+
+ )} +
+ )} +
+ )}
)} diff --git a/webui/src/components/Subscriber/Edit.js b/webui/src/components/Subscriber/Edit.js index 453a3b0de..19bb8a810 100644 --- a/webui/src/components/Subscriber/Edit.js +++ b/webui/src/components/Subscriber/Edit.js @@ -65,178 +65,108 @@ const schema = { "title": "", "properties": { "downlink": { - "type": "number", - "title": "UE-AMBR Downlink (Kbps)*", - "required": true + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "UE-AMBR Downlink*", + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } }, "uplink": { - "type": "number", - "title": "UE-AMBR Uplink (Kbps)*", - "required": true + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "UE-AMBR Uplink*", + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } } } }, - "pdn": { + "slice": { "type": "array", - "title": "APN Configurations", + "title": "Slice Configurations", "minItems": 1, - "maxItems": 4, + "maxItems": 8, "messages": { - "minItems": "At least 1 APN is required", - "maxItems": "4 APNs are supported" + "minItems": "At least 1 Slice is required", + "maxItems": "8 Slices are supported" }, "items": { "type": "object", "properties": { - "apn": { - "type": "string", - "title": "Access Point Name (APN)*", + "sst": { + "type": "number", + "title": "SST*", + "enum": [ 1, 2, 3, 4 ], "required": true }, - "type": { - "type": "number", - "title": "Type*", - "enum": [0, 1, 2], - "enumNames": ["IPv4", "IPv6", "IPv4v6"], - "default": 2, - }, - "qos": { - "type": "object", - "title": "", - "properties": { - "qci": { - "type": "number", - "title": "QoS Class Identifier (QCI)*", - "enum": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 65, 66, 69, 70 ], - "default": 5, - }, - "arp" : { - "type": "object", - "title": "", - "properties": { - "priority_level": { - "type": "number", - "title": "ARP Priority Level (1-15)*", - "default": 1, - "minimum": 1, - "maximum": 15, - "required": true - }, - "pre_emption_capability": { - "type": "number", - "title": "Capability*", - "enum": [1, 0], - "enumNames": ["Disabled", "Enabled"], - "default": 1, - }, - "pre_emption_vulnerability": { - "type": "number", - "title": "Vulnerability*", - "enum": [1, 0], - "enumNames": ["Disabled", "Enabled"], - "default": 1, - }, - } - } - } - }, - "ambr": { - "type": "object", - "title": "", - "properties": { - "downlink": { - "type": "number", - "title": "APN-AMBR Downlink (Kbps)*", - "required": true - }, - "uplink": { - "type": "number", - "title": "APN-AMBR Uplink (Kbps)*", - "required": true - }, - } - }, - "ue": { - "type": "object", - "title": "", - "properties": { - "addr": { - "type": "string", - "title": "UE IPv4 Address", - "format" : "ipv4" - }, - "addr6": { - "type": "string", - "title": "UE IPv6 Address", - "format" : "ipv6" - }, - } - }, - "pgw": { - "type": "object", - "title": "", - "properties": { - "addr": { - "type": "string", - "title": "PGW IPv4 Address", - "format" : "ipv4" - }, - "addr6": { - "type": "string", - "title": "PGW IPv6 Address", - "format" : "ipv6" - }, - } - }, - "pcc_rule": { - "type": "array", - "title": "PCC Rules", - "maxItems": 8, + "sd": { + "type": "string", + "title": "SD", + "pattern": "^[0-9a-fA-F]+$", + "minLength": 6, + "maxLength": 6, "messages": { - "maxItems": "8 PCC Rules are supported" + "pattern": "Only hexadecimal digits are allowed" + } + }, + "default_indicator": { + "type": "boolean", + "title": "Default S-NSSAI", + }, + "session": { + "type": "array", + "title": "Session Configurations", + "minItems": 1, + "maxItems": 4, + "messages": { + "minItems": "At least 1 Session is required", + "maxItems": "4 Sessions are supported" }, "items": { "type": "object", "properties": { - "flow": { - "type": "array", - "title": "", - "maxItems": 8, - "messages": { - "maxItems": "8 Flows are supported" - }, - "items": { - "type": "object", - "properties": { - "direction": { - "type": "number", - "title": "Flow Direction*", - "enum": [1, 2], - "enumNames": ["Downlink", "Uplink"], - "default": 1, - }, - "description": { - "type": "string", - "title": "Description*", - "default": "permit out udp from any 1-65535 to 45.45.45.45", - "required": true, - "pattern": "^permit\\s+out", - "messages": { - "pattern": "Begin with reserved keyword 'permit out'." - } - } - } - } + "name": { + "type": "string", + "title": "DNN/APN*", + "required": true + }, + "type": { + "type": "number", + "title": "Type*", + "enum": [1, 2, 3], + "enumNames": ["IPv4", "IPv6", "IPv4v6"], + "default": 3, }, "qos": { "type": "object", "title": "", "properties": { - "qci": { + "index": { "type": "number", - "title": "QoS Class Identifier (QCI)*", - "enum": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 65, 66, 69, 70 ], - "default": 1, + "title": "5QI/QCI*", + "enum": [ 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 ], + "default": 5, }, "arp" : { "type": "object", @@ -245,69 +175,264 @@ const schema = { "priority_level": { "type": "number", "title": "ARP Priority Level (1-15)*", - "default": 2, - "minimum": 1, - "maximum": 15, - "required": true + "enum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + "default": 1, }, - // 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 "pre_emption_capability": { "type": "number", "title": "Capability*", - "enum": [1, 0], + "enum": [1, 2], "enumNames": ["Disabled", "Enabled"], - "default": 0, + "default": 1 }, "pre_emption_vulnerability": { "type": "number", "title": "Vulnerability*", - "enum": [1, 0], + "enum": [1, 2], "enumNames": ["Disabled", "Enabled"], - "default": 0, + "default": 1 }, } - }, - "mbr": { - "type": "object", - "title": "", - "properties": { - "downlink": { - "type": "number", - "title": "MBR Downlink (Kbps)", - }, - "uplink": { - "type": "number", - "title": "MBR Uplink (Kbps)", - }, - } - }, - "gbr": { - "type": "object", - "title": "", - "properties": { - "downlink": { - "type": "number", - "title": "GBR Downlink (Kbps)", - }, - "uplink": { - "type": "number", - "title": "GBR Uplink (Kbps)", - }, - } - }, - }, + } + } }, + "ambr": { + "type": "object", + "title": "", + "properties": { + "downlink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "Session-AMBR Downlink*", + "default": 1, + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } + }, + "uplink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "Session-AMBR Uplink*", + "default": 1, + "required": true, + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 3, + } + } + } + } + }, + "ue": { + "type": "object", + "title": "", + "properties": { + "addr": { + "type": "string", + "title": "UE IPv4 Address", + "format" : "ipv4" + }, + "addr6": { + "type": "string", + "title": "UE IPv6 Address", + "format" : "ipv6" + }, + } + }, + "smf": { + "type": "object", + "title": "", + "properties": { + "addr": { + "type": "string", + "title": "SMF IPv4 Address", + "format" : "ipv4" + }, + "addr6": { + "type": "string", + "title": "SMF IPv6 Address", + "format" : "ipv6" + }, + } + }, + "pcc_rule": { + "type": "array", + "title": "PCC Rules", + "maxItems": 8, + "messages": { + "maxItems": "8 PCC Rules are supported" + }, + "items": { + "type": "object", + "properties": { + "flow": { + "type": "array", + "title": "", + "maxItems": 8, + "messages": { + "maxItems": "8 Flows are supported" + }, + "items": { + "type": "object", + "properties": { + "direction": { + "type": "number", + "title": "Flow Direction*", + "enum": [1, 2], + "enumNames": ["Downlink", "Uplink"], + "default": 1, + }, + "description": { + "type": "string", + "title": "Description*", + "default": "permit out udp from any 1-65535 to 45.45.45.45", + "required": true, + "pattern": "^permit\\s+out", + "messages": { + "pattern": "Begin with reserved keyword 'permit out'." + } + } + } + } + }, + "qos": { + "type": "object", + "title": "", + "properties": { + "index": { + "type": "number", + "title": "5QI/QCI*", + "enum": [ 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 ], + "default": 1, + }, + "arp" : { + "type": "object", + "title": "", + "properties": { + "priority_level": { + "type": "number", + "title": "ARP Priority Level (1-15)*", + "enum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + "default": 2, + }, + "pre_emption_capability": { + "type": "number", + "title": "Capability*", + "enum": [1, 2], + "enumNames": ["Disabled", "Enabled"], + "default": 2, + }, + "pre_emption_vulnerability": { + "type": "number", + "title": "Vulnerability*", + "enum": [1, 2], + "enumNames": ["Disabled", "Enabled"], + "default": 2, + }, + } + }, + "mbr": { + "type": "object", + "title": "", + "properties": { + "downlink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "MBR Downlink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + }, + "uplink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "MBR Uplink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + } + } + }, + "gbr": { + "type": "object", + "title": "", + "properties": { + "downlink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "GBR Downlink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + }, + "uplink": { + "type": "object", + "title": "", + "properties": { + "value": { + "type": "number", + "title": "GBR Uplink", + }, + "unit": { + "type": "number", + "title": "Unit", + "enum": [0, 1, 2, 3, 4], + "enumNames": ["bps", "Kbps", "Mbps", "Gbps", "Tbps"], + "default": 1, + } + } + } + } + }, + }, + }, + } + } + } } } } @@ -336,114 +461,162 @@ const uiSchema = { }, }, "ambr" : { - "downlink" : { - classNames: "col-xs-6" - }, - "uplink" : { - classNames: "col-xs-6" - }, - }, - "pdn": { - "items": { - "apn": { + "downlink": { + classNames: "col-xs-6", + "value": { classNames: "col-xs-8", }, - "type": { + "unit": { classNames: "col-xs-4", }, - "qos": { - classNames: "col-xs-12", - "qci": { - "ui:widget": "radio", - "ui:options": { - "inline": true - }, - }, - "arp": { - "priority_level": { - classNames: "col-xs-6" - }, - "pre_emption_capability": { - classNames: "col-xs-3" - }, - "pre_emption_vulnerability": { - classNames: "col-xs-3" - } - } + }, + "uplink": { + classNames: "col-xs-6", + "value": { + classNames: "col-xs-8", }, - "ambr" : { - classNames: "col-xs-12", - "downlink" : { - classNames: "col-xs-6" - }, - "uplink" : { - classNames: "col-xs-6" - }, + "unit": { + classNames: "col-xs-4", }, - "ue" : { - classNames: "col-xs-12", - "addr" : { - classNames: "col-xs-6" - }, - "addr6" : { - classNames: "col-xs-6" - }, + } + }, + "slice": { + classNames: "col-xs-12", + "items": { + "sst": { + classNames: "col-xs-3", + "ui:widget": "radio", + "ui:options": { "inline": true }, }, - "pgw" : { - classNames: "col-xs-12", - "addr" : { - classNames: "col-xs-6" - }, - "addr6" : { - classNames: "col-xs-6" - }, + "sd": { + classNames: "col-xs-6", }, - "pcc_rule": { + "default_indicator": { + classNames: "col-xs-3", + }, + "session": { classNames: "col-xs-12", "items": { - "flow": { - "items": { - "direction": { - classNames: "col-xs-12" - }, - "description": { - classNames: "col-xs-12", - "ui:help": "Hint: Flow-Description(TS29.212), IPFilterRule(RFC 3588)", - }, - }, + "name": { + classNames: "col-xs-8", + }, + "type": { + classNames: "col-xs-4", }, "qos": { - "qci": { - "ui:widget": "radio", - "ui:options": { - "inline": true - }, + classNames: "col-xs-12", + "index": { }, "arp": { "priority_level": { - classNames: "col-xs-6" }, "pre_emption_capability": { - classNames: "col-xs-3" + classNames: "col-xs-6" }, "pre_emption_vulnerability": { - classNames: "col-xs-3" - } - }, - "mbr": { - "downlink": { - classNames: "col-xs-6" - }, - "uplink": { classNames: "col-xs-6" } - }, - "gbr": { - "downlink": { - classNames: "col-xs-6" + } + }, + "ambr" : { + classNames: "col-xs-12", + "downlink": { + "value": { + classNames: "col-xs-8" }, - "uplink": { - classNames: "col-xs-6" + "unit": { + classNames: "col-xs-4" + }, + }, + "uplink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + }, + }, + "ue" : { + classNames: "col-xs-12", + "addr" : { + classNames: "col-xs-6" + }, + "addr6" : { + classNames: "col-xs-6" + }, + }, + "smf" : { + classNames: "col-xs-12", + "addr" : { + classNames: "col-xs-6" + }, + "addr6" : { + classNames: "col-xs-6" + }, + }, + "pcc_rule": { + classNames: "col-xs-12", + "items": { + "flow": { + "items": { + "direction": { + }, + "description": { + "ui:help": "Hint: 5.4.2 Flow-Description in TS29.212", + }, + }, + }, + "qos": { + "index": { + }, + "arp": { + "priority_level": { + classNames: "col-xs-12" + }, + "pre_emption_capability": { + classNames: "col-xs-6" + }, + "pre_emption_vulnerability": { + classNames: "col-xs-6" + } + }, + "mbr": { + "downlink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + }, + "uplink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + } + }, + "gbr": { + "downlink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + }, + "uplink": { + "value": { + classNames: "col-xs-8" + }, + "unit": { + classNames: "col-xs-4" + }, + } + } } } } @@ -553,10 +726,10 @@ class Edit extends Component { delete formData._id; delete formData.__v; - traverse(formData).forEach(function(x) { - if (this.key == 'downlink') this.update(Number(x)); - if (this.key == 'uplink') this.update(Number(x)); - }) + //traverse(formData).forEach(function(x) { + // if (this.key == 'downlink') this.update(Number(x)); + // if (this.key == 'uplink') this.update(Number(x)); + //}) if (formData.security) { if (formData.security.opc) { formData.security.op_type = 0; diff --git a/webui/src/components/Subscriber/View.js b/webui/src/components/Subscriber/View.js index b26cdd3ee..9e156835b 100644 --- a/webui/src/components/Subscriber/View.js +++ b/webui/src/components/Subscriber/View.js @@ -162,12 +162,12 @@ const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, on const imsi = (subscriber || {}).imsi; const security = ((subscriber || {}).security || {}); const ambr = ((subscriber || {}).ambr || {}); - const pdns = ((subscriber || {}).pdn || []); + const slice_list = ((subscriber || {}).slice || []); return (
- @@ -229,115 +229,281 @@ const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, on
- {ambr.downlink} Kbps + {ambr['downlink'] === undefined ? "unlimited" : + ambr.downlink['value'] === undefined ? "unlimited" : + ambr.downlink.value + } {ambr['downlink'] === undefined ? "unlimited" : + ambr.downlink['value'] === undefined ? "" : + ambr.downlink['unit'] === undefined ? "bps" : + ambr.downlink.unit === 0 ? "bps" : + ambr.downlink.unit === 1 ? "Kbps" : + ambr.downlink.unit === 2 ? "Mbps" : + ambr.downlink.unit === 3 ? "Gbps" : + ambr.downlink.unit === 4 ? "Tbps" : + "Unknown Unit" } DL
- {ambr.uplink} Kbps + {ambr['uplink'] === undefined ? "unlimited" : + ambr.uplink['value'] === undefined ? "unlimited" : + ambr.uplink.value + } {ambr['uplink'] === undefined ? "unlimited" : + ambr.uplink['value'] === undefined ? "" : + ambr.uplink['unit'] === undefined ? "bps" : + ambr.uplink.unit === 0 ? "bps" : + ambr.uplink.unit === 1 ? "Kbps" : + ambr.uplink.unit === 2 ? "Mbps" : + ambr.uplink.unit === 3 ? "Gbps" : + ambr.uplink.unit === 4 ? "Tbps" : + "Unknown Unit" } UL
-
- APN Configrations -
-
-
APN
-
Type
-
QCI
-
ARP
-
Capability
-
Vulnerablility
-
MBR DL/UL(Kbps)
-
GBR DL/UL(Kbps)
-
- {pdns.map(pdn => -
-
-
{pdn.apn}
-
{pdn.type === 0 ? "IPv4" : (pdn.type === 1 ? "IPv6" : "IPv4v6")}
-
{pdn.qos.qci}
-
{pdn.qos.arp.priority_level}
-
{pdn.qos.arp.pre_emption_capability === 1 ? "Disabled" : "Enabled"}
-
{pdn.qos.arp.pre_emption_vulnerability === 1 ? "Disabled" : "Enabled"}
- {pdn['ambr'] === undefined ? -
- unlimited/unlimited -
: -
- {pdn.ambr['downlink'] === undefined ? "unlimited" : pdn.ambr.downlink} - / - {pdn.ambr['uplink'] === undefined ? "unlimited" : pdn.ambr.uplink} -
- } -
+ {slice_list.map((slice, index) => +
+ {slice.sd === undefined ? +
+ SST:{slice.sst} {slice.default_indicator == + true ? "(Default S-NSSAI)" : ""} +
: +
+ SST:{slice.sst} SD:{slice.sd} {slice.default_indicator == + true ? "(Default S-NSSAI)" : ""} +
+ } +
+
DNN/APN
+
Type
+
5QI/QCI
+
ARP
+
Capability
+
Vulnerablility
+
MBR DL/UL
+
GBR DL/UL
- {pdn['ue'] !== undefined && -
-
-
{"UE IPv4"}
-
{(pdn.ue || {}).addr}
-
{"UE IPv6"}
-
{(pdn.ue || {}).addr6}
-
- } - {pdn['pgw'] !== undefined && -
-
-
{"PGW IPv4"}
-
{(pdn.pgw || {}).addr}
-
{"PGW IPv6"}
-
{(pdn.pgw || {}).addr6}
-
- } - {pdn['pcc_rule'] !== undefined && - pdn.pcc_rule.map((pcc_rule, index) => -
+ {slice['session'] !== undefined && + slice.session.map(session => +
+
+
{session.name}
+
{ + session.type === 1 ? "IPv4" : + session.type === 2 ? "IPv6" : + session.type === 3 ? "IPv4v6" : + "Unknown" + }
+
{session.qos.index}
+
{session.qos.arp.priority_level}
+
+ {session.qos.arp.pre_emption_capability === + 2 ? "Enabled" : + session.qos.arp.pre_emption_capability === + 1 ? "Disabled" : "Unknown"} +
+
+ {session.qos.arp.pre_emption_vulnerability === + 2 ? "Enabled" : + session.qos.arp.pre_emption_vulnerability === + 1 ? "Disabled" : "Unknown"} +
+ {session['ambr'] === undefined ? +
+ unlimited/unlimited +
: +
+ {session.ambr['downlink'] === undefined ? "unlimited" : + session.ambr.downlink['value'] === undefined ? + "unlimited" : session.ambr.downlink.value + } {session.ambr['downlink'] === undefined ? + "unlimited" : + session.ambr.downlink['value'] === + undefined ? "" : + session.ambr.downlink['unit'] === + undefined ? "bps" : + session.ambr.downlink.unit === 0 ? "bps" : + session.ambr.downlink.unit === 1 ? "Kbps" : + session.ambr.downlink.unit === 2 ? "Mbps" : + session.ambr.downlink.unit === 3 ? "Gbps" : + session.ambr.downlink.unit === 4 ? "Tbps" : + "Unknown Unit" + } / {session.ambr['uplink'] === + undefined ? "unlimited" : + session.ambr.uplink['value'] === undefined ? + "unlimited" : session.ambr.uplink.value + } {session.ambr['uplink'] === undefined ? + "unlimited" : + session.ambr.uplink['value'] === + undefined ? "" : + session.ambr.uplink['unit'] === + undefined ? "bps" : + session.ambr.uplink.unit === 0 ? "bps" : + session.ambr.uplink.unit === 1 ? "Kbps" : + session.ambr.uplink.unit === 2 ? "Mbps" : + session.ambr.uplink.unit === 3 ? "Gbps" : + session.ambr.uplink.unit === 4 ? "Tbps" : + "Unknown Unit" + } +
+ } +
+
+ {session['ue'] !== undefined &&
-
-
{pcc_rule.qos.qci}
-
{pcc_rule.qos.arp.priority_level}
-
{pcc_rule.qos.arp.pre_emption_capability === 1 ? "Disabled" : "Enabled"}
-
{pcc_rule.qos.arp.pre_emption_vulnerability === 1 ? "Disabled" : "Enabled"}
- {pcc_rule.qos['mbr'] === undefined ? -
- unlimited/unlimited -
: -
- {pcc_rule.qos.mbr['downlink'] === undefined ? "unlimited" : pcc_rule.qos.mbr.downlink} - / - {pcc_rule.qos.mbr['uplink'] === undefined ? "unlimited" : pcc_rule.qos.mbr.uplink} -
- } - {pcc_rule.qos['gbr'] === undefined ? -
- unlimited/unlimited -
: -
- {pcc_rule.qos.gbr['downlink'] === undefined ? "unlimited" : pcc_rule.qos.gbr.downlink} - / - {pcc_rule.qos.gbr['uplink'] === undefined ? "unlimited" : pcc_rule.qos.gbr.uplink} -
- } +
{"UE IPv4"}
+
{(session.ue || {}).addr}
+
{"UE IPv6"}
+
{(session.ue || {}).addr6}
- {pcc_rule['flow'] !== undefined && - pcc_rule.flow.map((flow, index) => -
+ } + {session['smf'] !== undefined && +
+
+
{"SMF IPv4"}
+
{(session.smf || {}).addr}
+
{"SMF IPv6"}
+
{(session.smf || {}).addr6}
+
+ } + {session['pcc_rule'] !== undefined && + session.pcc_rule.map((pcc_rule, index) => +
+
-
- {flow.direction == 1 && "Downlink"} - {flow.direction == 2 && "Uplink"} +
+
{pcc_rule.qos.index}
+
{pcc_rule.qos.arp.priority_level}
+
+ {pcc_rule.qos.arp.pre_emption_capability === + 2 ? "Enabled" : + pcc_rule.qos.arp.pre_emption_capability === + 1 ? "Disabled" : "Unknown"}
-
{flow.description}
+
+ {pcc_rule.qos.arp.pre_emption_vulnerability === + 2 ? "Enabled" : + pcc_rule.qos.arp.pre_emption_vulnerability === + 1 ? "Disabled" : "Unknown"} +
+ {pcc_rule.qos['mbr'] === undefined ? +
+ unlimited/unlimited +
: +
+ {pcc_rule.qos.mbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.downlink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.downlink.value + } {pcc_rule.qos.mbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.downlink['value'] === + undefined ? "" : + pcc_rule.qos.mbr.downlink['unit'] === + undefined ? "bps" : + pcc_rule.qos.mbr.downlink.unit === 0 ? + "bps" : + pcc_rule.qos.mbr.downlink.unit === 1 ? + "Kbps" : + pcc_rule.qos.mbr.downlink.unit === 2 ? + "Mbps" : + pcc_rule.qos.mbr.downlink.unit === 3 ? + "Gbps" : + pcc_rule.qos.mbr.downlink.unit === 4 ? + "Tbps" : "Unknown Unit" + } / {pcc_rule.qos.mbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.uplink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.uplink.value + } {pcc_rule.qos.mbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.mbr.uplink['value'] === + undefined ? "" : + pcc_rule.qos.mbr.uplink['unit'] === + undefined ? "bps" : + pcc_rule.qos.mbr.uplink.unit === 0 ? + "bps" : + pcc_rule.qos.mbr.uplink.unit === 1 ? + "Kbps" : + pcc_rule.qos.mbr.uplink.unit === 2 ? + "Mbps" : + pcc_rule.qos.mbr.uplink.unit === 3 ? + "Gbps" : + pcc_rule.qos.mbr.uplink.unit === 4 ? + "Tbps" : "Unknown Unit" + } +
+ } + {pcc_rule.qos['gbr'] === undefined ? +
+ unlimited/unlimited +
: +
+ {pcc_rule.qos.gbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.downlink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.downlink.value + } {pcc_rule.qos.gbr['downlink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.downlink['value'] === + undefined ? "" : + pcc_rule.qos.gbr.downlink['unit'] === + undefined ? "bps" : + pcc_rule.qos.gbr.downlink.unit === 0 ? + "bps" : + pcc_rule.qos.gbr.downlink.unit === 1 ? + "Kbps" : + pcc_rule.qos.gbr.downlink.unit === 2 ? + "Mbps" : + pcc_rule.qos.gbr.downlink.unit === 3 ? + "Gbps" : + pcc_rule.qos.gbr.downlink.unit === 4 ? + "Tbps" : "Unknown Unit" + } / {pcc_rule.qos.gbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.uplink['value'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.uplink.value + } {pcc_rule.qos.gbr['uplink'] === + undefined ? "unlimited" : + pcc_rule.qos.gbr.uplink['value'] === + undefined ? "" : + pcc_rule.qos.gbr.uplink['unit'] === + undefined ? "bps" : + pcc_rule.qos.gbr.uplink.unit === 0 ? + "bps" : + pcc_rule.qos.gbr.uplink.unit === 1 ? + "Kbps" : + pcc_rule.qos.gbr.uplink.unit === 2 ? + "Mbps" : + pcc_rule.qos.gbr.uplink.unit === 3 ? + "Gbps" : + pcc_rule.qos.gbr.uplink.unit === 4 ? + "Tbps" : "Unknown Unit" + } +
+ }
- ) - } -
- ) - } + {pcc_rule['flow'] !== undefined && + pcc_rule.flow.map((flow, index) => +
+
+
+ {flow.direction == 1 && "Downlink"} + {flow.direction == 2 && "Uplink"} +
+
{flow.description}
+
+ )} +
+ )} +
+ )}
)} diff --git a/webui/src/containers/Profile/Document.js b/webui/src/containers/Profile/Document.js index 78065e94f..edc15be7c 100644 --- a/webui/src/containers/Profile/Document.js +++ b/webui/src/containers/Profile/Document.js @@ -20,39 +20,41 @@ const formData = { op_value: "E8ED289D EBA952E4 283B54E8 8E6183CA", }, "ambr": { - "downlink": 1024000, - "uplink": 1024000 - }, - "pdn": [ - { - "apn": "internet", - "type": 2, - "ambr": { - "downlink": 1024000, - "uplink": 1024000 - }, - "qos": { - "qci": 9, - // 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, - // disable Pre-emption Capability/Vulnerablility in Default Bearer - "arp": { - "priority_level": 8, - "pre_emption_capability": 1, - "pre_emption_vulnerability": 1 - } - }, + "downlink": { + "value": 1, + "unit": 3 + }, + "uplink": { + "value": 1, + "unit": 3 } - ] + }, + "slice": [{ + "sst": 1, + "default_indicator": true, + "session": [{ + "name": "internet", + "type": 3, + "ambr": { + "downlink": { + "value": 1, + "unit": 3 + }, + "uplink": { + "value": 1, + "unit": 3 + } + }, + "qos": { + "index": 9, + "arp": { + "priority_level": 8, + "pre_emption_capability": 1, + "pre_emption_vulnerability": 1 + } + }, + }] + }] } class Document extends Component { @@ -94,10 +96,10 @@ class Document extends Component { // The followings are changed from 'String' to 'Number' after DB CREATE or UPDATE // - ambr.downlink, ambr.uplink, qos.mbr.downlink, qos.mbr.uplink, qos.gbr.downlink, qos.gbr.uplink // - traverse(profile.data).forEach(function(x) { - if (this.key == 'downlink') this.update(Number(x)); - if (this.key == 'uplink') this.update(Number(x)); - }) + //traverse(profile.data).forEach(function(x) { + // if (this.key == 'downlink') this.update(Number(x)); + // if (this.key == 'uplink') this.update(Number(x)); + //}) if (profile.data.security) { if (profile.data.security.opc) { @@ -167,20 +169,46 @@ class Document extends Component { validate = (formData, errors) => { const { profiles, action, status } = this.props; - if (formData.pdn) { - let apns = formData.pdn.map(pdn => { return pdn.apn } ) + if (formData.slice) { + let s_nssais = formData.slice.map(slice => { + return JSON.stringify({ sst: slice.sst, sd: slice.sd }) + }); let duplicates = {}; - for (let i = 0; i < apns.length; i++) { - if (duplicates.hasOwnProperty(apns[i])) { - duplicates[apns[i]].push(i); - } else if (apns.lastIndexOf(apns[i]) !== i) { - duplicates[apns[i]] = [i]; + for (let i = 0; i < s_nssais.length; i++) { + if (duplicates.hasOwnProperty(s_nssais[i])) { + duplicates[s_nssais[i]].push(i); + } else if (s_nssais.lastIndexOf(s_nssais[i]) !== i) { + duplicates[s_nssais[i]] = [i]; } } + for (let key in duplicates) { + duplicates[key].forEach(index => + errors.slice[index].sst.addError(`${key} is duplicated`)); + } + } + for (let i = 0; i < formData.slice.length; i++) { + let names = formData.slice[i].session.map(session => { + return session.name + }); + let duplicates = {}; + for (let j = 0; j < names.length; j++) { + if (duplicates.hasOwnProperty(names[j])) { + duplicates[names[j]].push(j); + } else if (names.lastIndexOf(names[j]) !== j) { + duplicates[names[j]] = [j]; + } + } for (let key in duplicates) { duplicates[key].forEach(index => - errors.pdn[index].apn.addError(`'${key}' is duplicated`)); + errors.slice[i].session[index].name.addError(`'${key}' is duplicated`)); + } + } + + if (!formData.slice.some(slice => slice.default_indicator == true)) { + for (let i = 0; i < formData.slice.length; i++) { + errors.slice[i].default_indicator.addError( + `At least 1 Default S-NSSAI is required`); } } diff --git a/webui/src/containers/Subscriber/Document.js b/webui/src/containers/Subscriber/Document.js index 91b5429e8..dc37d2e1c 100644 --- a/webui/src/containers/Subscriber/Document.js +++ b/webui/src/containers/Subscriber/Document.js @@ -21,39 +21,41 @@ const formData = { op_value: "E8ED289D EBA952E4 283B54E8 8E6183CA", }, "ambr": { - "downlink": 1024000, - "uplink": 1024000 - }, - "pdn": [ - { - "apn": "internet", - "type": 2, - "ambr": { - "downlink": 1024000, - "uplink": 1024000 - }, - "qos": { - "qci": 9, - // 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, - // disable Pre-emption Capability/Vulnerablility in Default Bearer - "arp": { - "priority_level": 8, - "pre_emption_capability": 1, - "pre_emption_vulnerability": 1 - } - }, + "downlink": { + "value": 1, + "unit": 3 + }, + "uplink": { + "value": 1, + "unit": 3 } - ] + }, + "slice": [{ + "sst": 1, + "default_indicator": true, + "session": [{ + "name": "internet", + "type": 3, + "ambr": { + "downlink": { + "value": 1, + "unit": 3 + }, + "uplink": { + "value": 1, + "unit": 3 + } + }, + "qos": { + "index": 9, + "arp": { + "priority_level": 8, + "pre_emption_capability": 1, + "pre_emption_vulnerability": 1 + } + }, + }] + }] } class Document extends Component { @@ -101,10 +103,10 @@ class Document extends Component { // The followings are changed from 'String' to 'Number' after DB CREATE or UPDATE // - ambr.downlink, ambr.uplink, qos.mbr.downlink, qos.mbr.uplink, qos.gbr.downlink, qos.gbr.uplink // - traverse(subscriber.data).forEach(function(x) { - if (this.key == 'downlink') this.update(Number(x)); - if (this.key == 'uplink') this.update(Number(x)); - }) + //traverse(subscriber.data).forEach(function(x) { + // if (this.key == 'downlink') this.update(Number(x)); + // if (this.key == 'uplink') this.update(Number(x)); + //}) if (subscriber.data.security) { if (subscriber.data.security.opc) { @@ -180,20 +182,46 @@ class Document extends Component { errors.imsi.addError(`'${imsi}' is duplicated`); } - if (formData.pdn) { - let apns = formData.pdn.map(pdn => { return pdn.apn } ) + if (formData.slice) { + let s_nssais = formData.slice.map(slice => { + return JSON.stringify({ sst: slice.sst, sd: slice.sd }) + }); let duplicates = {}; - for (let i = 0; i < apns.length; i++) { - if (duplicates.hasOwnProperty(apns[i])) { - duplicates[apns[i]].push(i); - } else if (apns.lastIndexOf(apns[i]) !== i) { - duplicates[apns[i]] = [i]; + for (let i = 0; i < s_nssais.length; i++) { + if (duplicates.hasOwnProperty(s_nssais[i])) { + duplicates[s_nssais[i]].push(i); + } else if (s_nssais.lastIndexOf(s_nssais[i]) !== i) { + duplicates[s_nssais[i]] = [i]; } } + for (let key in duplicates) { + duplicates[key].forEach(index => + errors.slice[index].sst.addError(`${key} is duplicated`)); + } + } + for (let i = 0; i < formData.slice.length; i++) { + let names = formData.slice[i].session.map(session => { + return session.name + }); + let duplicates = {}; + for (let j = 0; j < names.length; j++) { + if (duplicates.hasOwnProperty(names[j])) { + duplicates[names[j]].push(j); + } else if (names.lastIndexOf(names[j]) !== j) { + duplicates[names[j]] = [j]; + } + } for (let key in duplicates) { duplicates[key].forEach(index => - errors.pdn[index].apn.addError(`'${key}' is duplicated`)); + errors.slice[i].session[index].name.addError(`'${key}' is duplicated`)); + } + } + + if (!formData.slice.some(slice => slice.default_indicator == true)) { + for (let i = 0; i < formData.slice.length; i++) { + errors.slice[i].default_indicator.addError( + `At least 1 Default S-NSSAI is required`); } }