diff --git a/configs/cups.yaml.in b/configs/cups.yaml.in index 73663658d..21729e82d 100644 --- a/configs/cups.yaml.in +++ b/configs/cups.yaml.in @@ -66,6 +66,23 @@ sgw: addr: 127.0.0.2 smf: + sbi: + - addr: 127.0.0.3 + port: 7777 + gtpc: + - addr: 127.0.0.3 + - addr: ::1 + pfcp: + - addr: 127.0.0.3 + pdn: + - addr: 10.45.0.1/16 + - addr: cafe::1/64 + dns: + - 8.8.8.8 + - 8.8.4.4 + - 2001:4860:4860::8888 + - 2001:4860:4860::8844 + mtu: 1400 freeDiameter: identity: pgw.open-ims.test realm: open-ims.test @@ -82,28 +99,19 @@ smf: connect: - identity: pcrf.open-ims.test addr: 127.0.0.5 - - gtpc: - - addr: 127.0.0.3 - - addr: ::1 - pfcp: - - addr: 127.0.0.3 - pdn: - - addr: 10.45.0.1/16 - - addr: cafe::1/64 - dns: - - 8.8.8.8 - - 8.8.4.4 - - 2001:4860:4860::8888 - - 2001:4860:4860::8844 - mtu: 1400 +nrf: + sbi: + addr: + - 127.0.0.1 + - ::1 + port: 7777 upf: pfcp: - addr: 127.0.0.2 + addr: 127.0.0.4 gtpu: - addr: - - 127.0.0.3 + - 127.0.0.4 - ::1 pdn: diff --git a/configs/open5gs/hss.yaml.in b/configs/open5gs/hss.yaml.in index 4de7f2958..5c7b61580 100644 --- a/configs/open5gs/hss.yaml.in +++ b/configs/open5gs/hss.yaml.in @@ -47,7 +47,6 @@ hss: # o Disable Stateless Address Autoconfiguration for IPv6 # no_slaac: true # -# parameter: # @@ -92,4 +91,5 @@ max: # - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes # # packet: 65536 +# pool: diff --git a/configs/open5gs/meson.build b/configs/open5gs/meson.build index 9874cdfd8..b8484428e 100644 --- a/configs/open5gs/meson.build +++ b/configs/open5gs/meson.build @@ -26,6 +26,7 @@ open5gs_conf = ''' pgw.yaml pcrf.yaml + nrf.yaml smf.yaml upf.yaml '''.split() diff --git a/configs/open5gs/mme.yaml.in b/configs/open5gs/mme.yaml.in index 854ccd705..67f272b80 100644 --- a/configs/open5gs/mme.yaml.in +++ b/configs/open5gs/mme.yaml.in @@ -336,7 +336,6 @@ pgw: # o Disable Stateless Address Autoconfiguration for IPv6 # no_slaac: true # -# parameter: # @@ -381,6 +380,7 @@ max: # - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes # # packet: 65536 +# pool: # @@ -395,4 +395,5 @@ pool: # o max_attempts : 4 # o max_initial_timeout : 8000(8secs) # o usrsctp_udp_port : 9899 +# sctp: diff --git a/configs/open5gs/nrf.yaml.in b/configs/open5gs/nrf.yaml.in new file mode 100644 index 000000000..968e16c69 --- /dev/null +++ b/configs/open5gs/nrf.yaml.in @@ -0,0 +1,162 @@ +db_uri: mongodb://localhost/open5gs + +# +# 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,fd,nrf,event,mem,sock +# +logger: + file: @localstatedir@/log/open5gs/nrf.log + +# +# nrf: +# +# +# +# o SBI Server(http://:80) +# sbi: +# +# o SBI Server(http://:7777) +# sbi: +# - addr: +# - 0.0.0.0 +# - ::0 +# port: 7777 +# +# o SBI Server(https://:443) +# sbi: +# tls: +# key: nrf.key +# pem: nrf.pem +# +# o SBI Server(https://127.0.0.1:443, http://[::1]:80) +# sbi: +# - addr: 127.0.0.1 +# tls: +# key: nrf.key +# pem: nrf.pem +# - addr: ::1 +# +# o SBI Server(http://nrf.open5gs.org:80) +# sbi: +# name: nrf.open5gs.org +# +# o SBI Server(http://127.0.0.1:7777) +# sbi: +# - addr: 127.0.0.1 +# port: 7777 +# +# o SBI Server(http://:80) +# sbi: +# dev: eth0 +# +nrf: + sbi: + addr: + - 127.0.0.1 + - ::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 SGW per MME +# sgw: 32 +# o Maximum Number of PGW per MME +# pgw: 32 +# o Maximum Number of VLR per MME +# vlr: 32 +# o Maximum Number of eNodeB per MME +# enb: 32 +# o Maximum Number of UE per eNodeB +# ue: 128 +# +max: + +# +# pool: +# +# o The Number of Default Memory Pool Size +# +# - Pool-size 128 => 8192 Number +# - Pool-size 256 => 4096 Number +# - Pool-size 512 => 2048 Number +# - Pool-size 1024 => 1024 Number +# - Pool-size 2048 => 512 Number +# - Pool-size 8192 => 128 Number +# - Pool-size 1024*1024 => 8 Number +# +# 128: 8192 +# 256: 4096 +# 512: 2048 +# 1024: 1024 +# 2048: 512 +# 8192: 128 +# big: 8 +# +# o Memory of Packet Buffering in SGW +# - Maximum Number of packet(SDU size = 8Kbytes) pool in SGW +# - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes +# +# packet: 65536 +# +pool: + +# +# time: +# +# o NF Instance Validity (Default : 3600 seconds = 1 hour) +# +# o NF Instance Validity (10 seconds) +# nf_instance: +# validity: 10 +# +# o Subscription Validity (Default : 86400 seconds = 1 day) +# +# o Subscription Validity (Disabled) +# subscription: +# validity: 0 +# +# o Subscription Validity (3600 seconds = 1 hour) +# subscription: +# validity: 3600 +# +time: diff --git a/configs/open5gs/pcrf.yaml.in b/configs/open5gs/pcrf.yaml.in index 724e5f376..ba5a93f1a 100644 --- a/configs/open5gs/pcrf.yaml.in +++ b/configs/open5gs/pcrf.yaml.in @@ -46,7 +46,6 @@ pcrf: # o Disable Stateless Address Autoconfiguration for IPv6 # no_slaac: true # -# parameter: # @@ -91,4 +90,5 @@ max: # - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes # # packet: 65536 +# pool: diff --git a/configs/open5gs/pgw.yaml.in b/configs/open5gs/pgw.yaml.in index cc4d96ec4..1bdf52567 100644 --- a/configs/open5gs/pgw.yaml.in +++ b/configs/open5gs/pgw.yaml.in @@ -186,7 +186,6 @@ pgw: # o Disable Stateless Address Autoconfiguration for IPv6 # no_slaac: true # -# parameter: # @@ -231,4 +230,5 @@ max: # - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes # # packet: 65536 +# pool: diff --git a/configs/open5gs/sgw.yaml.in b/configs/open5gs/sgw.yaml.in index 1e642be4f..4cdd52d16 100644 --- a/configs/open5gs/sgw.yaml.in +++ b/configs/open5gs/sgw.yaml.in @@ -82,7 +82,6 @@ sgw: # o Disable Stateless Address Autoconfiguration for IPv6 # no_slaac: true # -# parameter: no_ipv6: true @@ -128,4 +127,5 @@ max: # - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes # # packet: 65536 +# pool: diff --git a/configs/open5gs/smf.yaml.in b/configs/open5gs/smf.yaml.in index bff20df5d..78c1cf632 100644 --- a/configs/open5gs/smf.yaml.in +++ b/configs/open5gs/smf.yaml.in @@ -23,6 +23,45 @@ logger: # # smf: # +# +# +# 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: smf.key +# pem: smf.pem +# +# o SBI Server(https://127.0.0.3:443, http://[::1]:80) +# sbi: +# - addr: 127.0.0.3 +# tls: +# key: smf.key +# pem: smf.pem +# - addr: ::1 +# +# o SBI Server(http://smf.open5gs.org:80) +# sbi: +# name: smf.open5gs.org +# +# o SBI Server(http://127.0.0.3:7777) +# sbi: +# - addr: 127.0.0.3 +# port: 7777 +# +# o SBI Server(http://:80) +# sbi: +# dev: eth0 +# # # # o PFCP Server(127.0.0.3:8805, ::1:8805) @@ -141,7 +180,9 @@ logger: # - ::1 # smf: - freeDiameter: @sysconfdir@/freeDiameter/pgw.conf + sbi: + - addr: 127.0.0.3 + port: 7777 gtpc: - addr: 127.0.0.3 - addr: ::1 @@ -157,20 +198,54 @@ smf: - 2001:4860:4860::8888 - 2001:4860:4860::8844 mtu: 1400 + freeDiameter: @sysconfdir@/freeDiameter/pgw.conf + +# +# nrf: +# +# > +# +# o SBI Client(http://127.0.0.1:7777) +# sbi: +# addr: 127.0.0.1 +# port: 7777 +# +# o SBI Client(https://127.0.0.1:443, http://nrf.open5gs.org:80) +# sbi: +# - addr: 127.0.0.1 +# 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.1:80 is selected. +# +# sbi: +# addr: +# - 127.0.0.1 +# - fe80::1%@loopback_devname@ +# +nrf: + sbi: + addr: + - 127.0.0.1 + - ::1 + port: 7777 # # upf: # # > # -# o PFCP Client(127.0.0.2:8805) +# o PFCP Client(127.0.0.4:8805) # # pfcp: -# addr: 127.0.0.2 +# addr: 127.0.0.4 # upf: pfcp: - addr: 127.0.0.2 + addr: 127.0.0.4 # # parameter: @@ -193,7 +268,6 @@ upf: # o Disable Stateless Address Autoconfiguration for IPv6 # no_slaac: true # -# parameter: # @@ -238,4 +312,19 @@ max: # - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes # # packet: 65536 +# pool: + +# +# time: +# +# o NF Instance Heartbeat (Default : 3 seconds) +# +# o NF Instance Heartbeat (Disabled) +# nf_instance: +# heartbeat: 0 +# +# o NF Instance Heartbeat (5 seconds) +# nf_instance: +# heartbeat: 5 +time: diff --git a/configs/open5gs/upf.yaml.in b/configs/open5gs/upf.yaml.in index ec46c6603..397c37af3 100644 --- a/configs/open5gs/upf.yaml.in +++ b/configs/open5gs/upf.yaml.in @@ -26,32 +26,32 @@ logger: # # # -# o PFCP Server(127.0.0.2:8805) +# o PFCP Server(127.0.0.4:8805) # pfcp: -# addr: 127.0.0.2 +# addr: 127.0.0.4 # # > # -# o GTP-U Server(127.0.0.3:2152, [::1]:2152) +# o GTP-U Server(127.0.0.4:2152, [::1]:2152) # gtpu: # - addr: -# - 127.0.0.3 +# - 127.0.0.4 # - ::1 # -# o Same configuration(127.0.0.3:2152, [::1]:2152) as below. +# o Same configuration(127.0.0.4:2152, [::1]:2152) as below. # gtpu: # name: localhost # # o User Plane IP Resource information # gtpu: # - addr: -# - 127.0.0.3 +# - 127.0.0.4 # - ::1 # teid_range_indication: 4 # teid_range: 10 # network_instance: internet # source_interface: 0 -# - addr: 127.0.0.4 +# - addr: 127.0.10.4 # teid_range_indication: 4 # teid_range: 5 # network_instance: ims @@ -59,10 +59,10 @@ logger: # upf: pfcp: - addr: 127.0.0.2 + addr: 127.0.0.4 gtpu: - addr: - - 127.0.0.3 + - 127.0.0.4 - ::1 pdn: diff --git a/debian/changelog b/debian/changelog index bf5f7a594..fd1b2be9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +open5gs (1.2.5) unstable; urgency=medium + + * NRF is added + + -- Sukchan Lee Mon, 18 May 2020 13:14:54 -0400 + open5gs (1.2.4~eoan) eoan; urgency=medium * Bug Fixed diff --git a/debian/control b/debian/control index f55d097d6..dc63ccf41 100644 --- a/debian/control +++ b/debian/control @@ -17,6 +17,8 @@ Build-Depends: debhelper (>= 11), libbson-dev, libsctp-dev, libyaml-dev, + libmicrohttpd-dev, + libcurl4-gnutls-dev, Standards-Version: 4.3.0 Rules-Requires-Root: no Homepage: https://open5gs.org diff --git a/docker/centos/7/base/Dockerfile b/docker/centos/7/base/Dockerfile index 1e979d8e9..89f4969ea 100644 --- a/docker/centos/7/base/Dockerfile +++ b/docker/centos/7/base/Dockerfile @@ -15,6 +15,7 @@ RUN yum -y install \ flex \ bison \ git \ + meson \ lksctp-tools-devel \ libidn-devel \ gnutls-devel \ @@ -22,7 +23,7 @@ RUN yum -y install \ openssl-devel \ cyrus-sasl-devel \ libyaml-devel \ - iproute \ - mongo-c-driver-devel - -RUN pip3 install --upgrade pip && pip install meson + mongo-c-driver-devel \ + libmicrohttpd-devel \ + libcurl-devel \ + iproute diff --git a/docker/centos/latest/base/Dockerfile b/docker/centos/latest/base/Dockerfile index ae89b2649..77448a441 100644 --- a/docker/centos/latest/base/Dockerfile +++ b/docker/centos/latest/base/Dockerfile @@ -9,6 +9,11 @@ RUN dnf -y install epel-release && \ dnf config-manager --set-enabled PowerTools && \ dnf -y update +RUN dnf -y install \ + https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm && \ + dnf config-manager --set-enabled elrepo-testing && \ + dnf -y update + RUN dnf -y install \ python3 \ ninja-build \ @@ -23,7 +28,9 @@ RUN dnf -y install \ openssl-devel \ cyrus-sasl-devel \ libyaml-devel \ - iproute \ - mongo-c-driver-devel + mongo-c-driver-devel \ + libmicrohttpd-devel \ + libcurl-devel \ + iproute -RUN pip3 install --upgrade pip && pip install meson +RUN dnf -y install meson diff --git a/docker/fedora/31 b/docker/fedora/31 new file mode 120000 index 000000000..b9bc2fdcb --- /dev/null +++ b/docker/fedora/31 @@ -0,0 +1 @@ +latest \ No newline at end of file diff --git a/docker/fedora/latest/base/Dockerfile b/docker/fedora/latest/base/Dockerfile index 39cac3518..dc311df09 100644 --- a/docker/fedora/latest/base/Dockerfile +++ b/docker/fedora/latest/base/Dockerfile @@ -18,7 +18,9 @@ RUN dnf -y install \ openssl-devel \ cyrus-sasl-devel \ libyaml-devel \ - iproute \ - mongo-c-driver-devel + mongo-c-driver-devel \ + libmicrohttpd-devel \ + libcurl-devel \ + iproute -RUN pip3 install --upgrade pip && pip install meson +RUN dnf -y install meson diff --git a/docker/fedora/latest/dev/Dockerfile b/docker/fedora/latest/dev/Dockerfile index a54b2b881..337f05af8 100644 --- a/docker/fedora/latest/dev/Dockerfile +++ b/docker/fedora/latest/dev/Dockerfile @@ -6,6 +6,7 @@ FROM ${username}/${dist}-${tag}-open5gs-base MAINTAINER Sukchan Lee RUN dnf -y install \ + findutils \ cscope \ vim \ sudo \ diff --git a/docker/ubuntu/latest/base/Dockerfile b/docker/ubuntu/latest/base/Dockerfile index de6ddff66..0180cf961 100644 --- a/docker/ubuntu/latest/base/Dockerfile +++ b/docker/ubuntu/latest/base/Dockerfile @@ -25,6 +25,8 @@ RUN apt-get update && \ libmongoc-dev \ libbson-dev \ libyaml-dev \ + libmicrohttpd-dev \ + libcurl4-gnutls-dev \ iproute2 \ ca-certificates \ netbase \ diff --git a/docs/_docs/guide/02-building-open5gs-from-sources.md b/docs/_docs/guide/02-building-open5gs-from-sources.md index 5fb2d0f9f..f1f9f97ff 100644 --- a/docs/_docs/guide/02-building-open5gs-from-sources.md +++ b/docs/_docs/guide/02-building-open5gs-from-sources.md @@ -40,7 +40,7 @@ $ sudo ip link set ogstun up Install the dependencies for building the source code. ```bash -$ sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev meson +$ sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libmicrohttpd-dev libcurl4-gnutls-dev meson ``` Git clone. diff --git a/docs/_docs/platform/02-centos.md b/docs/_docs/platform/02-centos.md index 542682fab..fd571682a 100644 --- a/docs/_docs/platform/02-centos.md +++ b/docs/_docs/platform/02-centos.md @@ -23,8 +23,13 @@ EOF' Install MongoDB with Package Manager. ```bash -sudo yum -y install mongodb-org -sudo systemctl start mongod (if '/usr/bin/mongod' is not running) +sudo dnf -y install mongodb-org +``` + +Run MongoDB server. +```bash +$ mkdir -p ./data/db +$ mongod --dbpath ./data/db ``` ### Setting up TUN device (No persistent after rebooting) @@ -85,15 +90,21 @@ $ sudo dnf config-manager --set-enabled PowerTools $ sudo update ``` -Install the depedencies for building the source code. +Configure ELRepo(with testing) package. ```bash -$ sudo dnf install python3 ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel iproute mongo-c-driver-devel +$ sudo dnf install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm +$ sudo dnf config-manager --set-enabled elrepo-testing +$ sudo dnf update ``` -Install Meson using Python. +Install the depedencies for building the source code. ```bash -$ sudo pip3 install --upgrade pip -$ sudo pip install meson +$ sudo dnf install python3 ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel iproute +``` + +Install Meson +```bash +$ sudo dnf install meson ``` Git clone. diff --git a/docs/_docs/platform/03-fedora.md b/docs/_docs/platform/03-fedora.md index f6367dc5f..8ae7c3f00 100644 --- a/docs/_docs/platform/03-fedora.md +++ b/docs/_docs/platform/03-fedora.md @@ -67,13 +67,12 @@ $ ip link show Install the depedencies for building the source code. ```bash -$ sudo dnf install python3 ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel iproute mongo-c-driver-devel +$ sudo dnf install python3 ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel iproute ``` -Install Meson using Python. +Install Meson ```bash -$ sudo pip3 install --upgrade pip -$ sudo pip install meson +$ sudo dnf install meson ``` Git clone. diff --git a/docs/_docs/platform/04-freebsd.md b/docs/_docs/platform/04-freebsd.md index 0771d7b17..5b388eafb 100644 --- a/docs/_docs/platform/04-freebsd.md +++ b/docs/_docs/platform/04-freebsd.md @@ -45,7 +45,7 @@ $ sudo sysctl -w net.inet.ip.forwarding=1 Install the depedencies for building the source code. ```bash -$ sudo pkg install py36-pip ninja gcc bison gsed pkgconf git mongo-c-driver gnutls libgcrypt libidn libyaml +$ sudo pkg install py36-pip ninja gcc bison gsed pkgconf git mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd curl ``` Install Meson using Python. diff --git a/docs/_docs/platform/05-macosx.md b/docs/_docs/platform/05-macosx.md index 9bdd865e2..82b254faf 100644 --- a/docs/_docs/platform/05-macosx.md +++ b/docs/_docs/platform/05-macosx.md @@ -63,7 +63,7 @@ $ sudo pfctl -e -f /etc/pf.anchors/org.open5gs Install the depedencies for building the source code. ```bash -$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml pkg-config +$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd curl pkg-config ``` Install Meson using Homebrew. diff --git a/lib/app/ogs-app.h b/lib/app/ogs-app.h index 60cf5a302..a9cc52ecb 100644 --- a/lib/app/ogs-app.h +++ b/lib/app/ogs-app.h @@ -57,6 +57,9 @@ void pgw_terminate(void); int pcrf_initialize(void); void pcrf_terminate(void); +int nrf_initialize(void); +void nrf_terminate(void); + int smf_initialize(void); void smf_terminate(void); diff --git a/lib/app/ogs-config.c b/lib/app/ogs-config.c index 6e837f834..26e593299 100644 --- a/lib/app/ogs-config.c +++ b/lib/app/ogs-config.c @@ -140,6 +140,7 @@ static void recalculate_pool_size(void) self.pool.ue = self.max.ue * self.max.enb; self.pool.pfcp = ogs_max(self.max.smf, self.max.upf); + self.pool.sbi = self.pool.pfcp; self.pool.sess = self.pool.ue * OGS_MAX_NUM_OF_SESS; self.pool.bearer = self.pool.sess * MAX_NUM_OF_BEARER; self.pool.tunnel = self.pool.bearer * MAX_NUM_OF_TUNNEL; @@ -175,6 +176,10 @@ static int config_prepare(void) recalculate_pool_size(); + self.time.nf_instance.heartbeat = 3; /* 3 second */ + self.time.nf_instance.validity = 3600; /* 3600 seconds = 1 hour */ + self.time.subscription.validity = 86400; /* 86400 seconds = 1 day */ + return OGS_OK; } @@ -187,6 +192,15 @@ static int ogs_app_ctx_validation(void) return OGS_ERROR; } + if (self.time.nf_instance.validity == 0) { + ogs_error("NF Instance validity-time should not 0"); + ogs_error("time:"); + ogs_error(" nf_instance:"); + ogs_error(" validity: 0"); + + return OGS_ERROR; + } + return OGS_OK; } int ogs_config_parse() @@ -358,8 +372,49 @@ int ogs_config_parse() } else ogs_warn("unknown key `%s`", pool_key); } + } else if (!strcmp(root_key, "time")) { + ogs_yaml_iter_t time_iter; + ogs_yaml_iter_recurse(&root_iter, &time_iter); + while (ogs_yaml_iter_next(&time_iter)) { + const char *time_key = ogs_yaml_iter_key(&time_iter); + ogs_assert(time_key); + if (!strcmp(time_key, "nf_instance")) { + ogs_yaml_iter_t sbi_iter; + ogs_yaml_iter_recurse(&time_iter, &sbi_iter); + + while (ogs_yaml_iter_next(&sbi_iter)) { + const char *sbi_key = + ogs_yaml_iter_key(&sbi_iter); + ogs_assert(sbi_key); + + if (!strcmp(sbi_key, "heartbeat")) { + const char *v = ogs_yaml_iter_value(&sbi_iter); + if (v) self.time.nf_instance.heartbeat = atoi(v); + } else if (!strcmp(sbi_key, "validity")) { + const char *v = ogs_yaml_iter_value(&sbi_iter); + if (v) self.time.nf_instance.validity = atoi(v); + } else + ogs_warn("unknown key `%s`", sbi_key); + } + } else if (!strcmp(time_key, "subscription")) { + ogs_yaml_iter_t sbi_iter; + ogs_yaml_iter_recurse(&time_iter, &sbi_iter); + + while (ogs_yaml_iter_next(&sbi_iter)) { + const char *sbi_key = + ogs_yaml_iter_key(&sbi_iter); + ogs_assert(sbi_key); + + if (!strcmp(sbi_key, "validity")) { + const char *v = ogs_yaml_iter_value(&sbi_iter); + if (v) self.time.subscription.validity = atoi(v); + } else + ogs_warn("unknown key `%s`", sbi_key); + } + } else + ogs_warn("unknown key `%s`", time_key); + } } - } rv = ogs_app_ctx_validation(); diff --git a/lib/app/ogs-config.h b/lib/app/ogs-config.h index 5440781c1..27ee75a99 100644 --- a/lib/app/ogs-config.h +++ b/lib/app/ogs-config.h @@ -78,11 +78,22 @@ typedef struct ogs_config_s { int ue; int pfcp; + int sbi; int sess; int bearer; int tunnel; int pf; } pool; + + struct { + struct { + int heartbeat; + int validity; + } nf_instance; + struct { + int validity; + } subscription; + } time; } ogs_config_t; int ogs_config_init(void); diff --git a/lib/core/meson.build b/lib/core/meson.build index f47f9de01..ca8ade4e7 100644 --- a/lib/core/meson.build +++ b/lib/core/meson.build @@ -202,9 +202,9 @@ ogs_libcore_conf.set('OGS_BIG_ENDIAN', 4321) ogs_libcore_conf.set('OGS_LITTLE_ENDIAN', 1234) if host_machine.endian() == 'big' - ogs_libcore_conf.set('OGS_BYTE_ORDER', 'OGS_BIG_ENDIAN') + ogs_libcore_conf.set('OGS_BYTE_ORDER', 'OGS_BIG_ENDIAN') else - ogs_libcore_conf.set('OGS_BYTE_ORDER', 'OGS_LITTLE_ENDIAN') + ogs_libcore_conf.set('OGS_BYTE_ORDER', 'OGS_LITTLE_ENDIAN') endif if host_system == 'windows' @@ -235,6 +235,7 @@ libcore_sources = files(''' ogs-rbtree.h ogs-timer.h ogs-rand.h + ogs-uuid.h ogs-thread.h ogs-signal.h ogs-process.h @@ -269,6 +270,7 @@ libcore_sources = files(''' ogs-rbtree.c ogs-timer.c ogs-rand.c + ogs-uuid.c ogs-thread.c ogs-signal.c ogs-process.c @@ -295,6 +297,13 @@ libcore_sources = files(''' abts.c '''.split()) +if have_func_epoll_ctl + libcore_sources += files('ogs-epoll.c') +endif +if have_func_kqueue + libcore_sources += files('ogs-kqueue.c') +endif + libcore_inc = include_directories('.') libcore = library('ogscore', diff --git a/lib/core/ogs-conv.c b/lib/core/ogs-conv.c index 73b43dd22..cbf07cb18 100644 --- a/lib/core/ogs-conv.c +++ b/lib/core/ogs-conv.c @@ -131,3 +131,7 @@ void *ogs_buffer_to_bcd(uint8_t *in, int in_len, void *out) return out; } +char ogs_from_hex(char ch) +{ + return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10; +} diff --git a/lib/core/ogs-conv.h b/lib/core/ogs-conv.h index 217468c4b..5e5396425 100644 --- a/lib/core/ogs-conv.h +++ b/lib/core/ogs-conv.h @@ -36,6 +36,8 @@ uint64_t ogs_buffer_to_uint64(void *buffer, int size); void *ogs_bcd_to_buffer(const char *in, void *out, int *out_len); void *ogs_buffer_to_bcd(uint8_t *in, int in_len, void *out); +char ogs_from_hex(char ch); + #ifdef __cplusplus } #endif diff --git a/lib/core/ogs-core.h b/lib/core/ogs-core.h index 0089a2faf..c3ad7658c 100644 --- a/lib/core/ogs-core.h +++ b/lib/core/ogs-core.h @@ -37,6 +37,7 @@ #include "core/ogs-pkbuf.h" #include "core/ogs-memory.h" #include "core/ogs-rand.h" +#include "core/ogs-uuid.h" #include "core/ogs-rbtree.h" #include "core/ogs-timer.h" #include "core/ogs-thread.h" diff --git a/lib/core/ogs-epoll.c b/lib/core/ogs-epoll.c index 2ce394d55..3fd7fe610 100644 --- a/lib/core/ogs-epoll.c +++ b/lib/core/ogs-epoll.c @@ -30,7 +30,7 @@ static void epoll_init(ogs_pollset_t *pollset); static void epoll_cleanup(ogs_pollset_t *pollset); -static int epoll_add(ogs_poll_t *poll, short when); +static int epoll_add(ogs_poll_t *poll); static int epoll_remove(ogs_poll_t *poll); static int epoll_process(ogs_pollset_t *pollset, ogs_time_t timeout); @@ -45,9 +45,15 @@ const ogs_pollset_actions_t ogs_epoll_actions = { ogs_notify_pollset, }; +struct epoll_map_s { + ogs_poll_t *read; + ogs_poll_t *write; +}; + struct epoll_context_s { int epfd; + ogs_hash_t *map_hash; struct epoll_event *event_list; }; @@ -64,6 +70,9 @@ static void epoll_init(ogs_pollset_t *pollset) ogs_core()->socket.pool, sizeof(struct epoll_event)); ogs_assert(context->event_list); + context->map_hash = ogs_hash_make(); + ogs_assert(context->map_hash); + context->epfd = epoll_create(ogs_core()->socket.pool); ogs_assert(context->epfd >= 0); @@ -81,15 +90,17 @@ static void epoll_cleanup(ogs_pollset_t *pollset) ogs_notify_final(pollset); close(context->epfd); ogs_free(context->event_list); + ogs_hash_destroy(context->map_hash); ogs_free(context); } -static int epoll_add(ogs_poll_t *poll, short when) +static int epoll_add(ogs_poll_t *poll) { + int rv, op; ogs_pollset_t *pollset = NULL; struct epoll_context_s *context = NULL; - int rv; + struct epoll_map_s *map = NULL; struct epoll_event ee; ogs_assert(poll); @@ -98,17 +109,33 @@ static int epoll_add(ogs_poll_t *poll, short when) context = pollset->context; ogs_assert(context); + map = ogs_hash_get(context->map_hash, &poll->fd, sizeof(poll->fd)); + if (!map) { + map = ogs_calloc(1, sizeof(*map)); + ogs_assert(map); + + op = EPOLL_CTL_ADD; + ogs_hash_set(context->map_hash, &poll->fd, sizeof(poll->fd), map); + } else { + op = EPOLL_CTL_MOD; + } + + if (poll->when & OGS_POLLIN) + map->read = poll; + if (poll->when & OGS_POLLOUT) + map->write = poll; + ee.events = 0; - if (when == OGS_POLLIN) + if (map->read) ee.events |= (EPOLLIN|EPOLLRDHUP); - if (when == OGS_POLLOUT) + if (map->write) ee.events |= EPOLLOUT; + ee.data.ptr = map; - ee.data.ptr = poll; - - rv = epoll_ctl(context->epfd, EPOLL_CTL_ADD, poll->fd, &ee); + rv = epoll_ctl(context->epfd, op, poll->fd, &ee); if (rv < 0) { - ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, "epoll_ctl failed"); + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "epoll_ctl[%d] failed", op); return OGS_ERROR; } @@ -117,9 +144,10 @@ static int epoll_add(ogs_poll_t *poll, short when) static int epoll_remove(ogs_poll_t *poll) { - int rv; + int rv, op; ogs_pollset_t *pollset = NULL; struct epoll_context_s *context = NULL; + struct epoll_map_s *map = NULL; struct epoll_event ee; ogs_assert(poll); @@ -128,13 +156,35 @@ static int epoll_remove(ogs_poll_t *poll) context = pollset->context; ogs_assert(context); - ee.events = 0; - ee.data.ptr = NULL; + map = ogs_hash_get(context->map_hash, &poll->fd, sizeof(poll->fd)); + ogs_assert(map); - rv = epoll_ctl(context->epfd, EPOLL_CTL_DEL, poll->fd, &ee); + if (poll->when & OGS_POLLIN) + map->read = NULL; + if (poll->when & OGS_POLLOUT) + map->write = NULL; + + ee.events = 0; + if (map->read) + ee.events |= (EPOLLIN|EPOLLRDHUP); + if (map->write) + ee.events |= EPOLLOUT; + + if (map->read || map->write) { + op = EPOLL_CTL_MOD; + ee.data.ptr = map; + } else { + op = EPOLL_CTL_DEL; + ee.data.ptr = NULL; + + ogs_free(map); + ogs_hash_set(context->map_hash, &poll->fd, sizeof(poll->fd), NULL); + } + + rv = epoll_ctl(context->epfd, op, poll->fd, &ee); if (rv < 0) { ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, - "epoll_remove failed"); + "epoll_remove[%d] failed", op); return OGS_ERROR; } @@ -163,7 +213,7 @@ static int epoll_process(ogs_pollset_t *pollset, ogs_time_t timeout) } for (i = 0; i < num_of_poll; i++) { - ogs_poll_t *poll = NULL; + struct epoll_map_s *map = NULL; uint32_t received; short when = 0; @@ -182,11 +232,16 @@ static int epoll_process(ogs_pollset_t *pollset, ogs_time_t timeout) if (!when) continue; - poll = context->event_list[i].data.ptr; - ogs_assert(poll); + map = context->event_list[i].data.ptr; + ogs_assert(map); - if (poll->handler) { - poll->handler(when, poll->fd, poll->data); + if (map->read && map->write && map->read == map->write) { + map->read->handler(when, map->read->fd, map->read->data); + } else { + if (map->read && (when & OGS_POLLIN)) + map->read->handler(when, map->read->fd, map->read->data); + if (map->write && (when & OGS_POLLOUT)) + map->write->handler(when, map->write->fd, map->write->data); } } diff --git a/lib/core/ogs-kqueue.c b/lib/core/ogs-kqueue.c index c9e23b93d..96babcbc2 100644 --- a/lib/core/ogs-kqueue.c +++ b/lib/core/ogs-kqueue.c @@ -31,7 +31,7 @@ static void kqueue_init(ogs_pollset_t *pollset); static void kqueue_cleanup(ogs_pollset_t *pollset); -static int kqueue_add(ogs_poll_t *poll, short when); +static int kqueue_add(ogs_poll_t *poll); static int kqueue_remove(ogs_poll_t *poll); static int kqueue_process(ogs_pollset_t *pollset, ogs_time_t timeout); @@ -123,14 +123,14 @@ static int kqueue_set(ogs_poll_t *poll, int filter, int flags) return OGS_OK; } -static int kqueue_add(ogs_poll_t *poll, short when) +static int kqueue_add(ogs_poll_t *poll) { int filter = 0; - if (when & OGS_POLLIN) { + if (poll->when & OGS_POLLIN) { filter = EVFILT_READ; } - if (when & OGS_POLLOUT) { + if (poll->when & OGS_POLLOUT) { filter = EVFILT_WRITE; } diff --git a/lib/core/ogs-macros.h b/lib/core/ogs-macros.h index fa4f27fd3..3ecf11dd3 100644 --- a/lib/core/ogs-macros.h +++ b/lib/core/ogs-macros.h @@ -164,6 +164,19 @@ extern "C" { #define ogs_container_of(ptr, type, member) \ (type *)((u_char *)ptr - offsetof(type, member)) +#ifndef SWITCH_CASE_INIT +#define SWITCH_CASE_INIT + #define SWITCH(X) {char *__switch_p__, __switch_next__; \ + for (__switch_p__ = (char *)X, __switch_next__ = 1; \ + __switch_p__; \ + __switch_p__ = 0, __switch_next__ = 1) { { + #define CASE(X) } if (!__switch_next__ || \ + !(__switch_next__ = \ + strcmp(__switch_p__, X))) { + #define DEFAULT } { + #define END }}} +#endif + #ifdef __cplusplus } #endif diff --git a/lib/core/ogs-poll-private.h b/lib/core/ogs-poll-private.h index 248439584..7c79b6722 100644 --- a/lib/core/ogs-poll-private.h +++ b/lib/core/ogs-poll-private.h @@ -32,6 +32,7 @@ typedef struct ogs_poll_s { ogs_lnode_t node; int index; + short when; ogs_socket_t fd; ogs_poll_handler_f handler; void *data; diff --git a/lib/core/ogs-poll.c b/lib/core/ogs-poll.c index 6721c31c4..eec887e8e 100644 --- a/lib/core/ogs-poll.c +++ b/lib/core/ogs-poll.c @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +#include "core-config-private.h" + #include "ogs-core.h" #include "ogs-poll-private.h" @@ -80,13 +82,14 @@ ogs_poll_t *ogs_pollset_add(ogs_pollset_t *pollset, short when, rc = ogs_closeonexec(fd); ogs_assert(rc == OGS_OK); + poll->when = when; poll->fd = fd; poll->handler = handler; poll->data = data; poll->pollset = pollset; - rc = ogs_pollset_actions.add(poll, when); + rc = ogs_pollset_actions.add(poll); if (rc != OGS_OK) { ogs_error("cannot add poll"); ogs_pool_free(&pollset->pool, poll); diff --git a/lib/core/ogs-poll.h b/lib/core/ogs-poll.h index 6646e2fdd..c199eff43 100644 --- a/lib/core/ogs-poll.h +++ b/lib/core/ogs-poll.h @@ -44,7 +44,7 @@ typedef struct ogs_pollset_actions_s { void (*init)(ogs_pollset_t *pollset); void (*cleanup)(ogs_pollset_t *pollset); - int (*add)(ogs_poll_t *poll, short when); + int (*add)(ogs_poll_t *poll); int (*remove)(ogs_poll_t *poll); int (*poll)(ogs_pollset_t *pollset, ogs_time_t timeout); diff --git a/lib/core/ogs-select.c b/lib/core/ogs-select.c index 549393f43..cf5aa334e 100644 --- a/lib/core/ogs-select.c +++ b/lib/core/ogs-select.c @@ -28,7 +28,7 @@ static void select_init(ogs_pollset_t *pollset); static void select_cleanup(ogs_pollset_t *pollset); -static int select_add(ogs_poll_t *poll, short when); +static int select_add(ogs_poll_t *poll); static int select_remove(ogs_poll_t *poll); static int select_process(ogs_pollset_t *pollset, ogs_time_t timeout); @@ -83,7 +83,7 @@ static void select_cleanup(ogs_pollset_t *pollset) ogs_free(context); } -static int select_add(ogs_poll_t *poll, short when) +static int select_add(ogs_poll_t *poll) { ogs_pollset_t *pollset = NULL; struct select_context_s *context = NULL; @@ -94,11 +94,11 @@ static int select_add(ogs_poll_t *poll, short when) context = pollset->context; ogs_assert(context); - if (when & OGS_POLLIN) { + if (poll->when & OGS_POLLIN) { FD_SET(poll->fd, &context->master_read_fd_set); } - if (when & OGS_POLLOUT) { + if (poll->when & OGS_POLLOUT) { FD_SET(poll->fd, &context->master_write_fd_set); } @@ -121,8 +121,11 @@ static int select_remove(ogs_poll_t *poll) context = pollset->context; ogs_assert(context); - FD_CLR(poll->fd, &context->master_read_fd_set); - FD_CLR(poll->fd, &context->master_write_fd_set); + if (poll->when & OGS_POLLIN) + FD_CLR(poll->fd, &context->master_read_fd_set); + + if (poll->when & OGS_POLLOUT) + FD_CLR(poll->fd, &context->master_write_fd_set); if (context->max_fd == poll->fd) { context->max_fd = -1; diff --git a/lib/core/ogs-sockaddr.c b/lib/core/ogs-sockaddr.c index 169d954ee..2c02945a0 100644 --- a/lib/core/ogs-sockaddr.c +++ b/lib/core/ogs-sockaddr.c @@ -579,3 +579,32 @@ int ogs_ipsubnet(ogs_ipsubnet_t *ipsub, return OGS_OK; } + +char *ogs_gethostname(ogs_sockaddr_t *addr) +{ + int rv; + char hostname[OGS_MAX_FQDN_LEN]; + + ogs_assert(addr); + + if (!addr->hostname) + return NULL; + + rv = ogs_getnameinfo(hostname, OGS_MAX_FQDN_LEN, addr, 0); + if (rv == OGS_OK && strcmp(addr->hostname, hostname) == 0) + return addr->hostname; + + return NULL; +} + +char *ogs_ipstrdup(ogs_sockaddr_t *addr) +{ + char buf[OGS_ADDRSTRLEN + 1]; + + ogs_assert(addr); + memset(buf, 0, sizeof(buf)); + + OGS_ADDR(addr, buf); + + return ogs_strdup(buf); +} diff --git a/lib/core/ogs-sockaddr.h b/lib/core/ogs-sockaddr.h index 2c0028353..72dcbd056 100644 --- a/lib/core/ogs-sockaddr.h +++ b/lib/core/ogs-sockaddr.h @@ -94,6 +94,9 @@ bool ogs_sockaddr_is_equal(void *p, void *q); int ogs_ipsubnet(ogs_ipsubnet_t *ipsub, const char *ipstr, const char *mask_or_numbits); +char *ogs_gethostname(ogs_sockaddr_t *addr); +char *ogs_ipstrdup(ogs_sockaddr_t *addr); + #ifdef __cplusplus } #endif diff --git a/lib/core/ogs-strings.c b/lib/core/ogs-strings.c index 00f69d9b9..e59173e62 100644 --- a/lib/core/ogs-strings.c +++ b/lib/core/ogs-strings.c @@ -154,3 +154,77 @@ char *ogs_cpystrn(char *dst, const char *src, size_t dst_size) return (d); } + +/* + * char *ogs_msprintf(const char *message, ...) + * char *mstrcatf(char *source, const char *message, ...) + * + * Orcania library + * Copyright 2015-2018 Nicolas Mora + * License: LGPL-2.1 + * + * https://github.com/babelouest/orcania.git + */ +char *ogs_msprintf(const char *message, ...) +{ + va_list argp, argp_cpy; + size_t out_len = 0; + char *out = NULL; + if (message != NULL) { + va_start(argp, message); + va_copy(argp_cpy, argp); /* We make a copy because + in some architectures, + vsnprintf can modify argp */ + out_len = vsnprintf(NULL, 0, message, argp); + out = ogs_malloc(out_len + sizeof(char)); + if (out == NULL) { + va_end(argp); + va_end(argp_cpy); + return NULL; + } + vsnprintf(out, (out_len + sizeof(char)), message, argp_cpy); + va_end(argp); + va_end(argp_cpy); + } + return out; +} + +char *ogs_mstrcatf(char *source, const char *message, ...) +{ + va_list argp, argp_cpy; + char *out = NULL, *message_formatted = NULL; + size_t message_formatted_len = 0, out_len = 0; + + if (message != NULL) { + if (source != NULL) { + va_start(argp, message); + va_copy(argp_cpy, argp); /* We make a copy because + in some architectures, + vsnprintf can modify argp */ + message_formatted_len = vsnprintf(NULL, 0, message, argp); + message_formatted = ogs_malloc(message_formatted_len+sizeof(char)); + if (message_formatted != NULL) { + vsnprintf(message_formatted, + (message_formatted_len+sizeof(char)), message, argp_cpy); + out = ogs_msprintf("%s%s", source, message_formatted); + ogs_free(message_formatted); + ogs_free(source); + } + va_end(argp); + va_end(argp_cpy); + } else { + va_start(argp, message); + va_copy(argp_cpy, argp); /* We make a copy because + in some architectures, + vsnprintf can modify argp */ + out_len = vsnprintf(NULL, 0, message, argp); + out = ogs_malloc(out_len+sizeof(char)); + if (out != NULL) { + vsnprintf(out, (out_len+sizeof(char)), message, argp_cpy); + } + va_end(argp); + va_end(argp_cpy); + } + } + return out; +} diff --git a/lib/core/ogs-strings.h b/lib/core/ogs-strings.h index ddc17b19a..8caf7ad2e 100644 --- a/lib/core/ogs-strings.h +++ b/lib/core/ogs-strings.h @@ -55,6 +55,11 @@ void *ogs_memdup(const void *m, size_t n); char *ogs_cpystrn(char *dst, const char *src, size_t dst_size); +char *ogs_msprintf(const char *message, ...) + OGS_GNUC_PRINTF(1, 2); +char *ogs_mstrcatf(char *source, const char *message, ...) + OGS_GNUC_PRINTF(2, 3); + #ifdef __cplusplus } #endif diff --git a/lib/core/ogs-time.h b/lib/core/ogs-time.h index 30aadba11..f19aa6fe5 100644 --- a/lib/core/ogs-time.h +++ b/lib/core/ogs-time.h @@ -67,6 +67,13 @@ void ogs_gmtime(time_t s, struct tm *tm); void ogs_msleep(time_t msec); void ogs_usleep(time_t usec); +#define OGS_TIME_ISO8601_FORMATTED_LENGTH 128 +#define OGS_TIME_ISO8601_FORMAT "%Y-%m-%dT%H:%M:%S%z" + +#define ogs_mktime mktime +#define ogs_strptime strptime +#define ogs_strftime strftime + #ifdef __cplusplus } #endif diff --git a/lib/core/ogs-timer.c b/lib/core/ogs-timer.c index 95ce03dce..71737a1e1 100644 --- a/lib/core/ogs-timer.c +++ b/lib/core/ogs-timer.c @@ -87,7 +87,6 @@ ogs_timer_t *ogs_timer_add( { ogs_timer_t *timer = NULL; ogs_assert(manager); - ogs_assert(cb); ogs_pool_alloc(&manager->pool, &timer); ogs_assert(timer); @@ -117,7 +116,7 @@ void ogs_timer_start(ogs_timer_t *timer, ogs_time_t duration) { ogs_timer_mgr_t *manager = NULL; ogs_assert(timer); - ogs_assert(duration > 0); + ogs_assert(duration); manager = timer->manager; ogs_assert(manager); diff --git a/lib/core/ogs-uuid.c b/lib/core/ogs-uuid.c new file mode 100644 index 000000000..78e9ed3b7 --- /dev/null +++ b/lib/core/ogs-uuid.c @@ -0,0 +1,250 @@ +/* + * 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 "core-config-private.h" + +#if HAVE_CTYPE_H +#include +#endif + +#include "ogs-core.h" + +#define NODE_LENGTH 6 + +static int uuid_state_seqnum; +static unsigned char uuid_state_node[NODE_LENGTH] = { 0 }; + +static void get_random_info(unsigned char node[NODE_LENGTH]) +{ + ogs_random(node, NODE_LENGTH); +} + +/* This implementation generates a random node ID instead of a + system-dependent call to get IEEE node ID. This is also more secure: + we aren't passing out our MAC address. */ +static void get_pseudo_node_identifier(unsigned char *node) +{ + get_random_info(node); + node[0] |= 0x01; /* this designates a random multicast node ID */ +} + +/* true_random -- generate a crypto-quality random number. */ +static int true_random(void) +{ + unsigned char buf[2]; + + ogs_random(buf, 2); + return (buf[0] << 8) | buf[1]; +} + +static void init_state(void) +{ + uuid_state_seqnum = true_random(); + get_pseudo_node_identifier(uuid_state_node); +} + +static void get_system_time(uint64_t *uuid_time) +{ + struct timeval tv; + + /* ### fix this call to be more portable? */ + ogs_gettimeofday(&tv); + *uuid_time = tv.tv_sec * OGS_USEC_PER_SEC + tv.tv_usec; + + /* Offset between UUID formatted times and Unix formatted times. + UUID UTC base time is October 15, 1582. + Unix base time is January 1, 1970. */ + *uuid_time = (*uuid_time * 10) + 0x01B21DD213814000; +} + +static void get_current_time(uint64_t *timestamp) +{ + /* ### this needs to be made thread-safe! */ + + uint64_t time_now; + static uint64_t time_last = 0; + static uint64_t fudge = 0; + + get_system_time(&time_now); + + /* if clock reading changed since last UUID generated... */ + if (time_last != time_now) { + /* The clock reading has changed since the last UUID was generated. + Reset the fudge factor. if we are generating them too fast, then + the fudge may need to be reset to something greater than zero. */ + if (time_last + fudge > time_now) + fudge = time_last + fudge - time_now + 1; + else + fudge = 0; + time_last = time_now; + } + else { + /* We generated two really fast. Bump the fudge factor. */ + ++fudge; + } + + *timestamp = time_now + fudge; +} + +void ogs_uuid_get(ogs_uuid_t *uuid) +{ + uint64_t timestamp; + unsigned char *d = NULL; + int version = 4; + + ogs_assert(uuid); + d = uuid->data; + + if (!uuid_state_node[0]) + init_state(); + + get_current_time(×tamp); + + /* time_low, uint32 */ + d[3] = (unsigned char)timestamp; + d[2] = (unsigned char)(timestamp >> 8); + d[1] = (unsigned char)(timestamp >> 16); + d[0] = (unsigned char)(timestamp >> 24); + + /* time_mid, uint16 */ + d[5] = (unsigned char)(timestamp >> 32); + d[4] = (unsigned char)(timestamp >> 40); + + /* Set the four most significant bits (bits 12 through 15) of the + * time_hi_and_version field to the 4-bit version number from + * Section 4.1.3. */ + d[7] = (unsigned char)(timestamp >> 48); + d[6] = (unsigned char)(((timestamp >> 56) & 0x0F) | (version << 4)); + + /* Set the two most significant bits (bits 6 and 7) of the + * clock_seq_hi_and_reserved to zero and one, respectively. */ + d[8] = (unsigned char)(((uuid_state_seqnum >> 8) & 0x3F) | 0x80); + + /* clock_seq_low, uint8 */ + d[9] = (unsigned char)uuid_state_seqnum; + + /* node, byte[6] */ + memcpy(&d[10], uuid_state_node, NODE_LENGTH); +} + +void ogs_uuid_format(char *buffer, const ogs_uuid_t *uuid) +{ + const unsigned char *d = uuid->data; + + sprintf(buffer, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x", + d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], + d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); +} + +/* convert a pair of hex digits to an integer value [0,255] */ +#if 'A' == 65 +static unsigned char parse_hexpair(const char *s) +{ + int result; + int temp; + + result = s[0] - '0'; + if (result > 48) + result = (result - 39) << 4; + else if (result > 16) + result = (result - 7) << 4; + else + result = result << 4; + + temp = s[1] - '0'; + if (temp > 48) + result |= temp - 39; + else if (temp > 16) + result |= temp - 7; + else + result |= temp; + + return (unsigned char)result; +} +#else +static unsigned char parse_hexpair(const char *s) +{ + int result; + + if (isdigit(*s)) { + result = (*s - '0') << 4; + } + else { + if (isupper(*s)) { + result = (*s - 'A' + 10) << 4; + } + else { + result = (*s - 'a' + 10) << 4; + } + } + + ++s; + if (isdigit(*s)) { + result |= (*s - '0'); + } + else { + if (isupper(*s)) { + result |= (*s - 'A' + 10); + } + else { + result |= (*s - 'a' + 10); + } + } + + return (unsigned char)result; +} +#endif + +int ogs_uuid_parse(ogs_uuid_t *uuid, const char *uuid_str) +{ + int i; + unsigned char *d = uuid->data; + + for (i = 0; i < 36; ++i) { + char c = uuid_str[i]; + if (!isxdigit(c) && + !(c == '-' && (i == 8 || i == 13 || i == 18 || i == 23))) + /* ### need a better value */ + return OGS_ERROR; + } + if (uuid_str[36] != '\0') { + /* ### need a better value */ + return OGS_ERROR; + } + + d[0] = parse_hexpair(&uuid_str[0]); + d[1] = parse_hexpair(&uuid_str[2]); + d[2] = parse_hexpair(&uuid_str[4]); + d[3] = parse_hexpair(&uuid_str[6]); + + d[4] = parse_hexpair(&uuid_str[9]); + d[5] = parse_hexpair(&uuid_str[11]); + + d[6] = parse_hexpair(&uuid_str[14]); + d[7] = parse_hexpair(&uuid_str[16]); + + d[8] = parse_hexpair(&uuid_str[19]); + d[9] = parse_hexpair(&uuid_str[21]); + + for (i = 6; i--;) + d[10 + i] = parse_hexpair(&uuid_str[i*2+24]); + + return OGS_OK; +} diff --git a/lib/core/ogs-uuid.h b/lib/core/ogs-uuid.h new file mode 100644 index 000000000..99104416c --- /dev/null +++ b/lib/core/ogs-uuid.h @@ -0,0 +1,45 @@ +/* + * 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 . + */ + +#if !defined(OGS_CORE_INSIDE) && !defined(OGS_CORE_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_UUID_H +#define OGS_UUID_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define OGS_UUID_FORMATTED_LENGTH 36 + +typedef struct { + unsigned char data[16]; /**< the actual UUID */ +} ogs_uuid_t; + +void ogs_uuid_get(ogs_uuid_t *uuid); +void ogs_uuid_format(char *buffer, const ogs_uuid_t *uuid); +int ogs_uuid_parse(ogs_uuid_t *uuid, const char *uuid_str); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_UUID_H */ diff --git a/lib/meson.build b/lib/meson.build index 8a3b7b363..2ef04d00a 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -29,3 +29,4 @@ subdir('s1ap') subdir('nas') subdir('gtp') subdir('pfcp') +subdir('sbi') diff --git a/lib/pfcp/context.c b/lib/pfcp/context.c index 31103eee8..7da015a3a 100644 --- a/lib/pfcp/context.c +++ b/lib/pfcp/context.c @@ -35,12 +35,12 @@ static OGS_POOL(ogs_pfcp_bar_pool, ogs_pfcp_bar_t); static OGS_POOL(ogs_pfcp_dev_pool, ogs_pfcp_dev_t); static OGS_POOL(ogs_pfcp_subnet_pool, ogs_pfcp_subnet_t); -static int context_initiaized = 0; +static int context_initialized = 0; void ogs_pfcp_context_init(int num_of_gtpu_resource) { struct timeval tv; - ogs_assert(context_initiaized == 0); + ogs_assert(context_initialized == 0); /* Initialize SMF context */ memset(&self, 0, sizeof(ogs_pfcp_context_t)); @@ -88,12 +88,12 @@ void ogs_pfcp_context_init(int num_of_gtpu_resource) self.pdr_hash = ogs_hash_make(); - context_initiaized = 1; + context_initialized = 1; } void ogs_pfcp_context_final(void) { - ogs_assert(context_initiaized == 1); + ogs_assert(context_initialized == 1); ogs_assert(self.pdr_hash); ogs_hash_destroy(self.pdr_hash); @@ -116,7 +116,7 @@ void ogs_pfcp_context_final(void) ogs_pool_final(&ogs_pfcp_node_pool); ogs_pool_final(&ogs_pfcp_gtpu_resource_pool); - context_initiaized = 0; + context_initialized = 0; } ogs_pfcp_context_t *ogs_pfcp_self(void) diff --git a/lib/pfcp/conv.c b/lib/pfcp/conv.c index 4d3450dce..fac7ee709 100644 --- a/lib/pfcp/conv.c +++ b/lib/pfcp/conv.c @@ -24,30 +24,29 @@ int ogs_pfcp_sockaddr_to_node_id( ogs_pfcp_node_id_t *node_id, int *len) { const int hdr_len = 1; - int rv; - char hostname[OGS_MAX_FQDN_LEN]; + char *hostname = NULL; ogs_assert(node_id); memset(node_id, 0, sizeof *node_id); - if (addr && addr->hostname) { - rv = ogs_getnameinfo(hostname, OGS_MAX_FQDN_LEN, addr, 0); - if (rv == OGS_OK && strcmp(addr->hostname, hostname) == 0) { + if (addr) { + hostname = ogs_gethostname(addr); + if (hostname) { node_id->type = OGS_PFCP_NODE_ID_FQDN; *len = ogs_fqdn_build(node_id->fqdn, - addr->hostname, strlen(addr->hostname)) + hdr_len; + hostname, strlen(hostname)) + hdr_len; return OGS_OK; } } - if (addr6 && addr6->hostname) { - rv = ogs_getnameinfo(hostname, OGS_MAX_FQDN_LEN, addr6, 0); - if (rv == OGS_OK && strcmp(addr6->hostname, hostname) == 0) { + if (addr6) { + hostname = ogs_gethostname(addr6); + if (hostname) { node_id->type = OGS_PFCP_NODE_ID_FQDN; *len = ogs_fqdn_build(node_id->fqdn, - addr6->hostname, strlen(addr6->hostname)) + hdr_len; + hostname, strlen(hostname)) + hdr_len; return OGS_OK; } diff --git a/lib/sbi/client.c b/lib/sbi/client.c new file mode 100644 index 000000000..91ec16e94 --- /dev/null +++ b/lib/sbi/client.c @@ -0,0 +1,674 @@ +/* + * 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 "ogs-app.h" +#include "ogs-sbi.h" + +#include "sbi-private.h" +#include "curl/curl.h" + +typedef struct sockinfo_s { + ogs_poll_t *poll; + curl_socket_t sockfd; + int action; + CURL *easy; + ogs_sbi_client_t *client; +} sockinfo_t; + +typedef struct connection_s { + ogs_lnode_t lnode; + + void *data; + + char *method; + + int num_of_header; + char **headers; + struct curl_slist *header_list; + + char *memory; + size_t size; + + ogs_timer_t *timer; + CURL *easy; + char error[CURL_ERROR_SIZE]; + + ogs_sbi_client_t *client; +} connection_t; + +static OGS_POOL(client_pool, ogs_sbi_client_t); +static OGS_POOL(sockinfo_pool, sockinfo_t); +static OGS_POOL(connection_pool, connection_t); + +static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data); +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp); +static int multi_timer_cb(CURLM *multi, long timeout_ms, void *cbp); +static void multi_timer_expired(void *data); +static void connection_timer_expired(void *data); +static void connection_remove_all(ogs_sbi_client_t *client); + +void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool) +{ + curl_global_init(CURL_GLOBAL_DEFAULT); + + ogs_list_init(&ogs_sbi_self()->client_list); + ogs_pool_init(&client_pool, ogs_config()->pool.sbi); + + ogs_pool_init(&sockinfo_pool, num_of_sockinfo_pool); + ogs_pool_init(&connection_pool, num_of_connection_pool); + +} +void ogs_sbi_client_final(void) +{ + ogs_sbi_client_remove_all(); + + ogs_pool_final(&client_pool); + ogs_pool_final(&sockinfo_pool); + ogs_pool_final(&connection_pool); + + curl_global_cleanup(); +} + +ogs_sbi_client_t *ogs_sbi_client_add(ogs_sockaddr_t *addr) +{ + ogs_sbi_client_t *client = NULL; + CURLM *multi = NULL; + + ogs_assert(addr); + + ogs_pool_alloc(&client_pool, &client); + ogs_assert(client); + memset(client, 0, sizeof(ogs_sbi_client_t)); + + ogs_copyaddrinfo(&client->addr, addr); + + ogs_list_init(&client->connection_list); + + client->t_curl = ogs_timer_add( + ogs_sbi_self()->timer_mgr, multi_timer_expired, client); + + multi = client->multi = curl_multi_init(); + ogs_assert(multi); + curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, sock_cb); + curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, client); + curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); + curl_multi_setopt(multi, CURLMOPT_TIMERDATA, client); + + ogs_list_add(&ogs_sbi_self()->client_list, client); + + return client; +} + +ogs_sbi_client_t *ogs_sbi_client_find_or_add(char *url) +{ + int rv; + + ogs_sbi_client_t *client = NULL; + struct yuarel yuarel; + char *p = ogs_strdup(url); + int port; + + ogs_sockaddr_t *addr = NULL; + + rv = yuarel_parse(&yuarel, p); + if (rv != OGS_OK) { + ogs_free(p); + ogs_error("yuarel_parse() failed [%s]", url); + return NULL; + } + + if (!yuarel.scheme) { + ogs_error("No http.scheme found [%s]", url); + ogs_free(p); + return NULL; + } + + if (strcmp(yuarel.scheme, "https") == 0) { + port = OGS_SBI_HTTPS_PORT; + } else if (strcmp(yuarel.scheme, "http") == 0) { + port = OGS_SBI_HTTP_PORT; + } else { + ogs_error("Invalid http.scheme [%s:%s]", yuarel.scheme, url); + ogs_free(p); + return NULL; + } + + if (!yuarel.host) { + ogs_error("No http.host found [%s]", url); + ogs_free(p); + return NULL; + } + + if (yuarel.port) port = yuarel.port; + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, yuarel.host, port, 0); + if (rv != OGS_OK) { + ogs_error("ogs_getaddrinfo() failed [%s]", url); + ogs_free(p); + } + + client = ogs_sbi_client_find(addr); + if (!client) { + client = ogs_sbi_client_add(addr); + ogs_assert(client); + } + + ogs_freeaddrinfo(addr); + ogs_free(p); + + return client; +} + +void ogs_sbi_client_remove(ogs_sbi_client_t *client) +{ + ogs_assert(client); + + ogs_list_remove(&ogs_sbi_self()->client_list, client); + + connection_remove_all(client); + + ogs_assert(client->t_curl); + ogs_timer_delete(client->t_curl); + + ogs_assert(client->multi); + curl_multi_cleanup(client->multi); + + ogs_assert(client->addr); + ogs_freeaddrinfo(client->addr); + + ogs_pool_free(&client_pool, client); +} + +void ogs_sbi_client_remove_all(void) +{ + ogs_sbi_client_t *client = NULL, *next_client = NULL; + + ogs_list_for_each_safe(&ogs_sbi_self()->client_list, next_client, client) + ogs_sbi_client_remove(client); +} + +ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr) +{ + ogs_sbi_client_t *client = NULL; + + ogs_assert(addr); + + ogs_list_for_each(&ogs_sbi_self()->client_list, client) { + if (ogs_sockaddr_is_equal(client->addr, addr) == true) + break; + } + + return client; +} + +#define mycase(code) \ + case code: s = __STRING(code) + +static void mcode_or_die(const char *where, CURLMcode code) +{ + if(CURLM_OK != code) { + const char *s; + switch(code) { + mycase(CURLM_BAD_HANDLE); break; + mycase(CURLM_BAD_EASY_HANDLE); break; + mycase(CURLM_OUT_OF_MEMORY); break; + mycase(CURLM_INTERNAL_ERROR); break; + mycase(CURLM_UNKNOWN_OPTION); break; + mycase(CURLM_LAST); break; + default: s = "CURLM_unknown"; break; + mycase(CURLM_BAD_SOCKET); + ogs_error("ERROR: %s returns %s", where, s); + /* ignore this error */ + return; + } + ogs_fatal("ERROR: %s returns %s", where, s); + ogs_assert_if_reached(); + } +} + +static char *add_params_to_url(CURL *easy, char *url, ogs_hash_t *params) +{ + ogs_hash_index_t *hi; + int has_params = 0; + const char *fp = "?", *np = "&"; + + ogs_assert(easy); + ogs_assert(url); + ogs_assert(params); + ogs_assert(ogs_hash_count(params)); + + has_params = (strchr(url, '?') != NULL); + + for (hi = ogs_hash_first(params); hi; hi = ogs_hash_next(hi)) { + const char *key = NULL; + char *key_esc = NULL; + char *val = NULL; + char *val_esc = NULL; + + key = ogs_hash_this_key(hi); + ogs_assert(key); + val = ogs_hash_this_val(hi); + ogs_assert(val); + + key_esc = curl_easy_escape(easy, key, 0); + ogs_assert(key_esc); + val_esc = curl_easy_escape(easy, val, 0); + ogs_assert(val_esc); + + if (!has_params) { + url = ogs_mstrcatf(url, "%s%s=%s", fp, key_esc, val_esc); + has_params = 1; + } else { + url = ogs_mstrcatf(url, "%s%s=%s", np, key_esc, val_esc); + } + + curl_free(val_esc); + curl_free(key_esc); + } + + return url; +} + +static connection_t *connection_add(ogs_sbi_client_t *client, + ogs_sbi_request_t *request, void *data) +{ + ogs_hash_index_t *hi; + int i; + connection_t *conn = NULL; + CURLMcode rc; + + ogs_assert(client); + ogs_assert(request); + + ogs_pool_alloc(&connection_pool, &conn); + ogs_assert(conn); + memset(conn, 0, sizeof(connection_t)); + + ogs_assert(request->h.method); + conn->method = ogs_strdup(request->h.method); + + conn->num_of_header = ogs_hash_count(request->http.headers); + if (conn->num_of_header) { + conn->headers = ogs_calloc(conn->num_of_header, sizeof(char *)); + ogs_assert(conn->headers); + for (hi = ogs_hash_first(request->http.headers), i = 0; + hi && i < conn->num_of_header; hi = ogs_hash_next(hi), i++) { + const char *key = ogs_hash_this_key(hi); + char *val = ogs_hash_this_val(hi); + + conn->headers[i] = ogs_msprintf("%s: %s", key, val); + ogs_assert(conn->headers[i]); + conn->header_list = curl_slist_append( + conn->header_list, conn->headers[i]); + } + } + + conn->timer = ogs_timer_add( + ogs_sbi_self()->timer_mgr, connection_timer_expired, conn); + ogs_assert(conn->timer); + + /* If http response is not received within 1 second, + * we will discard this request. */ + ogs_timer_start(conn->timer, ogs_time_from_sec(1)); + + conn->easy = curl_easy_init(); + ogs_assert(conn->easy); + + /* HTTP Method */ + if (strcmp(request->h.method, OGS_SBI_HTTP_METHOD_PUT) == 0 || + strcmp(request->h.method, OGS_SBI_HTTP_METHOD_PATCH) == 0 || + strcmp(request->h.method, OGS_SBI_HTTP_METHOD_DELETE) == 0 || + strcmp(request->h.method, OGS_SBI_HTTP_METHOD_POST) == 0) { + + curl_easy_setopt(conn->easy, CURLOPT_CUSTOMREQUEST, request->h.method); + if (request->http.content) { + curl_easy_setopt(conn->easy, CURLOPT_HTTPHEADER, conn->header_list); + curl_easy_setopt(conn->easy, CURLOPT_POSTFIELDS, + request->http.content); + } + } + + if (ogs_hash_count(request->http.params)) { + request->h.url = add_params_to_url(conn->easy, + request->h.url, request->http.params); + } + + curl_easy_setopt(conn->easy, CURLOPT_URL, request->h.url); + + curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); + curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); + curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, conn); + curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); + + ogs_assert(client->multi); + rc = curl_multi_add_handle(client->multi, conn->easy); + mcode_or_die("connection_add: curl_multi_add_handle", rc); + + conn->client = client; + conn->data = data; + + ogs_list_add(&client->connection_list, conn); + + return conn; +} + +static void connection_remove(connection_t *conn) +{ + ogs_sbi_client_t *client = NULL; + int i; + + ogs_assert(conn); + client = conn->client; + ogs_assert(client); + + ogs_list_remove(&client->connection_list, conn); + + ogs_assert(conn->timer); + ogs_timer_delete(conn->timer); + + ogs_assert(conn->easy); + ogs_assert(client->multi); + curl_multi_remove_handle(client->multi, conn->easy); + curl_easy_cleanup(conn->easy); + + ogs_assert(conn->method); + ogs_free(conn->method); + + if (conn->num_of_header) { + for (i = 0; i < conn->num_of_header; i++) + ogs_free(conn->headers[i]); + ogs_free(conn->headers); + } + curl_slist_free_all(conn->header_list); + + if (conn->memory) + ogs_free(conn->memory); + + ogs_pool_free(&connection_pool, conn); +} + +static void connection_remove_all(ogs_sbi_client_t *client) +{ + connection_t *conn = NULL, *next_conn = NULL; + + ogs_assert(client); + + ogs_list_for_each_safe(&client->connection_list, next_conn, conn) + connection_remove(conn); +} + +static void connection_timer_expired(void *data) +{ + connection_t *conn = NULL; + + conn = data; + ogs_assert(conn); + + connection_remove(conn); +} + +static void check_multi_info(ogs_sbi_client_t *client) +{ + CURLM *multi = NULL; + CURLMsg *resource; + int pending; + CURL *easy = NULL; + CURLcode res; + connection_t *conn = NULL; + ogs_sbi_response_t *response = NULL; + + ogs_assert(client); + multi = client->multi; + ogs_assert(multi); + + while ((resource = curl_multi_info_read(multi, &pending))) { + char *url; + char *content_type = NULL; + long res_status; + ogs_assert(resource); + + switch (resource->msg) { + case CURLMSG_DONE: + easy = resource->easy_handle; + ogs_assert(easy); + + curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); + ogs_assert(conn); + + curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &url); + curl_easy_getinfo(easy, CURLINFO_RESPONSE_CODE, &res_status); + curl_easy_getinfo(easy, CURLINFO_CONTENT_TYPE, &content_type); + + res = resource->data.result; + if (res == CURLE_OK) { + response = ogs_sbi_response_new(); + ogs_assert(response); + + response->status = res_status; + + ogs_assert(conn->method); + response->h.method = ogs_strdup(conn->method); + + /* remove https://localhost:8000 */ + response->h.url = ogs_strdup(url); + + response->http.content = ogs_strdup(conn->memory); + response->http.content_length = conn->size; + + if (content_type) + ogs_sbi_header_set(response->http.headers, + "Content-Type", content_type); + + if (client->cb) + client->cb(response, conn->data); + else { + ogs_fatal("client callback is not registered"); + ogs_sbi_response_free(response); + ogs_assert_if_reached(); + } + } else + ogs_warn("[%d] %s", res, conn->error); + + connection_remove(conn); + break; + default: + ogs_error("Unknown CURL resource[%d]", resource->msg); + break; + } + } +} + +void ogs_sbi_client_send_request( + ogs_sbi_client_t *client, ogs_sbi_request_t *request, void *data) +{ + connection_t *conn = NULL; + + ogs_assert(client); + ogs_assert(request); + + if (request->h.url == NULL) { + request->h.url = ogs_sbi_client_uri(client, + request->h.service.name, request->h.api.version, + request->h.resource.name, request->h.resource.id); + } + + conn = connection_add(client, request, data); + ogs_assert(conn); + ogs_sbi_request_free(request); +} + +static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data) +{ + size_t realsize = 0; + connection_t *conn = NULL; + char *ptr = NULL; + + conn = data; + ogs_assert(conn); + + realsize = size * nmemb; + ptr = ogs_realloc(conn->memory, conn->size + realsize + 1); + if(!ptr) { + ogs_fatal("not enough memory (realloc returned NULL)"); + return 0; + } + + conn->memory = ptr; + memcpy(&(conn->memory[conn->size]), contents, realsize); + conn->size += realsize; + conn->memory[conn->size] = 0; + + return realsize; +} + +static void event_cb(short when, ogs_socket_t fd, void *data) +{ + sockinfo_t *sockinfo = NULL; + ogs_sbi_client_t *client = NULL; + CURLM *multi = NULL; + + CURLMcode rc; + int action = ((when & OGS_POLLIN) ? CURL_CSELECT_IN : 0) | + ((when & OGS_POLLOUT) ? CURL_CSELECT_OUT : 0); + + sockinfo = data; + ogs_assert(sockinfo); + client = sockinfo->client; + ogs_assert(client); + multi = client->multi; + ogs_assert(multi); + + rc = curl_multi_socket_action(multi, fd, action, &client->still_running); + mcode_or_die("event_cb: curl_multi_socket_action", rc); + + check_multi_info(client); + if (client->still_running <= 0) { + ogs_timer_t *timer; + + timer = client->t_curl; + ogs_assert(timer); + ogs_timer_stop(timer); + } +} + +/* Assign information to a sockinfo_t structure */ +static void sock_set(sockinfo_t *sockinfo, curl_socket_t s, + CURL *e, int act, ogs_sbi_client_t *client) +{ + int kind = ((act & CURL_POLL_IN) ? OGS_POLLIN : 0) | + ((act & CURL_POLL_OUT) ? OGS_POLLOUT : 0); + + if (sockinfo->sockfd) + ogs_pollset_remove(sockinfo->poll); + + sockinfo->sockfd = s; + sockinfo->action = act; + sockinfo->easy = e; + + sockinfo->poll = ogs_pollset_add( + ogs_sbi_self()->pollset, kind, s, event_cb, sockinfo); +} + +/* Initialize a new sockinfo_t structure */ +static void sock_new(curl_socket_t s, + CURL *easy, int action, ogs_sbi_client_t *client) +{ + sockinfo_t *sockinfo = NULL; + CURLM *multi = NULL; + + ogs_assert(client); + multi = client->multi; + ogs_assert(multi); + + ogs_pool_alloc(&sockinfo_pool, &sockinfo); + ogs_assert(sockinfo); + memset(sockinfo, 0, sizeof(sockinfo_t)); + + sockinfo->client = client; + sock_set(sockinfo, s, easy, action, client); + curl_multi_assign(multi, s, sockinfo); +} + +/* Clean up the sockinfo_t structure */ +static void sock_free(sockinfo_t *sockinfo, ogs_sbi_client_t *client) +{ + ogs_assert(sockinfo); + ogs_assert(sockinfo->poll); + + ogs_pollset_remove(sockinfo->poll); + ogs_pool_free(&sockinfo_pool, sockinfo); +} + +/* CURLMOPT_SOCKETFUNCTION */ +static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) +{ + ogs_sbi_client_t *client = (ogs_sbi_client_t *)cbp; + sockinfo_t *sockinfo = (sockinfo_t *) sockp; + + if (what == CURL_POLL_REMOVE) { + sock_free(sockinfo, client); + } else { + if (!sockinfo) { + sock_new(s, e, what, client); + } else { + sock_set(sockinfo, s, e, what, client); + } + } + return 0; +} + +static void multi_timer_expired(void *data) +{ + CURLMcode rc; + ogs_sbi_client_t *client = NULL; + CURLM *multi = NULL; + + client = data; + ogs_assert(client); + multi = client->multi; + ogs_assert(multi); + + rc = curl_multi_socket_action( + multi, CURL_SOCKET_TIMEOUT, 0, &client->still_running); + mcode_or_die("multi_timer_expired: curl_multi_socket_action", rc); + check_multi_info(client); +} + +static int multi_timer_cb(CURLM *multi, long timeout_ms, void *cbp) +{ + ogs_sbi_client_t *client = NULL; + ogs_timer_t *timer = NULL; + + client = cbp; + ogs_assert(client); + timer = client->t_curl; + ogs_assert(timer); + + if (timeout_ms > 0) { + ogs_timer_start(timer, ogs_time_from_msec(timeout_ms)); + } else if (timeout_ms == 0) { + /* libcurl wants us to timeout now. + * The closest we can do is to schedule the timer to fire in 1 us. */ + ogs_timer_start(timer, 1); + } else { + ogs_timer_stop(timer); + } + + return 0; +} diff --git a/lib/sbi/client.h b/lib/sbi/client.h new file mode 100644 index 000000000..3a17b7e21 --- /dev/null +++ b/lib/sbi/client.h @@ -0,0 +1,72 @@ +/* + * 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 . + */ + +#if !defined(OGS_SBI_INSIDE) && !defined(OGS_SBI_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_SBI_CLIENT_H +#define OGS_SBI_CLIENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define OGS_SETUP_SBI_CLIENT(__cTX, __pCLIENT) \ + do { \ + ogs_assert((__cTX)); \ + ogs_assert((__pCLIENT)); \ + (__cTX)->client = __pCLIENT; \ + } while(0) +typedef struct ogs_sbi_client_s { + ogs_lnode_t lnode; + + ogs_sockaddr_t *addr; + + struct { + const char *key; + const char *pem; + } tls; + + int (*cb)(ogs_sbi_response_t *response, void *data); + + ogs_timer_t *t_curl; /* timer for CURL */ + ogs_list_t connection_list; /* CURL connection list */ + + void *multi; /* CURL multi handle */ + int still_running; /* number of running CURL handle */ +} ogs_sbi_client_t; + +void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool); +void ogs_sbi_client_final(void); + +ogs_sbi_client_t *ogs_sbi_client_add(ogs_sockaddr_t *addr); +ogs_sbi_client_t *ogs_sbi_client_find_or_add(char *uri); +void ogs_sbi_client_remove(ogs_sbi_client_t *client); +void ogs_sbi_client_remove_all(void); +ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr); + +void ogs_sbi_client_send_request( + ogs_sbi_client_t *client, ogs_sbi_request_t *request, void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_CLIENT_H */ diff --git a/lib/sbi/context.c b/lib/sbi/context.c new file mode 100644 index 000000000..a1dbf72aa --- /dev/null +++ b/lib/sbi/context.c @@ -0,0 +1,903 @@ +/* + * 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 "app/ogs-app.h" +#include "ogs-sbi.h" + +int __ogs_sbi_domain; + +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(subscription_pool, ogs_sbi_subscription_t); + +static ogs_sbi_context_t self; + +static int context_initialized = 0; + +void ogs_sbi_context_init(ogs_pollset_t *pollset, ogs_timer_mgr_t *timer_mgr) +{ + ogs_assert(context_initialized == 0); + + /* Initialize SMF context */ + memset(&self, 0, sizeof(ogs_sbi_context_t)); + + ogs_assert(pollset); + self.pollset = pollset; + ogs_assert(timer_mgr); + self.timer_mgr = timer_mgr; + + ogs_log_install_domain(&__ogs_sbi_domain, "sbi", ogs_core()->log.level); + + /* FIXME : number of pool size */ + ogs_sbi_message_init(32, 32); + ogs_sbi_server_init(32); + ogs_sbi_client_init(512, 512); + + ogs_list_init(&self.nf_instance_list); + ogs_pool_init(&nf_instance_pool, ogs_config()->pool.sbi); + ogs_pool_init(&nf_service_pool, ogs_config()->pool.sbi); + + ogs_list_init(&self.subscription_list); + ogs_pool_init(&subscription_pool, ogs_config()->pool.sbi); + + ogs_uuid_get(&self.uuid); + ogs_uuid_format(self.nf_instance_id, &self.uuid); + + context_initialized = 1; +} + +void ogs_sbi_context_final(void) +{ + ogs_assert(context_initialized == 1); + + ogs_sbi_subscription_remove_all(); + ogs_pool_final(&subscription_pool); + + ogs_sbi_nf_instance_remove_all(); + ogs_pool_final(&nf_instance_pool); + ogs_pool_final(&nf_service_pool); + + ogs_sbi_client_final(); + ogs_sbi_server_final(); + ogs_sbi_message_final(); + + context_initialized = 0; +} + +ogs_sbi_context_t *ogs_sbi_self(void) +{ + return &self; +} + +static int ogs_sbi_context_prepare(void) +{ + self.http_port = OGS_SBI_HTTP_PORT; + self.https_port = OGS_SBI_HTTPS_PORT; + + self.content_encoding = "gzip"; + + return OGS_OK; +} + +static int ogs_sbi_context_validation(const char *local) +{ + if (ogs_list_first(&self.server_list) == NULL) { + ogs_error("No %s.sbi: in '%s'", local, ogs_config()->file); + return OGS_ERROR; + } + + return OGS_OK; +} + +int ogs_sbi_context_parse_config(const char *local, const char *remote) +{ + int rv; + yaml_document_t *document = NULL; + ogs_yaml_iter_t root_iter; + + document = ogs_config()->document; + ogs_assert(document); + + rv = ogs_sbi_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 (local && !strcmp(root_key, local)) { + ogs_yaml_iter_t local_iter; + ogs_yaml_iter_recurse(&root_iter, &local_iter); + while (ogs_yaml_iter_next(&local_iter)) { + const char *local_key = ogs_yaml_iter_key(&local_iter); + ogs_assert(local_key); + if (!strcmp(local_key, "sbi")) { + ogs_list_t list, list6; + ogs_socknode_t *node = NULL, *node6 = NULL; + + ogs_yaml_iter_t sbi_array, sbi_iter; + ogs_yaml_iter_recurse(&local_iter, &sbi_array); + do { + int family = AF_UNSPEC; + int i, num = 0; + const char *hostname[OGS_MAX_NUM_OF_HOSTNAME]; + uint16_t port = self.http_port; + const char *dev = NULL; + ogs_sockaddr_t *addr = NULL; + const char *key = NULL; + const char *pem = NULL; + + if (ogs_yaml_iter_type(&sbi_array) == + YAML_MAPPING_NODE) { + memcpy(&sbi_iter, &sbi_array, + sizeof(ogs_yaml_iter_t)); + } else if (ogs_yaml_iter_type(&sbi_array) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next(&sbi_array)) + break; + ogs_yaml_iter_recurse(&sbi_array, &sbi_iter); + } else if (ogs_yaml_iter_type(&sbi_array) == + YAML_SCALAR_NODE) { + break; + } else + ogs_assert_if_reached(); + + while (ogs_yaml_iter_next(&sbi_iter)) { + const char *sbi_key = + ogs_yaml_iter_key(&sbi_iter); + ogs_assert(sbi_key); + if (!strcmp(sbi_key, "family")) { + const char *v = ogs_yaml_iter_value(&sbi_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(sbi_key, "addr") || + !strcmp(sbi_key, "name")) { + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(&sbi_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(sbi_key, "port")) { + const char *v = ogs_yaml_iter_value(&sbi_iter); + if (v) { + port = atoi(v); + self.http_port = port; + } + } else if (!strcmp(sbi_key, "dev")) { + dev = ogs_yaml_iter_value(&sbi_iter); + } else if (!strcmp(sbi_key, "tls")) { + ogs_yaml_iter_t tls_iter; + ogs_yaml_iter_recurse(&sbi_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 + ogs_warn("unknown key `%s`", sbi_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_config()->parameter.no_ipv4 == 0) + ogs_socknode_add(&list, AF_INET, addr); + if (ogs_config()->parameter.no_ipv6 == 0) + ogs_socknode_add(&list6, AF_INET6, addr); + ogs_freeaddrinfo(addr); + } + + if (dev) { + rv = ogs_socknode_probe( + ogs_config()->parameter.no_ipv4 ? NULL : &list, + ogs_config()->parameter.no_ipv6 ? NULL : &list6, + dev, port); + ogs_assert(rv == OGS_OK); + } + + node = ogs_list_first(&list); + if (node) { + ogs_sbi_server_t *server = + ogs_sbi_server_add(node->addr); + ogs_assert(server); + + if (key) server->tls.key = key; + if (pem) server->tls.pem = pem; + } + node6 = ogs_list_first(&list6); + if (node6) { + ogs_sbi_server_t *server = + ogs_sbi_server_add(node6->addr); + ogs_assert(server); + + if (key) server->tls.key = key; + if (pem) server->tls.pem = pem; + } + + ogs_socknode_remove_all(&list); + ogs_socknode_remove_all(&list6); + } while (ogs_yaml_iter_type(&sbi_array) == + YAML_SEQUENCE_NODE); + + if (ogs_list_first(&self.server_list) == 0) { + ogs_list_init(&list); + ogs_list_init(&list6); + + rv = ogs_socknode_probe( + ogs_config()->parameter.no_ipv4 ? NULL : &list, + ogs_config()->parameter.no_ipv6 ? NULL : &list6, + NULL, self.http_port); + ogs_assert(rv == OGS_OK); + + node = ogs_list_first(&list); + if (node) ogs_sbi_server_add(node->addr); + node6 = ogs_list_first(&list6); + if (node6) ogs_sbi_server_add(node6->addr); + + ogs_socknode_remove_all(&list); + ogs_socknode_remove_all(&list6); + } + } + } + } else if (remote && !strcmp(root_key, remote)) { + ogs_yaml_iter_t remote_iter; + ogs_yaml_iter_recurse(&root_iter, &remote_iter); + while (ogs_yaml_iter_next(&remote_iter)) { + const char *remote_key = ogs_yaml_iter_key(&remote_iter); + ogs_assert(remote_key); + if (!strcmp(remote_key, "sbi")) { + ogs_yaml_iter_t sbi_array, sbi_iter; + ogs_yaml_iter_recurse(&remote_iter, &sbi_array); + do { + ogs_sbi_client_t *client = NULL; + ogs_sockaddr_t *addr = NULL; + int family = AF_UNSPEC; + int i, num = 0; + const char *hostname[OGS_MAX_NUM_OF_HOSTNAME]; + uint16_t port = self.http_port; + const char *key = NULL; + const char *pem = NULL; + + if (ogs_yaml_iter_type(&sbi_array) == + YAML_MAPPING_NODE) { + memcpy(&sbi_iter, &sbi_array, + sizeof(ogs_yaml_iter_t)); + } else if (ogs_yaml_iter_type(&sbi_array) == + YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next(&sbi_array)) + break; + ogs_yaml_iter_recurse(&sbi_array, &sbi_iter); + } else if (ogs_yaml_iter_type(&sbi_array) == + YAML_SCALAR_NODE) { + break; + } else + ogs_assert_if_reached(); + + while (ogs_yaml_iter_next(&sbi_iter)) { + const char *sbi_key = + ogs_yaml_iter_key(&sbi_iter); + ogs_assert(sbi_key); + if (!strcmp(sbi_key, "family")) { + const char *v = ogs_yaml_iter_value(&sbi_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(sbi_key, "addr") || + !strcmp(sbi_key, "name")) { + ogs_yaml_iter_t hostname_iter; + ogs_yaml_iter_recurse(&sbi_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(sbi_key, "port")) { + const char *v = ogs_yaml_iter_value(&sbi_iter); + if (v) port = atoi(v); + } else if (!strcmp(sbi_key, "tls")) { + ogs_yaml_iter_t tls_iter; + ogs_yaml_iter_recurse(&sbi_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 + ogs_warn("unknown key `%s`", sbi_key); + } + + addr = NULL; + for (i = 0; i < num; i++) { + rv = ogs_addaddrinfo(&addr, + family, hostname[i], port, 0); + ogs_assert(rv == OGS_OK); + } + + ogs_filter_ip_version(&addr, + ogs_config()->parameter.no_ipv4, + ogs_config()->parameter.no_ipv6, + ogs_config()->parameter.prefer_ipv4); + client = ogs_sbi_client_add(addr); + ogs_assert(client); + + if (key) client->tls.key = key; + if (pem) client->tls.pem = pem; + + ogs_freeaddrinfo(addr); + + } while (ogs_yaml_iter_type(&sbi_array) == + YAML_SEQUENCE_NODE); + } + } + } + } + + rv = ogs_sbi_context_validation(local); + if (rv != OGS_OK) return rv; + + return OGS_OK; +} + +ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(char *id) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(id); + + ogs_pool_alloc(&nf_instance_pool, &nf_instance); + ogs_assert(nf_instance); + memset(nf_instance, 0, sizeof(ogs_sbi_nf_instance_t)); + + nf_instance->id = ogs_strdup(id); + ogs_assert(nf_instance->id); + + nf_instance->time.heartbeat = ogs_config()->time.nf_instance.heartbeat; + + ogs_list_add(&ogs_sbi_self()->nf_instance_list, nf_instance); + + return nf_instance; +} + +void ogs_sbi_nf_instance_clear(ogs_sbi_nf_instance_t *nf_instance) +{ + int i; + + ogs_assert(nf_instance); + + for (i = 0; i < nf_instance->num_of_ipv4; i++) { + if (nf_instance->ipv4[i]) + ogs_freeaddrinfo(nf_instance->ipv4[i]); + } + for (i = 0; i < nf_instance->num_of_ipv6; i++) { + if (nf_instance->ipv6[i]) + ogs_freeaddrinfo(nf_instance->ipv6[i]); + } + + + ogs_sbi_nf_service_remove_all(nf_instance); +} + +void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_assert(nf_instance); + + ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance); + + ogs_sbi_subscription_remove_all_by_nf_instance_id(nf_instance->id); + + ogs_assert(nf_instance->id); + ogs_free(nf_instance->id); + + ogs_sbi_nf_instance_clear(nf_instance); + + ogs_pool_free(&nf_instance_pool, nf_instance); +} + +void ogs_sbi_nf_instance_remove_all(void) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL, *next_nf_instance = NULL; + + ogs_list_for_each_safe( + &ogs_sbi_self()->nf_instance_list, next_nf_instance, nf_instance) + ogs_sbi_nf_instance_remove(nf_instance); +} + +ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(id); + + ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) { + ogs_assert(nf_instance->id); + if (strcmp(nf_instance->id, id) == 0) + break; + } + + return nf_instance; +} + +ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_build_default( + OpenAPI_nf_type_e nf_type, ogs_sbi_client_t *client) +{ + ogs_sbi_server_t *server = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + char *hostname = NULL; + + nf_instance = ogs_sbi_nf_instance_add(ogs_sbi_self()->nf_instance_id); + ogs_assert(nf_instance); + + nf_instance->nf_type = nf_type; + nf_instance->nf_status = OpenAPI_nf_status_REGISTERED; + OGS_SETUP_SBI_CLIENT(nf_instance, client); + + hostname = NULL; + ogs_list_for_each(&ogs_sbi_self()->server_list, server) { + ogs_assert(server->addr); + + /* First FQDN is selected */ + if (!hostname) { + hostname = ogs_gethostname(server->addr); + if (hostname) + continue; + } + + if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { + ogs_sockaddr_t *addr = NULL; + ogs_copyaddrinfo(&addr, server->addr); + ogs_assert(addr); + + if (addr->ogs_sa_family == AF_INET) { + nf_instance->ipv4[nf_instance->num_of_ipv4] = addr; + nf_instance->num_of_ipv4++; + } else if (addr->ogs_sa_family == AF_INET6) { + nf_instance->ipv6[nf_instance->num_of_ipv6] = addr; + nf_instance->num_of_ipv6++; + } else + ogs_assert_if_reached(); + } + } + + if (hostname) + strcpy(nf_instance->fqdn, hostname); + + return nf_instance; +} + +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) +{ + ogs_sbi_nf_service_t *nf_service = NULL; + + ogs_assert(nf_instance); + ogs_assert(id); + ogs_assert(name); + + ogs_pool_alloc(&nf_service_pool, &nf_service); + ogs_assert(nf_service); + memset(nf_service, 0, sizeof(ogs_sbi_nf_service_t)); + + nf_service->id = ogs_strdup(id); + ogs_assert(nf_service->id); + nf_service->name = ogs_strdup(name); + ogs_assert(nf_service->name); + nf_service->scheme = scheme; + + nf_service->status = OpenAPI_nf_service_status_REGISTERED; + + nf_service->nf_instance = nf_instance; + + ogs_list_add(&nf_instance->nf_service_list, nf_service); + + return nf_service; +} + +void ogs_sbi_nf_service_add_version(ogs_sbi_nf_service_t *nf_service, + char *in_uri, char *full, char *expiry) +{ + ogs_assert(nf_service); + + ogs_assert(in_uri); + ogs_assert(full); + + if (nf_service->num_of_version < OGS_SBI_MAX_NUM_OF_SERVICE_VERSION) { + nf_service->versions[nf_service->num_of_version].in_uri = + ogs_strdup(in_uri); + nf_service->versions[nf_service->num_of_version].full = + ogs_strdup(full); + if (expiry) + nf_service->versions[nf_service->num_of_version].expiry = + ogs_strdup(expiry); + nf_service->num_of_version++; + } +} + +void ogs_sbi_nf_service_remove(ogs_sbi_nf_instance_t *nf_instance, + ogs_sbi_nf_service_t *nf_service) +{ + int i; + + ogs_assert(nf_instance); + ogs_assert(nf_service); + + ogs_list_remove(&nf_instance->nf_service_list, nf_service); + + ogs_assert(nf_service->id); + ogs_free(nf_service->id); + + ogs_assert(nf_service->name); + ogs_free(nf_service->name); + + for (i = 0; i < nf_service->num_of_version; i++) { + if (nf_service->versions[i].in_uri) + ogs_free(nf_service->versions[i].in_uri); + if (nf_service->versions[i].full) + ogs_free(nf_service->versions[i].full); + if (nf_service->versions[i].expiry) + ogs_free(nf_service->versions[i].expiry); + } + + for (i = 0; i < nf_service->num_of_addr; i++) { + if (nf_service->addr[i].ipv4) + ogs_freeaddrinfo(nf_service->addr[i].ipv4); + if (nf_service->addr[i].ipv6) + ogs_freeaddrinfo(nf_service->addr[i].ipv6); + } + + ogs_pool_free(&nf_service_pool, nf_service); +} + +void ogs_sbi_nf_service_remove_all(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_nf_service_t *nf_service = NULL, *next_nf_service = NULL; + + ogs_assert(nf_instance); + + ogs_list_for_each_safe(&nf_instance->nf_service_list, + next_nf_service, nf_service) + ogs_sbi_nf_service_remove(nf_instance, nf_service); +} + +ogs_sbi_nf_service_t *ogs_sbi_nf_service_find( + ogs_sbi_nf_instance_t *nf_instance, char *name) +{ + ogs_sbi_nf_service_t *nf_service = NULL; + + ogs_assert(nf_instance); + ogs_assert(name); + + ogs_list_for_each(&nf_instance->nf_service_list, nf_service) { + ogs_assert(nf_service->name); + if (strcmp(nf_service->name, name) == 0) + break; + } + + return nf_service; +} + +ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default( + ogs_sbi_nf_instance_t *nf_instance, + char *name, ogs_sbi_client_t *client) +{ + ogs_sbi_server_t *server = NULL; + ogs_sbi_nf_service_t *nf_service = NULL; + ogs_uuid_t uuid; + char id[OGS_UUID_FORMATTED_LENGTH + 1]; + char *hostname = NULL; + + ogs_assert(nf_instance); + ogs_assert(name); + ogs_assert(client); + + ogs_uuid_get(&uuid); + ogs_uuid_format(id, &uuid); + + nf_service = ogs_sbi_nf_service_add(nf_instance, id, name, + (client->tls.key && client->tls.pem) ? + OpenAPI_uri_scheme_https : OpenAPI_uri_scheme_http); + ogs_assert(nf_service); + OGS_SETUP_SBI_CLIENT(nf_service, client); + + hostname = NULL; + ogs_list_for_each(&ogs_sbi_self()->server_list, server) { + ogs_assert(server->addr); + + /* First FQDN is selected */ + if (!hostname) { + hostname = ogs_gethostname(server->addr); + if (hostname) + continue; + } + + if (nf_service->num_of_addr < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { + int port = 0; + ogs_sockaddr_t *addr = NULL; + ogs_copyaddrinfo(&addr, server->addr); + ogs_assert(addr); + + port = OGS_PORT(addr); + if (nf_service->scheme == OpenAPI_uri_scheme_https) { + if (port == OGS_SBI_HTTPS_PORT) port = 0; + } else if (nf_service->scheme == OpenAPI_uri_scheme_http) { + if (port == OGS_SBI_HTTP_PORT) port = 0; + } + + nf_service->addr[nf_service->num_of_addr].port = port; + if (addr->ogs_sa_family == AF_INET) { + nf_service->addr[nf_service->num_of_addr].ipv4 = addr; + } else if (addr->ogs_sa_family == AF_INET6) { + nf_service->addr[nf_service->num_of_addr].ipv6 = addr; + } else + ogs_assert_if_reached(); + + nf_service->num_of_addr++; + } + } + + if (hostname) + strcpy(nf_service->fqdn, hostname); + + return nf_service; +} + +static ogs_sbi_client_t *find_client_by_fqdn(char *fqdn, int port) +{ + int rv; + ogs_sockaddr_t *addr = NULL; + ogs_sbi_client_t *client = NULL; + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, fqdn, + port ? port : OGS_SBI_HTTPS_PORT, 0); + if (rv != OGS_OK) { + ogs_error("Invalid NFProfile.fqdn"); + return NULL; + } + + client = ogs_sbi_client_find(addr); + if (!client) { + client = ogs_sbi_client_add(addr); + ogs_assert(client); + } + + ogs_freeaddrinfo(addr); + + return client; +} + +ogs_sbi_client_t *ogs_sbi_nf_instance_find_client( + ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_client_t *client = NULL; + ogs_sockaddr_t *addr = NULL; + + if (strlen(nf_instance->fqdn)) + client = find_client_by_fqdn(nf_instance->fqdn, 0); + + if (!client) { + /* At this point, CLIENT selection method is very simple. */ + if (nf_instance->num_of_ipv4) addr = nf_instance->ipv4[0]; + if (nf_instance->num_of_ipv6) addr = nf_instance->ipv6[0]; + + if (addr) { + client = ogs_sbi_client_find(addr); + if (!client) { + client = ogs_sbi_client_add(addr); + ogs_assert(client); + } + } + } + + ogs_sbi_nf_service_find_client_all(nf_instance); + + return client; +} + +ogs_sbi_client_t *ogs_sbi_nf_service_find_client( + ogs_sbi_nf_service_t *nf_service) +{ + ogs_sbi_client_t *client = NULL; + ogs_sockaddr_t *addr = NULL; + + if (strlen(nf_service->fqdn)) + client = find_client_by_fqdn(nf_service->fqdn, 0); + + if (!client) { + /* At this point, CLIENT selection method is very simple. */ + if (nf_service->num_of_addr) { + addr = nf_service->addr[0].ipv6; + if (!addr) + addr = nf_service->addr[0].ipv4; + } + + if (addr) { + client = ogs_sbi_client_find(addr); + if (!client) { + client = ogs_sbi_client_add(addr); + ogs_assert(client); + } + } + } + + if (!client) { + ogs_sbi_nf_instance_t *nf_instance = NULL; + nf_instance = nf_service->nf_instance; + ogs_assert(nf_instance); + client = nf_instance->client; + } + + return client; +} + +void ogs_sbi_nf_service_find_client_all(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_nf_service_t *nf_service = NULL; + + ogs_assert(nf_instance); + + ogs_list_for_each(&nf_instance->nf_service_list, nf_service) + ogs_sbi_nf_service_find_client(nf_service); +} + +ogs_sbi_subscription_t *ogs_sbi_subscription_add(void) +{ + ogs_sbi_subscription_t *subscription = NULL; + + ogs_pool_alloc(&subscription_pool, &subscription); + ogs_assert(subscription); + memset(subscription, 0, sizeof(ogs_sbi_subscription_t)); + + subscription->time.validity = ogs_config()->time.subscription.validity; + + ogs_list_add(&ogs_sbi_self()->subscription_list, subscription); + + return subscription; +} + +void ogs_sbi_subscription_set_id(ogs_sbi_subscription_t *subscription, char *id) +{ + ogs_assert(subscription); + ogs_assert(id); + + subscription->id = ogs_strdup(id); + ogs_assert(subscription->id); +} + +void ogs_sbi_subscription_remove(ogs_sbi_subscription_t *subscription) +{ + ogs_assert(subscription); + + ogs_list_remove(&ogs_sbi_self()->subscription_list, subscription); + + if (subscription->id) + ogs_free(subscription->id); + + if (subscription->notification_uri) + ogs_free(subscription->notification_uri); + + if (subscription->nf_instance_id) + ogs_free(subscription->nf_instance_id); + + if (subscription->t_validity) + ogs_timer_delete(subscription->t_validity); + + ogs_pool_free(&subscription_pool, subscription); +} + +void ogs_sbi_subscription_remove_all_by_nf_instance_id(char *nf_instance_id) +{ + ogs_sbi_subscription_t *subscription = NULL, *next_subscription = NULL; + + ogs_assert(nf_instance_id); + + ogs_list_for_each_safe(&ogs_sbi_self()->subscription_list, + next_subscription, subscription) { + if (subscription->nf_instance_id && + strcmp(subscription->nf_instance_id, nf_instance_id) == 0) { + ogs_sbi_subscription_remove(subscription); + } + } +} + +void ogs_sbi_subscription_remove_all(void) +{ + ogs_sbi_subscription_t *subscription = NULL, *next_subscription = NULL; + + ogs_list_for_each_safe(&ogs_sbi_self()->subscription_list, + next_subscription, subscription) + ogs_sbi_subscription_remove(subscription); +} + +ogs_sbi_subscription_t *ogs_sbi_subscription_find(char *id) +{ + ogs_sbi_subscription_t *subscription = NULL; + + ogs_assert(id); + + ogs_list_for_each(&ogs_sbi_self()->subscription_list, subscription) { + ogs_assert(subscription->id); + if (strcmp(subscription->id, id) == 0) + break; + } + + return subscription; +} diff --git a/lib/sbi/context.h b/lib/sbi/context.h new file mode 100644 index 000000000..540ee300d --- /dev/null +++ b/lib/sbi/context.h @@ -0,0 +1,183 @@ +/* + * 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 . + */ + +#if !defined(OGS_SBI_INSIDE) && !defined(OGS_SBI_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_SBI_CONTEXT_H +#define OGS_SBI_CONTEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ogs_sbi_client_s ogs_sbi_client_t; +typedef struct ogs_sbi_context_s { + ogs_pollset_t *pollset; /* Poll Set for I/O Multiplexing */ + ogs_timer_mgr_t *timer_mgr; /* Timer Manager */ + + uint32_t http_port; /* SBI HTTP local port */ + uint32_t https_port; /* SBI HTTPS local port */ + + ogs_list_t server_list; + ogs_list_t client_list; + + ogs_uuid_t uuid; + char nf_instance_id[OGS_UUID_FORMATTED_LENGTH + 1]; + + ogs_list_t nf_instance_list; + ogs_list_t subscription_list; + + const char *content_encoding; +} ogs_sbi_context_t; + +typedef struct ogs_sbi_nf_instance_s { + ogs_lnode_t lnode; + + ogs_fsm_t sm; /* A state machine */ + ogs_timer_t *t_registration_interval; /* timer to retry + to register peer node */ +#define OGS_SBI_HEARTBEAT_RETRYCOUNT 4 + struct { + int heartbeat; + int validity; + } time; + + ogs_timer_t *t_heartbeat_interval; /* heartbeat interval */ + ogs_timer_t *t_heartbeat; /* check heartbeat */ + ogs_timer_t *t_validity; /* check validation */ + +#define NF_INSTANCE_IS_SELF(_iD) \ + strcmp((_iD), ogs_sbi_self()->nf_instance_id) == 0 +#define NF_INSTANCE_IS_OTHERS(_iD) \ + strcmp((_iD), ogs_sbi_self()->nf_instance_id) != 0 + + char *id; /* NFInstanceId */ + + OpenAPI_nf_type_e nf_type; + OpenAPI_nf_status_e nf_status; + + char fqdn[OGS_MAX_FQDN_LEN]; + +#define OGS_SBI_MAX_NUM_OF_IP_ADDRESS 8 + int num_of_ipv4; + ogs_sockaddr_t *ipv4[OGS_SBI_MAX_NUM_OF_IP_ADDRESS]; + int num_of_ipv6; + ogs_sockaddr_t *ipv6[OGS_SBI_MAX_NUM_OF_IP_ADDRESS]; + + ogs_list_t nf_service_list; + + void *client; /* only used in CLIENT */ +} ogs_sbi_nf_instance_t; + +typedef struct ogs_sbi_nf_service_s { + ogs_lnode_t lnode; + + char *id; + char *name; + OpenAPI_uri_scheme_e scheme; + + OpenAPI_nf_service_status_e status; + +#define OGS_SBI_MAX_NUM_OF_SERVICE_VERSION 8 + int num_of_version; + struct { + char *in_uri; + char *full; + char *expiry; + } versions[OGS_SBI_MAX_NUM_OF_SERVICE_VERSION]; + + char fqdn[OGS_MAX_FQDN_LEN]; + int num_of_addr; + struct { + ogs_sockaddr_t *ipv4; + ogs_sockaddr_t *ipv6; + int port; + } addr[OGS_SBI_MAX_NUM_OF_IP_ADDRESS]; + + /* Related Context */ + ogs_sbi_nf_instance_t *nf_instance; + void *client; +} ogs_sbi_nf_service_t; + +typedef struct ogs_sbi_subscription_s { + ogs_lnode_t lnode; + + struct { + int validity; + } time; + + ogs_timer_t *t_validity; /* check validation */ + + char *id; /* SubscriptionId */ + char *nf_instance_id; /* NFInstanceId */ + OpenAPI_nf_type_e nf_type; + OpenAPI_nf_status_e nf_status; + char *notification_uri; + + void *client; /* only used in SERVER */ +} ogs_sbi_subscription_t; + +void ogs_sbi_context_init(ogs_pollset_t *pollset, ogs_timer_mgr_t *timer_mgr); +void ogs_sbi_context_final(void); +ogs_sbi_context_t *ogs_sbi_self(void); +int ogs_sbi_context_parse_config(const char *local, const char *remote); + +ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(char *id); +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_build_default( + OpenAPI_nf_type_e nf_type, ogs_sbi_client_t *client); + +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); +void ogs_sbi_nf_service_add_version(ogs_sbi_nf_service_t *nf_service, + char *in_uri, char *full, char *expiry); +void ogs_sbi_nf_service_remove(ogs_sbi_nf_instance_t *nf_instance, + ogs_sbi_nf_service_t *nf_service); +void ogs_sbi_nf_service_remove_all(ogs_sbi_nf_instance_t *nf_instance); +ogs_sbi_nf_service_t *ogs_sbi_nf_service_find( + ogs_sbi_nf_instance_t *nf_instance, char *name); +ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default( + ogs_sbi_nf_instance_t *nf_instance, + char *name, ogs_sbi_client_t *client); + +ogs_sbi_client_t *ogs_sbi_nf_instance_find_client( + ogs_sbi_nf_instance_t *nf_instance); +ogs_sbi_client_t *ogs_sbi_nf_service_find_client( + ogs_sbi_nf_service_t *nf_service); +void ogs_sbi_nf_service_find_client_all(ogs_sbi_nf_instance_t *nf_instance); + +ogs_sbi_subscription_t *ogs_sbi_subscription_add(void); +void ogs_sbi_subscription_set_id( + ogs_sbi_subscription_t *subscription, char *id); +void ogs_sbi_subscription_remove(ogs_sbi_subscription_t *subscription); +void ogs_sbi_subscription_remove_all_by_nf_instance_id(char *nf_instance_id); +void ogs_sbi_subscription_remove_all(void); +ogs_sbi_subscription_t *ogs_sbi_subscription_find(char *id); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_CONTEXT_H */ diff --git a/lib/sbi/conv.c b/lib/sbi/conv.c new file mode 100644 index 000000000..3efeb5ecc --- /dev/null +++ b/lib/sbi/conv.c @@ -0,0 +1,192 @@ +/* + * 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 "ogs-sbi.h" + +#include "sbi-private.h" + +static char *ogs_uridup(bool https, ogs_sockaddr_t *addr, + const char *service_name, const char *api_version, + const char *resource_name, const char *resource_id) +{ + char buf[OGS_ADDRSTRLEN]; + char url[OGS_HUGE_LEN]; + char *p, *last; + + ogs_assert(addr); + ogs_assert(service_name); + ogs_assert(api_version); + ogs_assert(resource_name); + + p = url; + last = url + OGS_HUGE_LEN; + + /* HTTP scheme is selected based on TLS information */ + if (https == true) + p = ogs_slprintf(p, last, "https://"); + else + p = ogs_slprintf(p, last, "http://"); + + /* IP address */ + if (addr->ogs_sa_family == AF_INET6) + p = ogs_slprintf(p, last, "[%s]", OGS_ADDR(addr, buf)); + else + p = ogs_slprintf(p, last, "%s", OGS_ADDR(addr, buf)); + + /* Port number */ + if (OGS_PORT(addr) != OGS_SBI_HTTP_PORT) { + p = ogs_slprintf(p, last, ":%d", OGS_PORT(addr)); + } + + /* API */ + ogs_assert(service_name); + p = ogs_slprintf(p, last, "/%s", service_name); + ogs_assert(api_version); + p = ogs_slprintf(p, last, "/%s", api_version); + + /* Resource */ + ogs_assert(resource_name); + p = ogs_slprintf(p, last, "/%s", resource_name); + if (resource_id) + p = ogs_slprintf(p, last, "/%s", resource_id); + + return ogs_strdup(url); +} + +char *ogs_sbi_server_uri(ogs_sbi_server_t *server, + const char *service_name, const char *api_version, + const char *resource_name, const char *resource_id) +{ + bool https = false; + if (server->tls.key && server->tls.pem) + https = true; + + return ogs_uridup(https, server->addr, service_name, api_version, + resource_name, resource_id); +} + +char *ogs_sbi_client_uri(ogs_sbi_client_t *client, + const char *service_name, const char *api_version, + const char *resource_name, const char *resource_id) +{ + bool https = false; + if (client->tls.key && client->tls.pem) + https = true; + + return ogs_uridup(https, client->addr, service_name, api_version, + resource_name, resource_id); +} + +/** + * Returns a url-decoded version of str + * IMPORTANT: be sure to free() the returned string after use + * Thanks Geek Hideout! + * http://www.geekhideout.com/urlcode.shtml + */ +static char *url_decode(const char *str) +{ + if (str != NULL) { + char *pstr = (char*)str; + char *buf = ogs_malloc(strlen(str) + 1); + char *pbuf = buf; + while (*pstr) { + if (*pstr == '%') { + if (pstr[1] && pstr[2]) { + *pbuf++ = ogs_from_hex(pstr[1]) << 4 | + ogs_from_hex(pstr[2]); + pstr += 2; + } + } else if (*pstr == '+') { + *pbuf++ = ' '; + } else { + *pbuf++ = * pstr; + } + pstr++; + } + *pbuf = '\0'; + return buf; + } else { + return NULL; + } +} + +char *ogs_sbi_parse_url(char *url, const char *delim, char **saveptr) +{ + char *item = NULL; + + item = url_decode(strtok_r(url, delim, saveptr)); + if (!item) { + return NULL; + } + + return item; +} + +ogs_sockaddr_t *ogs_sbi_getaddr_from_uri(char *uri) +{ + int rv; + struct yuarel yuarel; + char *p = NULL; + int port; + + ogs_sockaddr_t *addr = NULL; + + p = ogs_strdup(uri); + + rv = yuarel_parse(&yuarel, p); + if (rv != OGS_OK) { + ogs_free(p); + ogs_error("yuarel_parse() failed [%s]", uri); + return NULL; + } + + if (!yuarel.scheme) { + ogs_error("No http.scheme found [%s]", uri); + ogs_free(p); + return NULL; + } + + if (strcmp(yuarel.scheme, "https") == 0) { + port = OGS_SBI_HTTPS_PORT; + } else if (strcmp(yuarel.scheme, "http") == 0) { + port = OGS_SBI_HTTP_PORT; + } else { + ogs_error("Invalid http.scheme [%s:%s]", yuarel.scheme, uri); + ogs_free(p); + return NULL; + } + + if (!yuarel.host) { + ogs_error("No http.host found [%s]", uri); + ogs_free(p); + return NULL; + } + + if (yuarel.port) port = yuarel.port; + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, yuarel.host, port, 0); + if (rv != OGS_OK) { + ogs_error("ogs_getaddrinfo() failed [%s]", uri); + ogs_free(p); + return NULL; + } + + ogs_free(p); + return addr; +} diff --git a/lib/sbi/conv.h b/lib/sbi/conv.h new file mode 100644 index 000000000..0f427f2a5 --- /dev/null +++ b/lib/sbi/conv.h @@ -0,0 +1,49 @@ +/* + * 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 . + */ + +#if !defined(OGS_SBI_INSIDE) && !defined(OGS_SBI_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_SBI_CONV_H +#define OGS_SBI_CONV_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ogs_sbi_server_s ogs_sbi_server_t; +typedef struct ogs_sbi_client_s ogs_sbi_client_t; + +char *ogs_sbi_server_uri(ogs_sbi_server_t *server, + const char *service_name, const char *api_version, + const char *resource_name, const char *resource_id); + +char *ogs_sbi_client_uri(ogs_sbi_client_t *client, + const char *service_name, const char *api_version, + const char *resource_name, const char *resource_id); + +char *ogs_sbi_parse_url(char *url, const char *delim, char **saveptr); +ogs_sockaddr_t *ogs_sbi_getaddr_from_uri(char *uri); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_CONV_H */ diff --git a/lib/sbi/custom/links.c b/lib/sbi/custom/links.c new file mode 100644 index 000000000..5abe7ca31 --- /dev/null +++ b/lib/sbi/custom/links.c @@ -0,0 +1,37 @@ + +#include +#include +#include +#include "links.h" + +cJSON *ogs_sbi_links_convertToJSON(ogs_sbi_links_t *links) +{ + cJSON *rootJSON = NULL; + cJSON *linksJSON = NULL; + cJSON *itemsJSON = NULL; + cJSON *selfJSON = NULL; + OpenAPI_lnode_t *node; + + ogs_assert(links); + ogs_assert(links->self); + + rootJSON = cJSON_CreateObject(); + ogs_assert(rootJSON); + + linksJSON = cJSON_AddObjectToObject(rootJSON, "_links"); + ogs_assert(linksJSON); + + itemsJSON = cJSON_AddObjectToObject(linksJSON, "items"); + ogs_assert(itemsJSON); + + OpenAPI_list_for_each(links->items, node) { + if (!node->data) continue; + cJSON_AddStringToObject(itemsJSON, "href", node->data); + } + + selfJSON = cJSON_AddObjectToObject(linksJSON, "self"); + ogs_assert(selfJSON); + cJSON_AddStringToObject(selfJSON, "href", links->self); + + return rootJSON; +} diff --git a/lib/sbi/custom/links.h b/lib/sbi/custom/links.h new file mode 100644 index 000000000..8c87b370c --- /dev/null +++ b/lib/sbi/custom/links.h @@ -0,0 +1,32 @@ +/* + * search_result.h + * + * + */ + +#ifndef _OpenAPILinksH_ +#define _OpenAPILinksH_ + +#include +#include "../openapi/external/cJSON.h" +#include "../openapi/include/list.h" +#include "../openapi/include/keyValuePair.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ogs_sbi_links_s ogs_sbi_links_t; +typedef struct ogs_sbi_links_s { + OpenAPI_list_t *items; + char *self; +} ogs_sbi_links_t; + +cJSON *ogs_sbi_links_convertToJSON(ogs_sbi_links_t *links); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPILinksH_ */ + diff --git a/lib/sbi/meson.build b/lib/sbi/meson.build new file mode 100644 index 000000000..4ab83e1f2 --- /dev/null +++ b/lib/sbi/meson.build @@ -0,0 +1,64 @@ +# 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 . + +subdir('openapi') + +libsbi_sources = files(''' + custom/links.c + + yuarel.c + conv.c + message.c + + server.c + client.c + context.c + + nnrf-build.c + nnrf-handler.c +'''.split()) + +libsbi_inc = include_directories('.') + +sbi_cc_flags = ['-DOGS_SBI_COMPILATION'] + +libgnutls_dep = cc.find_library('gnutls', required : true) +libmicrohttpd_dep = dependency('libmicrohttpd') +libcurl_dep = dependency('libcurl') + +libsbi = library('ogssbi', + sources : libsbi_sources, + version : libogslib_version, + c_args : sbi_cc_flags, + include_directories : [libsbi_inc, libinc], + dependencies : [libcore_dep, + libapp_dep, + libsbi_openapi_dep, + libgnutls_dep, + libmicrohttpd_dep, + libcurl_dep], + install : true) + +libsbi_dep = declare_dependency( + link_with : libsbi, + include_directories : [libsbi_inc, libinc], + dependencies : [libcore_dep, + libapp_dep, + libsbi_openapi_dep, + libgnutls_dep, + libmicrohttpd_dep, + libcurl_dep]) diff --git a/lib/sbi/message.c b/lib/sbi/message.c new file mode 100644 index 000000000..95afad706 --- /dev/null +++ b/lib/sbi/message.c @@ -0,0 +1,576 @@ +/* + * 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 "ogs-sbi.h" + +#include "sbi-private.h" + +static OGS_POOL(request_pool, ogs_sbi_request_t); +static OGS_POOL(response_pool, ogs_sbi_response_t); + +void ogs_sbi_message_init(int num_of_request_pool, int num_of_response_pool) +{ + ogs_pool_init(&request_pool, num_of_request_pool); + ogs_pool_init(&response_pool, num_of_response_pool); +} + +void ogs_sbi_message_final(void) +{ + ogs_pool_final(&request_pool); + ogs_pool_final(&response_pool); +} + +void ogs_sbi_message_free(ogs_sbi_message_t *message) +{ + ogs_assert(message); + + if (message->NFProfile) + OpenAPI_nf_profile_free(message->NFProfile); + if (message->ProblemDetails) + OpenAPI_problem_details_free(message->ProblemDetails); + if (message->PatchItemList) { + OpenAPI_lnode_t *node = NULL; + OpenAPI_list_for_each(message->PatchItemList, node) + OpenAPI_patch_item_free(node->data); + OpenAPI_list_free(message->PatchItemList); + } + + if (message->SubscriptionData) + OpenAPI_subscription_data_free(message->SubscriptionData); + if (message->NotificationData) + OpenAPI_notification_data_free(message->NotificationData); + if (message->SearchResult) + OpenAPI_search_result_free(message->SearchResult); +} + +ogs_sbi_request_t *ogs_sbi_request_new(void) +{ + ogs_sbi_request_t *request = NULL; + + ogs_pool_alloc(&request_pool, &request); + + ogs_assert(request); + memset(request, 0, sizeof(ogs_sbi_request_t)); + + request->http.params = ogs_hash_make(); + request->http.headers = ogs_hash_make(); + + return request; +} + +ogs_sbi_response_t *ogs_sbi_response_new(void) +{ + ogs_sbi_response_t *response = NULL; + + ogs_pool_alloc(&response_pool, &response); + ogs_assert(response); + memset(response, 0, sizeof(ogs_sbi_response_t)); + + response->http.params = ogs_hash_make(); + response->http.headers = ogs_hash_make(); + + return response; +} + +static void sbi_header_free(ogs_sbi_header_t *h); +static void http_message_free(http_message_t *http); + +void ogs_sbi_request_free(ogs_sbi_request_t *request) +{ + ogs_assert(request); + + if (request->h.url) + ogs_free(request->h.url); + + sbi_header_free(&request->h); + http_message_free(&request->http); + + ogs_pool_free(&request_pool, request); +} + +void ogs_sbi_response_free(ogs_sbi_response_t *response) +{ + ogs_assert(response); + + if (response->h.url) + ogs_free(response->h.url); + + sbi_header_free(&response->h); + http_message_free(&response->http); + + ogs_pool_free(&response_pool, response); +} + +static void sbi_header_free(ogs_sbi_header_t *h) +{ + ogs_assert(h); + + if (h->method) ogs_free(h->method); + if (h->service.name) ogs_free(h->service.name); + if (h->api.version) ogs_free(h->api.version); + if (h->resource.name) ogs_free(h->resource.name); + if (h->resource.id) ogs_free(h->resource.id); +} + +static void http_message_free(http_message_t *http) +{ + ogs_assert(http); + + if (http->params) { + ogs_hash_index_t *hi; + for (hi = ogs_hash_first(http->params); hi; hi = ogs_hash_next(hi)) { + char *val = ogs_hash_this_val(hi); + ogs_free(val); + } + ogs_hash_destroy(http->params); + } + + if (http->headers) { + ogs_hash_index_t *hi; + for (hi = ogs_hash_first(http->headers); hi; hi = ogs_hash_next(hi)) { + char *val = ogs_hash_this_val(hi); + ogs_free(val); + } + ogs_hash_destroy(http->headers); + } + if (http->content) ogs_free(http->content); +} + +static char *build_content(ogs_sbi_message_t *message); + +ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message) +{ + ogs_sbi_request_t *request = NULL; + + ogs_assert(message); + + request = ogs_sbi_request_new(); + ogs_assert(request); + + ogs_assert(message->h.method); + request->h.method = ogs_strdup(message->h.method); + if (message->h.url) { + request->h.url = ogs_strdup(message->h.url); + } else { + ogs_assert(message->h.service.name); + request->h.service.name = ogs_strdup(message->h.service.name); + ogs_assert(message->h.api.version); + request->h.api.version = ogs_strdup(message->h.api.version); + ogs_assert(message->h.resource.name); + request->h.resource.name = ogs_strdup(message->h.resource.name); + if (message->h.resource.id) + request->h.resource.id = ogs_strdup(message->h.resource.id); + } + + /* URL Param */ + if (message->param.nf_type) { + char *v = OpenAPI_nf_type_ToString(message->param.nf_type); + ogs_assert(v); + ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_NF_TYPE, v); + } + if (message->param.requester_nf_type) { + char *v = OpenAPI_nf_type_ToString(message->param.requester_nf_type); + ogs_assert(v); + ogs_sbi_header_set(request->http.params, + OGS_SBI_PARAM_REQUESTER_NF_TYPE, v); + } + if (message->param.target_nf_type) { + char *v = OpenAPI_nf_type_ToString(message->param.target_nf_type); + ogs_assert(v); + ogs_sbi_header_set(request->http.params, + OGS_SBI_PARAM_TARGET_NF_TYPE, v); + } + if (message->param.limit) { + char *v = ogs_msprintf("%d", message->param.limit); + ogs_assert(v); + ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_LIMIT, v); + } + + /* HTTP Message */ + request->http.content = build_content(message); + if (request->http.content) { + if (message->http.content_type) + ogs_sbi_header_set(request->http.headers, + OGS_SBI_CONTENT_TYPE, message->http.content_type); + else + ogs_sbi_header_set(request->http.headers, + OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE); + } + + if (message->http.content_encoding) + ogs_sbi_header_set(request->http.headers, + OGS_SBI_ACCEPT_ENCODING, message->http.content_encoding); + + return request; +} + +ogs_sbi_response_t *ogs_sbi_build_response(ogs_sbi_message_t *message) +{ + ogs_sbi_response_t *response = NULL; + + ogs_assert(message); + + response = ogs_sbi_response_new(); + ogs_assert(response); + + /* HTTP Message */ + response->http.content = build_content(message); + if (response->http.content) { + if (message->http.content_type) + ogs_sbi_header_set(response->http.headers, + OGS_SBI_CONTENT_TYPE, message->http.content_type); + else + ogs_sbi_header_set(response->http.headers, + OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE); + } + + if (message->http.location == true) + ogs_sbi_header_set(response->http.headers, "Location", message->h.url); + if (message->http.cache_control) + ogs_sbi_header_set(response->http.headers, "Cache-Control", + message->http.cache_control); + + return response; +} + +static char *build_content(ogs_sbi_message_t *message) +{ + char *content = NULL; + cJSON *item = NULL; + ogs_assert(message); + + if (message->ProblemDetails) { + item = OpenAPI_problem_details_convertToJSON(message->ProblemDetails); + ogs_assert(item); + } else if (message->NFProfile) { + item = OpenAPI_nf_profile_convertToJSON(message->NFProfile); + ogs_assert(item); + } else if (message->PatchItemList) { + OpenAPI_lnode_t *node = NULL; + + item = cJSON_CreateArray(); + ogs_assert(item); + + OpenAPI_list_for_each(message->PatchItemList, node) { + cJSON *patchItem = OpenAPI_patch_item_convertToJSON(node->data); + ogs_assert(patchItem); + cJSON_AddItemToArray(item, patchItem); + } + } else if (message->SubscriptionData) { + item = OpenAPI_subscription_data_convertToJSON( + message->SubscriptionData); + ogs_assert(item); + } else if (message->NotificationData) { + item = OpenAPI_notification_data_convertToJSON( + message->NotificationData); + ogs_assert(item); + } else if (message->SearchResult) { + item = OpenAPI_search_result_convertToJSON(message->SearchResult); + ogs_assert(item); + } else if (message->links) { + item = ogs_sbi_links_convertToJSON(message->links); + ogs_assert(item); + } + + if (item) { + content = cJSON_Print(item); + ogs_assert(content); + cJSON_Delete(item); + } + + return content; +} + +static int parse_sbi_header( + ogs_sbi_message_t *message, ogs_sbi_header_t *header); +static int parse_content(ogs_sbi_message_t *message, char *content); + +int ogs_sbi_parse_request( + ogs_sbi_message_t *message, ogs_sbi_request_t *request) +{ + int rv; + ogs_hash_index_t *hi; + + ogs_assert(request); + ogs_assert(message); + + rv = parse_sbi_header(message, &request->h); + if (rv != OGS_OK) { + ogs_error("sbi_parse_header() failed"); + return OGS_ERROR; + } + + 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)) { + message->param.nf_type = + OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); + } else if (!strcmp(ogs_hash_this_key(hi), + OGS_SBI_PARAM_TARGET_NF_TYPE)) { + message->param.target_nf_type = + OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); + } else if (!strcmp(ogs_hash_this_key(hi), + OGS_SBI_PARAM_REQUESTER_NF_TYPE)) { + message->param.requester_nf_type = + OpenAPI_nf_type_FromString(ogs_hash_this_val(hi)); + } else if (!strcmp(ogs_hash_this_key(hi), + OGS_SBI_PARAM_LIMIT)) { + message->param.limit = atoi(ogs_hash_this_val(hi)); + } + } + + for (hi = ogs_hash_first(request->http.headers); + hi; hi = ogs_hash_next(hi)) { + if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT_ENCODING)) { + message->http.content_encoding = ogs_hash_this_val(hi); + } else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) { + message->http.content_type = ogs_hash_this_val(hi); + } + } + + if (parse_content(message, request->http.content) != OGS_OK) { + ogs_error("parse_content() failed"); + return OGS_ERROR; + } + + return OGS_OK; +} + +int ogs_sbi_parse_response( + ogs_sbi_message_t *message, ogs_sbi_response_t *response) +{ + int rv; + ogs_hash_index_t *hi; + + ogs_assert(response); + ogs_assert(message); + + rv = parse_sbi_header(message, &response->h); + if (rv != OGS_OK) { + ogs_error("sbi_parse_header() failed"); + return OGS_ERROR; + } + + for (hi = ogs_hash_first(response->http.headers); + hi; hi = ogs_hash_next(hi)) { + if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) { + message->http.content_type = ogs_hash_this_val(hi); + } + } + + if (parse_content(message, response->http.content) != OGS_OK) { + ogs_error("parse_content() failed"); + return OGS_ERROR; + } + + message->res_status = response->status; + + return OGS_OK; +} + +static int parse_sbi_header( + ogs_sbi_message_t *message, ogs_sbi_header_t *header) +{ + struct yuarel yuarel; + char *saveptr = NULL; + char *url = NULL, *p = NULL;; + + ogs_assert(message); + ogs_assert(header); + + memset(message, 0, sizeof(*message)); + + message->h.method = header->method; + ogs_assert(message->h.method); + message->h.url = header->url; + ogs_assert(message->h.url); + + url = ogs_strdup(header->url); + ogs_assert(url); + p = url; + + if (p[0] != '/') { + int rv = yuarel_parse(&yuarel, p); + if (rv != OGS_OK) { + ogs_error("yuarel_parse() failed"); + ogs_free(url); + return OGS_ERROR; + } + + p = yuarel.path; + } + + header->service.name = ogs_sbi_parse_url(p, "/", &saveptr); + if (!header->service.name) { + ogs_error("ogs_sbi_parse_url() failed"); + ogs_free(url); + return OGS_ERROR; + } + message->h.service.name = header->service.name; + + header->api.version = ogs_sbi_parse_url(NULL, "/", &saveptr); + if (!header->api.version) { + ogs_error("ogs_sbi_parse_url() failed"); + ogs_free(url); + return OGS_ERROR; + } + message->h.api.version = header->api.version; + + header->resource.name = ogs_sbi_parse_url(NULL, "/", &saveptr); + if (!header->resource.name) { + ogs_error("ogs_sbi_parse_url() failed"); + ogs_free(url); + return OGS_ERROR; + } + message->h.resource.name = header->resource.name; + + header->resource.id = ogs_sbi_parse_url(NULL, "/", &saveptr); + message->h.resource.id = header->resource.id; + + ogs_free(url); + + return OGS_OK; +} + +static int parse_content(ogs_sbi_message_t *message, char *content) +{ + int rv = OGS_OK; + cJSON *item = NULL; + + ogs_assert(message); + + if (!content) + return OGS_OK; + + if (strcmp(message->h.api.version, OGS_SBI_API_VERSION) != 0) { + ogs_error("Not supported version - %s", message->h.api.version); + return OGS_ERROR; + } + + item = cJSON_Parse(content); + if (!item) { + ogs_error("JSON parse error"); + return OGS_ERROR; + } + + if (message->http.content_type) { + if (!strncmp(message->http.content_type, + OGS_SBI_CONTENT_PROBLEM_TYPE, + strlen(OGS_SBI_CONTENT_PROBLEM_TYPE))) { + message->ProblemDetails = + OpenAPI_problem_details_parseFromJSON(item); + } else if (!strncmp(message->http.content_type, + OGS_SBI_CONTENT_PATCH_TYPE, + strlen(OGS_SBI_CONTENT_PATCH_TYPE))) { + if (item) { + OpenAPI_patch_item_t *patch_item = NULL; + cJSON *patchJSON = NULL; + message->PatchItemList = OpenAPI_list_create(); + cJSON_ArrayForEach(patchJSON, item) { + if (!cJSON_IsObject(patchJSON)) { + rv = OGS_ERROR; + ogs_error("Unknown JSON"); + goto cleanup; + } + + patch_item = OpenAPI_patch_item_parseFromJSON(patchJSON); + OpenAPI_list_add(message->PatchItemList, patch_item); + } + } + } else { + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NRF_NFM) + + SWITCH(message->h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + message->NFProfile = + OpenAPI_nf_profile_parseFromJSON(item); + if (!message->NFProfile) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) + message->SubscriptionData = + OpenAPI_subscription_data_parseFromJSON(item); + if (!message->SubscriptionData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY) + message->NotificationData = + OpenAPI_notification_data_parseFromJSON(item); + if (!message->NotificationData) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.name); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NRF_DISC) + SWITCH(message->h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + message->SearchResult = + OpenAPI_search_result_parseFromJSON(item); + if (!message->SearchResult) { + rv = OGS_ERROR; + ogs_error("JSON parse error"); + } + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Unknown resource name [%s]", + message->h.resource.name); + END + break; + + DEFAULT + rv = OGS_ERROR; + ogs_error("Not implemented API name [%s]", + message->h.service.name); + END + } + } + +cleanup: + + cJSON_Delete(item); + return rv; +} + +void ogs_sbi_header_set(ogs_hash_t *ht, const void *key, const void *val) +{ + ogs_hash_set(ht, key, strlen(key), ogs_strdup(val)); +} + +void *ogs_sbi_header_get(ogs_hash_t *ht, const void *key) +{ + return ogs_hash_get(ht, key, strlen(key)); +} + diff --git a/lib/sbi/message.h b/lib/sbi/message.h new file mode 100644 index 000000000..b5d63bb4e --- /dev/null +++ b/lib/sbi/message.h @@ -0,0 +1,177 @@ +/* + * 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 . + */ + +#if !defined(OGS_SBI_INSIDE) && !defined(OGS_SBI_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_SBI_MESSAGE_H +#define OGS_SBI_MESSAGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define OGS_SBI_HTTP_PORT 80 +#define OGS_SBI_HTTPS_PORT 443 + +#define OGS_SBI_HTTP_SCHEME "http" +#define OGS_SBI_HTTPS_SCHEME "https" + +#define OGS_SBI_HTTP_STATUS_OK 200 +#define OGS_SBI_HTTP_STATUS_CREATED 201 /* POST PUT */ +#define OGS_SBI_HTTP_STATUS_ACCEPTED 202 /* DELETE PATCH + POST PUT */ +#define OGS_SBI_HTTP_STATUS_NO_CONTENT 204 /* DELETE PATCH + POST PUT OPTIONS */ +#define OGS_SBI_HTTP_STATUS_SEE_OTHER 303 /* DELETE GET + POST PUT */ +#define OGS_SBI_HTTP_STATUS_TEMPORARY_REDIRECT 307 /* ALL */ +#define OGS_SBI_HTTP_STATUS_PERMANENT_REDIRECT 308 /* ALL */ +#define OGS_SBI_HTTP_STATUS_BAD_REQUEST 400 /* ALL */ +#define OGS_SBI_HTTP_STATUS_UNAUTHORIZED 401 /* ALL */ +#define OGS_SBI_HTTP_STATUS_FORBIDDEN 403 /* ALL */ +#define OGS_SBI_HTTP_STATUS_NOT_FOUND 404 /* ALL */ +#define OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED 405 /* ALL */ +#define OGS_SBI_HTTP_STATUS_NOT_ACCEPTABLE 406 /* GET OPTIONS */ +#define OGS_SBI_HTTP_STATUS_REQUEST_TIMEOUT 408 /* ALL */ +#define OGS_SBI_HTTP_STATUS_CONFLICT 409 /* PATCH POST PUT */ +#define OGS_SBI_HTTP_STATUS_GONE 410 /* ALL */ +#define OGS_SBI_HTTP_STATUS_LENGTH_REQUIRED 411 /* PATCH POST + PUT OPTIONS */ +#define OGS_SBI_HTTP_STATUS_PRECONDITION_FAILED 412 /* DELETE GET PATCH + POST PUT */ +#define OGS_SBI_HTTP_STATUS_PAYLOAD_TOO_LARGE 413 /* PATCH POST + PUT OPTIONS */ +#define OGS_SBI_HTTP_STATUS_URI_TOO_LONG 414 /* GET PUT */ +#define OGS_SBI_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE 415 /* PATCH POST + PUT OPTIONS */ +#define OGS_SBI_HTTP_STATUS_TOO_MANY_REQUESTS 429 /* ALL */ +#define OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR 500 /* ALL */ +#define OGS_SBI_HTTP_STATUS_NOT_IMPLEMENTED 501 /* ALL */ +#define OGS_SBI_HTTP_STATUS_SERVICE_UNAVAILABLE 503 /* ALL */ +#define OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT 504 /* ALL */ + +#define OGS_SBI_HTTP_METHOD_DELETE "DELETE" +#define OGS_SBI_HTTP_METHOD_GET "GET" +#define OGS_SBI_HTTP_METHOD_PATCH "PATCH" +#define OGS_SBI_HTTP_METHOD_POST "POST" +#define OGS_SBI_HTTP_METHOD_PUT "PUT" +#define OGS_SBI_HTTP_METHOD_OPTIONS "OPTIONS" + +#define OGS_SBI_API_VERSION "v1" +#define OGS_SBI_API_FULL_VERSION "1.0.0" +#define OGS_SBI_SERVICE_NAME_NRF_NFM "nnrf-nfm" +#define OGS_SBI_SERVICE_NAME_NRF_DISC "nnrf-disc" +#define OGS_SBI_SERVICE_NAME_SMF_PDUSESSION "nsmf-pdusession" +#define OGS_SBI_SERVICE_NAME_SMF_EVENT_EXPOSURE "nsmf-event-exposure" + +#define OGS_SBI_RESOURCE_NAME_NF_INSTANCES "nf-instances" +#define OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS "subscriptions" +#define OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY "nf-status-notify" + +#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" +#define OGS_SBI_PARAM_LIMIT "limit" + +#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding" +#define OGS_SBI_CONTENT_TYPE "Content-Type" +#define OGS_SBI_CONTENT_JSON_TYPE "application/json" +#define OGS_SBI_CONTENT_PROBLEM_TYPE "application/problem+json" +#define OGS_SBI_CONTENT_PATCH_TYPE \ + "application/json-patch+json" +#define OGS_SBI_CONTENT_3GPPHAL_TYPE "application/3gppHal+json" + +typedef struct ogs_sbi_request_s ogs_sbi_request_t; +typedef struct ogs_sbi_response_s ogs_sbi_response_t; + +typedef struct ogs_sbi_header_s { + char *method; + char *url; + + struct { + char *name; + } service; + + struct { + char *version; + } api; + + struct { + char *name; + char *id; + } resource; +} ogs_sbi_header_t; + +typedef struct ogs_sbi_message_s { + ogs_sbi_header_t h; + + struct { + char *content_encoding; + char *content_type; + bool location; + char *cache_control; + } http; + + struct { + OpenAPI_nf_type_e target_nf_type; + OpenAPI_nf_type_e requester_nf_type; + OpenAPI_nf_type_e nf_type; + int limit; + } param; + + int res_status; + + OpenAPI_nf_profile_t *NFProfile; + OpenAPI_problem_details_t *ProblemDetails; + OpenAPI_list_t *PatchItemList; + + OpenAPI_subscription_data_t *SubscriptionData; + OpenAPI_notification_data_t *NotificationData; + OpenAPI_search_result_t *SearchResult; + + ogs_sbi_links_t *links; +} ogs_sbi_message_t; + +void ogs_sbi_message_init(int num_of_request_pool, int num_of_response_pool); +void ogs_sbi_message_final(void); + +void ogs_sbi_message_free(ogs_sbi_message_t *message); + +ogs_sbi_request_t *ogs_sbi_request_new(void); +void ogs_sbi_request_free(ogs_sbi_request_t *request); +ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message); +int ogs_sbi_parse_request( + ogs_sbi_message_t *message, ogs_sbi_request_t *request); + +ogs_sbi_response_t *ogs_sbi_response_new(void); +void ogs_sbi_response_free(ogs_sbi_response_t *response); +ogs_sbi_response_t *ogs_sbi_build_response(ogs_sbi_message_t *message); +int ogs_sbi_parse_response( + ogs_sbi_message_t *message, ogs_sbi_response_t *response); + +void ogs_sbi_header_set(ogs_hash_t *ht, const void *key, const void *val); +void *ogs_sbi_header_get(ogs_hash_t *ht, const void *key); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_MESSAGE_H */ diff --git a/lib/sbi/nnrf-build.c b/lib/sbi/nnrf-build.c new file mode 100644 index 000000000..2037ec879 --- /dev/null +++ b/lib/sbi/nnrf-build.c @@ -0,0 +1,214 @@ +/* + * 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 "nnrf-build.h" + +OpenAPI_nf_profile_t *ogs_sbi_nnrf_build_nf_profile( + ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_nf_service_t *nf_service = NULL; + + OpenAPI_nf_profile_t *NFProfile = NULL; + OpenAPI_list_t *Ipv4AddrList = NULL; + OpenAPI_list_t *Ipv6AddrList = NULL; + OpenAPI_list_t *NFServiceList = NULL; + + int i = 0; + int fqdn_len; + char fqdn[OGS_MAX_FQDN_LEN+1]; + + ogs_assert(nf_instance); + + NFProfile = ogs_calloc(1, sizeof(*NFProfile)); + ogs_assert(NFProfile); + + NFProfile->nf_instance_id = nf_instance->id; + NFProfile->nf_type = nf_instance->nf_type; + NFProfile->nf_status = nf_instance->nf_status; + + if (strlen(nf_instance->fqdn)) { + memset(fqdn, 0, sizeof(fqdn)); + fqdn_len = ogs_fqdn_build(fqdn, + nf_instance->fqdn, strlen(nf_instance->fqdn)); + NFProfile->fqdn = ogs_memdup(fqdn, fqdn_len); + } + + Ipv4AddrList = OpenAPI_list_create(); + ogs_assert(Ipv4AddrList); + Ipv6AddrList = OpenAPI_list_create(); + ogs_assert(Ipv6AddrList); + + for (i = 0; i < nf_instance->num_of_ipv4; i++) { + if (nf_instance->ipv4[i]) + OpenAPI_list_add(Ipv4AddrList, ogs_ipstrdup(nf_instance->ipv4[i])); + } + for (i = 0; i < nf_instance->num_of_ipv6; i++) { + if (nf_instance->ipv6[i]) + OpenAPI_list_add(Ipv6AddrList, ogs_ipstrdup(nf_instance->ipv6[i])); + } + + if (Ipv4AddrList->count) + NFProfile->ipv4_addresses = Ipv4AddrList; + else + OpenAPI_list_free(Ipv4AddrList); + if (Ipv6AddrList->count) + NFProfile->ipv6_addresses = Ipv6AddrList; + else + OpenAPI_list_free(Ipv6AddrList); + + NFServiceList = OpenAPI_list_create(); + ogs_assert(NFServiceList); + + ogs_list_for_each(&nf_instance->nf_service_list, nf_service) { + OpenAPI_nf_service_t *NFService = NULL; + OpenAPI_list_t *VersionList = NULL; + OpenAPI_list_t *IpEndPointList = NULL; + + NFService = ogs_calloc(1, sizeof(*NFService)); + ogs_assert(NFService); + NFService->service_instance_id = ogs_strdup(nf_service->id); + NFService->service_name = ogs_strdup(nf_service->name); + + VersionList = OpenAPI_list_create(); + ogs_assert(VersionList); + + for (i = 0; i < nf_service->num_of_version; i++) { + OpenAPI_nf_service_version_t *NFServiceVersion = NULL; + + NFServiceVersion = ogs_calloc(1, sizeof(*NFServiceVersion)); + ogs_assert(NFServiceVersion); + if (nf_service->versions[i].in_uri) + NFServiceVersion->api_version_in_uri = + ogs_strdup(nf_service->versions[i].in_uri); + if (nf_service->versions[i].full) + NFServiceVersion->api_full_version = + ogs_strdup(nf_service->versions[i].full); + if (nf_service->versions[i].expiry) + NFServiceVersion->expiry = + ogs_strdup(nf_service->versions[i].expiry); + + OpenAPI_list_add(VersionList, NFServiceVersion); + } + + ogs_assert(VersionList->count); + NFService->versions = VersionList; + + NFService->scheme = nf_service->scheme; + NFService->nf_service_status = nf_service->status; + + if (strlen(nf_service->fqdn)) { + memset(fqdn, 0, sizeof(fqdn)); + fqdn_len = ogs_fqdn_build(fqdn, + nf_service->fqdn, strlen(nf_service->fqdn)); + NFService->fqdn = ogs_memdup(fqdn, fqdn_len); + } + + IpEndPointList = OpenAPI_list_create(); + ogs_assert(IpEndPointList); + + for (i = 0; i < nf_service->num_of_addr; i++) { + ogs_sockaddr_t *ipv4 = NULL; + ogs_sockaddr_t *ipv6 = NULL; + + OpenAPI_ip_end_point_t *IpEndPoint = NULL; + + ipv4 = nf_service->addr[i].ipv4; + ipv6 = nf_service->addr[i].ipv6; + + if (ipv4 || ipv6) { + IpEndPoint = ogs_calloc(1, sizeof(*IpEndPoint)); + ogs_assert(IpEndPoint); + if (ipv4) IpEndPoint->ipv4_address = ogs_ipstrdup(ipv4); + if (ipv6) IpEndPoint->ipv6_address = ogs_ipstrdup(ipv6); + IpEndPoint->port = nf_service->addr[i].port; + OpenAPI_list_add(IpEndPointList, IpEndPoint); + } + } + + if (IpEndPointList->count) + NFService->ip_end_points = IpEndPointList; + else + OpenAPI_list_free(IpEndPointList); + + OpenAPI_list_add(NFServiceList, NFService); + } + + if (NFServiceList->count) + NFProfile->nf_services = NFServiceList; + else + OpenAPI_list_free(NFServiceList); + + return NFProfile; +} + +void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile) +{ + OpenAPI_lnode_t *node = NULL; + + ogs_assert(NFProfile); + + OpenAPI_list_for_each(NFProfile->ipv4_addresses, node) + ogs_free(node->data); + OpenAPI_list_free(NFProfile->ipv4_addresses); + OpenAPI_list_for_each(NFProfile->ipv6_addresses, node) + ogs_free(node->data); + OpenAPI_list_free(NFProfile->ipv6_addresses); + + OpenAPI_list_for_each(NFProfile->nf_services, node) { + OpenAPI_lnode_t *node2; + OpenAPI_nf_service_t *NFService = node->data; + ogs_assert(NFService); + + ogs_free(NFService->service_instance_id); + ogs_free(NFService->service_name); + + OpenAPI_list_for_each(NFService->versions, node2) { + OpenAPI_nf_service_version_t *NFServiceVersion = node2->data; + ogs_assert(NFServiceVersion); + ogs_free(NFServiceVersion->api_version_in_uri); + ogs_free(NFServiceVersion->api_full_version); + if (NFServiceVersion->expiry) + ogs_free(NFServiceVersion->expiry); + ogs_free(NFServiceVersion); + } + OpenAPI_list_free(NFService->versions); + + OpenAPI_list_for_each(NFService->ip_end_points, node2) { + OpenAPI_ip_end_point_t *IpEndPoint = node2->data; + ogs_assert(IpEndPoint); + if (IpEndPoint->ipv4_address) + ogs_free(IpEndPoint->ipv4_address); + if (IpEndPoint->ipv6_address) + ogs_free(IpEndPoint->ipv6_address); + ogs_free(IpEndPoint); + } + OpenAPI_list_free(NFService->ip_end_points); + + if (NFService->fqdn) + ogs_free(NFService->fqdn); + + ogs_free(NFService); + } + OpenAPI_list_free(NFProfile->nf_services); + + if (NFProfile->fqdn) + ogs_free(NFProfile->fqdn); + + ogs_free(NFProfile); +} diff --git a/lib/sbi/nnrf-build.h b/lib/sbi/nnrf-build.h new file mode 100644 index 000000000..abbb78988 --- /dev/null +++ b/lib/sbi/nnrf-build.h @@ -0,0 +1,38 @@ +/* + * 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 OGS_NNRF_BUILD_H +#define OGS_NNRF_BUILD_H + +#include "ogs-sbi.h" +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +OpenAPI_nf_profile_t *ogs_sbi_nnrf_build_nf_profile( + ogs_sbi_nf_instance_t *nf_instance); +void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_NNRF_BUILD_H */ diff --git a/lib/sbi/nnrf-handler.c b/lib/sbi/nnrf-handler.c new file mode 100644 index 000000000..4e304b2d5 --- /dev/null +++ b/lib/sbi/nnrf-handler.c @@ -0,0 +1,184 @@ +/* + * 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 "nnrf-handler.h" + +bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance, + OpenAPI_nf_profile_t *NFProfile, + ogs_sbi_session_t *session, ogs_sbi_message_t *message) +{ + int rv; + + OpenAPI_lnode_t *node; + + ogs_assert(nf_instance); + ogs_assert(NFProfile); + + if (!NFProfile) { + ogs_error("No NFProfile"); + if (session) + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No NFProfile", NULL); + return false; + } + + if (!NFProfile->nf_instance_id) { + ogs_error("No NFProfile.NFInstanceId"); + if (session) + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "NFProfile", "No NFInstanceId"); + return false; + } + + if (!NFProfile->nf_type) { + ogs_error("No NFProfile.NFType"); + if (session) + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "NFProfile", "No NFType"); + return false; + } + + if (!NFProfile->nf_status) { + ogs_error("No NFProfile.NFStatus"); + if (session) + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "NFProfile", "No NFStatus"); + return false; + } + + ogs_sbi_nf_instance_clear(nf_instance); + + nf_instance->nf_type = NFProfile->nf_type; + nf_instance->nf_status = NFProfile->nf_status; + nf_instance->time.heartbeat = NFProfile->heart_beat_timer; + + if (NFProfile->fqdn) + ogs_fqdn_parse(nf_instance->fqdn, + NFProfile->fqdn, strlen(NFProfile->fqdn)); + + /* Only one time handles RegisterNFInstance operation */ + OpenAPI_list_for_each(NFProfile->ipv4_addresses, node) { + ogs_sockaddr_t *addr = NULL; + + if (!node->data) continue; + + if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, + node->data, OGS_SBI_HTTPS_PORT, 0); + if (rv != OGS_OK) continue; + + nf_instance->ipv4[nf_instance->num_of_ipv4] = addr; + nf_instance->num_of_ipv4++; + } + } + OpenAPI_list_for_each(NFProfile->ipv6_addresses, node) { + ogs_sockaddr_t *addr = NULL; + + if (!node->data) continue; + + if (nf_instance->num_of_ipv6 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { + + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, + node->data, OGS_SBI_HTTPS_PORT, 0); + if (rv != OGS_OK) continue; + + nf_instance->ipv6[nf_instance->num_of_ipv6] = addr; + nf_instance->num_of_ipv6++; + } + } + + OpenAPI_list_for_each(NFProfile->nf_services, node) { + OpenAPI_nf_service_t *NFService = node->data; + OpenAPI_list_t *VersionList = NULL; + OpenAPI_list_t *IpEndPointList = NULL; + OpenAPI_lnode_t *node2 = NULL; + + ogs_sbi_nf_service_t *nf_service = NULL; + + if (!NFService) continue; + + VersionList = NFService->versions; + IpEndPointList = NFService->ip_end_points; + + nf_service = ogs_sbi_nf_service_add(nf_instance, + NFService->service_instance_id, + NFService->service_name, NFService->scheme); + ogs_assert(nf_service); + + OpenAPI_list_for_each(VersionList, node2) { + OpenAPI_nf_service_version_t *NFServiceVersion = node2->data; + + if (!NFServiceVersion) continue; + + ogs_sbi_nf_service_add_version(nf_service, + NFServiceVersion->api_version_in_uri, + NFServiceVersion->api_full_version, + NFServiceVersion->expiry); + } + + if (NFService->fqdn) + ogs_fqdn_parse(nf_service->fqdn, + NFService->fqdn, strlen(NFService->fqdn)); + + nf_service->num_of_addr = 0; + OpenAPI_list_for_each(IpEndPointList, node2) { + OpenAPI_ip_end_point_t *IpEndPoint = node2->data; + ogs_sockaddr_t *addr = NULL, *addr6 = NULL; + int port = 0; + + if (!IpEndPoint) continue; + + if (nf_service->num_of_addr < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { + port = IpEndPoint->port; + if (!port) { + if (nf_service->scheme == OpenAPI_uri_scheme_http) + port = OGS_SBI_HTTP_PORT; + else if (nf_service->scheme == OpenAPI_uri_scheme_https) + port = OGS_SBI_HTTPS_PORT; + else + continue; + } + + if (IpEndPoint->ipv4_address) { + rv = ogs_getaddrinfo(&addr, AF_UNSPEC, + IpEndPoint->ipv4_address, port, 0); + if (rv != OGS_OK) continue; + } + if (IpEndPoint->ipv6_address) { + rv = ogs_getaddrinfo(&addr6, AF_UNSPEC, + IpEndPoint->ipv6_address, port, 0); + if (rv != OGS_OK) continue; + } + + if (addr || addr6) { + nf_service->addr[nf_service->num_of_addr]. + port = port; + nf_service->addr[nf_service->num_of_addr]. + ipv4 = addr; + nf_service->addr[nf_service->num_of_addr]. + ipv6 = addr6; + } + nf_service->num_of_addr++; + } + } + } + + return true; +} diff --git a/lib/sbi/nnrf-handler.h b/lib/sbi/nnrf-handler.h new file mode 100644 index 000000000..149e5da4d --- /dev/null +++ b/lib/sbi/nnrf-handler.h @@ -0,0 +1,38 @@ +/* + * 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 OGS_NNRF_HANDLER_H +#define OGS_NNRF_HANDLER_H + +#include "ogs-sbi.h" +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance, + OpenAPI_nf_profile_t *NFProfile, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_NNRF_HANDLER_H */ diff --git a/lib/sbi/ogs-sbi.h b/lib/sbi/ogs-sbi.h new file mode 100644 index 000000000..113a23440 --- /dev/null +++ b/lib/sbi/ogs-sbi.h @@ -0,0 +1,72 @@ +/* + * 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 OGS_SBI_H +#define OGS_SBI_H + +#include "ogs-core.h" + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif + +#include "model/nf_profile.h" +#include "model/nf_group_cond.h" +#include "model/smf_info.h" +#include "model/problem_details.h" +#include "model/patch_item.h" +#include "model/subscription_data.h" +#include "model/notification_data.h" +#include "model/search_result.h" + +#include "custom/links.h" + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + +#define OGS_SBI_INSIDE + +#include "sbi/conv.h" +#include "sbi/message.h" + +#include "sbi/server.h" +#include "sbi/client.h" +#include "sbi/context.h" + +#include "sbi/nnrf-build.h" +#include "sbi/nnrf-handler.h" + +#undef OGS_SBI_INSIDE + +#ifdef __cplusplus +extern "C" { +#endif + +extern int __ogs_sbi_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __ogs_sbi_domain + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_H */ diff --git a/lib/sbi/openapi/.openapi-generator-ignore b/lib/sbi/openapi/.openapi-generator-ignore new file mode 100644 index 000000000..1de928e96 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator-ignore @@ -0,0 +1,16 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +api/** + +include/apiClient.h + +src/apiClient.c +src/binary.c + +unit-test/** + +README.md +libcurl.licence +uncrustify-rules.cfg +CMakeLists.txt diff --git a/lib/sbi/openapi/.openapi-generator/VERSION b/lib/sbi/openapi/.openapi-generator/VERSION new file mode 100644 index 000000000..b5d898602 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/lib/sbi/openapi/.openapi-generator/config.yaml b/lib/sbi/openapi/.openapi-generator/config.yaml new file mode 100644 index 000000000..eb2ec3417 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/config.yaml @@ -0,0 +1,6 @@ +enablePostProcessFile: true +templateDir: "../openapi/.openapi-generator/templates" +reservedWordMappings: + 3GPP_ACCESS: "3GPP_ACCESS" + 5G_EIR: "5G_EIR" + 5GMM: "5GMM" diff --git a/lib/sbi/openapi/.openapi-generator/templates/apiKey.c.mustache b/lib/sbi/openapi/.openapi-generator/templates/apiKey.c.mustache new file mode 100644 index 000000000..dfc1f732f --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/apiKey.c.mustache @@ -0,0 +1,23 @@ +#include +#include +#include "../include/keyValuePair.h" + +OpenAPI_map_t *OpenAPI_map_create(char *key, void *value) +{ + OpenAPI_map_t *OpenAPI_map = ogs_malloc(sizeof(OpenAPI_map_t)); + OpenAPI_map->key = key; + OpenAPI_map->value = value; + return OpenAPI_map; +} + +OpenAPI_map_t *OpenAPI_map_create_allocate(char *key, double value) +{ + double* boolpointer = ogs_malloc(sizeof(value)); + memcpy(boolpointer, &value, sizeof(value)); + return OpenAPI_map_create(key, boolpointer); +} + +void OpenAPI_map_free(OpenAPI_map_t *OpenAPI_map) +{ + ogs_free(OpenAPI_map); +} diff --git a/lib/sbi/openapi/.openapi-generator/templates/binary.c.mustache b/lib/sbi/openapi/.openapi-generator/templates/binary.c.mustache new file mode 100644 index 000000000..a8c9cc6e7 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/binary.c.mustache @@ -0,0 +1,65 @@ +#include +#include +#include "../include/binary.h" +#ifdef OPENSSL +#include "openssl/pem.h" +#endif + +OpenAPI_binary_t *OpenAPI_instantiate_binary_t(char *data, int len) +{ + binary_t* ret = malloc(sizeof(struct binary_t)); + + ret->len=len; + ret->data = malloc(len); + memcpy(ret->data, data, len); + + return ret; +} + +char *OpenAPI_base64encode(const void *b64_encode_this, + int encode_this_many_bytes) +{ +#ifdef OPENSSL + BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO. + BUF_MEM *mem_bio_mem_ptr; //Pointer to a "memory BIO" structure holding our base64 data. + b64_bio = BIO_new(BIO_f_base64()); //Initialize our base64 filter BIO. + mem_bio = BIO_new(BIO_s_mem()); //Initialize our memory sink BIO. + BIO_push(b64_bio, mem_bio); //Link the BIOs by creating a filter-sink BIO chain. + BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); //No newlines every 64 characters or less. + BIO_write(b64_bio, b64_encode_this, encode_this_many_bytes); //Records base64 encoded data. + BIO_flush(b64_bio); //Flush data. Necessary for b64 encoding, because of pad characters. + BIO_get_mem_ptr(mem_bio, &mem_bio_mem_ptr); //Store address of mem_bio's memory structure. + BIO_set_close(mem_bio, BIO_NOCLOSE); //Permit access to mem_ptr after BIOs are destroyed. + BIO_free_all(b64_bio); //Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). + BUF_MEM_grow(mem_bio_mem_ptr, (*mem_bio_mem_ptr).length + 1); //Makes space for end null. + (*mem_bio_mem_ptr).data[(*mem_bio_mem_ptr).length] = '\0'; //Adds null-terminator to tail. + return (*mem_bio_mem_ptr).data; //Returns base-64 encoded data. (See: "buf_mem_st" struct). +#else // OPENSSL +#warning Data will not be encoded. If you want to use function "base64encode", please define "-DOPENSSL" when building the library. + return NULL; +#endif // OPENSSL +} + +char *OpenAPI_base64decode(const void *b64_decode_this, + int decode_this_many_bytes, int *decoded_bytes) +{ +#ifdef OPENSSL + BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO. + char *base64_decoded = calloc( (decode_this_many_bytes*3)/4+1, sizeof(char) ); //+1 = null. + b64_bio = BIO_new(BIO_f_base64()); //Initialize our base64 filter BIO. + mem_bio = BIO_new(BIO_s_mem()); //Initialize our memory source BIO. + BIO_write(mem_bio, b64_decode_this, decode_this_many_bytes); //Base64 data saved in source. + BIO_push(b64_bio, mem_bio); //Link the BIOs by creating a filter-source BIO chain. + BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL); //Don't require trailing newlines. + int decoded_byte_index = 0; //Index where the next base64_decoded byte should be written. + while ( 0 < BIO_read(b64_bio, base64_decoded+decoded_byte_index, 1) ){ //Read byte-by-byte. + decoded_byte_index++; //Increment the index until read of BIO decoded data is complete. + } //Once we're done reading decoded data, BIO_read returns -1 even though there's no error. + BIO_free_all(b64_bio); //Destroys all BIOs in chain, starting with b64 (i.e. the 1st one). + *decoded_bytes = decoded_byte_index; + return base64_decoded; //Returns base-64 decoded data with trailing null terminator. +#else // OPENSSL +#warning Data will not be decoded. If you want to use function "base64decode", please define "-DOPENSSL" when building the library. + return NULL; +#endif // OPENSSL +} diff --git a/lib/sbi/openapi/.openapi-generator/templates/binary.h.mustache b/lib/sbi/openapi/.openapi-generator/templates/binary.h.mustache new file mode 100644 index 000000000..c86f1c86c --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/binary.h.mustache @@ -0,0 +1,27 @@ +#ifndef OGS_SBI_BINARY_H +#define OGS_SBI_BINARY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_binary_s { + uint8_t* data; + unsigned int len; +} OpenAPI_binary_t; + +OpenAPI_binary_t *OpenAPI_instantiate_binary_t(char *data, int len); + +char *OpenAPI_base64encode(const void *b64_encode_this, + int encode_this_many_bytes); + +char *OpenAPI_base64decode(const void *b64_decode_this, + int decode_this_many_bytes, int *decoded_bytes); + +#ifdef __cplusplus +} +#endif + +#endif // OGS_SBI_BINARY_H diff --git a/lib/sbi/openapi/.openapi-generator/templates/cJSON.c.mustache b/lib/sbi/openapi/.openapi-generator/templates/cJSON.c.mustache new file mode 100644 index 000000000..0421267a2 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/cJSON.c.mustache @@ -0,0 +1,2939 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +/* cJSON */ +/* JSON parser in C. */ + +/* disable warnings about old C89 functions in MSVC */ +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifdef __GNUC__ +#pragma GCC visibility push(default) +#endif +#if defined(_MSC_VER) +#pragma warning (push) +/* disable warning about single line comments in system headers */ +#pragma warning (disable : 4001) +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef ENABLE_LOCALES +#include +#endif + +#if defined(_MSC_VER) +#pragma warning (pop) +#endif +#ifdef __GNUC__ +#pragma GCC visibility pop +#endif + +#include "cJSON.h" + +/* define our own boolean type */ +#define true ((cJSON_bool)1) +#define false ((cJSON_bool)0) + +typedef struct { + const unsigned char *json; + size_t position; +} error; +static error global_error = { NULL, 0 }; + +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) +{ + return (const char*) (global_error.json + global_error.position); +} + +CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) { + if (!cJSON_IsString(item)) { + return NULL; + } + + return item->valuestring; +} + +/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 7) + #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. +#endif + +CJSON_PUBLIC(const char*) cJSON_Version(void) +{ + static char version[15]; + sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + + return version; +} + +/* Case insensitive string comparison, doesn't consider two NULL pointers equal though */ +static int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } + + if (string1 == string2) + { + return 0; + } + + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } + + return tolower(*string1) - tolower(*string2); +} + +typedef struct internal_hooks +{ + void *(*allocate)(size_t size); + void (*deallocate)(void *pointer); + void *(*reallocate)(void *pointer, size_t size); +} internal_hooks; + +#if 0 /* modified by acetcom */ +#if defined(_MSC_VER) +/* work around MSVC error C2322: '...' address of dillimport '...' is not static */ +static void *internal_malloc(size_t size) +{ + return malloc(size); +} +static void internal_free(void *pointer) +{ + free(pointer); +} +static void *internal_realloc(void *pointer, size_t size) +{ + return realloc(pointer, size); +} +#else +#define internal_malloc malloc +#define internal_free free +#define internal_realloc realloc +#endif +#else +#include "ogs-core.h" +#define internal_malloc ogs_malloc +#define internal_free ogs_free +#define internal_realloc ogs_realloc +#endif + +static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; + +static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) +{ + size_t length = 0; + unsigned char *copy = NULL; + + if (string == NULL) + { + return NULL; + } + + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*)hooks->allocate(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); + + return copy; +} + +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) +{ + if (hooks == NULL) + { + /* Reset hooks */ + global_hooks.allocate = malloc; + global_hooks.deallocate = free; + global_hooks.reallocate = realloc; + return; + } + + global_hooks.allocate = malloc; + if (hooks->malloc_fn != NULL) + { + global_hooks.allocate = hooks->malloc_fn; + } + + global_hooks.deallocate = free; + if (hooks->free_fn != NULL) + { + global_hooks.deallocate = hooks->free_fn; + } + + /* use realloc only if both free and malloc are used */ + global_hooks.reallocate = NULL; + if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) + { + global_hooks.reallocate = realloc; + } +} + +/* Internal constructor. */ +static cJSON *cJSON_New_Item(const internal_hooks * const hooks) +{ + cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); + if (node) + { + memset(node, '\0', sizeof(cJSON)); + } + + return node; +} + +/* Delete a cJSON structure. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item) +{ + cJSON *next = NULL; + while (item != NULL) + { + next = item->next; + if (!(item->type & cJSON_IsReference) && (item->child != NULL)) + { + cJSON_Delete(item->child); + } + if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) + { + global_hooks.deallocate(item->valuestring); + } + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + global_hooks.deallocate(item->string); + } + global_hooks.deallocate(item); + item = next; + } +} + +/* get the decimal point character of the current locale */ +static unsigned char get_decimal_point(void) +{ +#ifdef ENABLE_LOCALES + struct lconv *lconv = localeconv(); + return (unsigned char) lconv->decimal_point[0]; +#else + return '.'; +#endif +} + +typedef struct +{ + const unsigned char *content; + size_t length; + size_t offset; + size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ + internal_hooks hooks; +} parse_buffer; + +/* check if the given size is left to read in a given parse buffer (starting with 1) */ +#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) +/* check if the buffer can be accessed at the given index (starting with 0) */ +#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) +#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) +/* get a pointer to the buffer at the position */ +#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) + +/* Parse the input text to generate a number, and populate the result into item. */ +static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) +{ + double number = 0; + unsigned char *after_end = NULL; + unsigned char number_c_string[64]; + unsigned char decimal_point = get_decimal_point(); + size_t i = 0; + + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; + } + + /* copy the number into a temporary buffer and replace '.' with the decimal point + * of the current locale (for strtod) + * This also takes care of '\0' not necessarily being available for marking the end of the input */ + for (i = 0; (i < (sizeof(number_c_string) - 1)) && can_access_at_index(input_buffer, i); i++) + { + switch (buffer_at_offset(input_buffer)[i]) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '+': + case '-': + case 'e': + case 'E': + number_c_string[i] = buffer_at_offset(input_buffer)[i]; + break; + + case '.': + number_c_string[i] = decimal_point; + break; + + default: + goto loop_end; + } + } +loop_end: + number_c_string[i] = '\0'; + + number = strtod((const char*)number_c_string, (char**)&after_end); + if (number_c_string == after_end) + { + return false; /* parse_error */ + } + + item->valuedouble = number; + + /* use saturation in case of overflow */ + if (number >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (number <= INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)number; + } + + item->type = cJSON_Number; + + input_buffer->offset += (size_t)(after_end - number_c_string); + return true; +} + +/* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number) +{ + if (number >= INT_MAX) + { + object->valueint = INT_MAX; + } + else if (number <= INT_MIN) + { + object->valueint = INT_MIN; + } + else + { + object->valueint = (int)number; + } + + return object->valuedouble = number; +} + +typedef struct +{ + unsigned char *buffer; + size_t length; + size_t offset; + size_t depth; /* current nesting depth (for formatted printing) */ + cJSON_bool noalloc; + cJSON_bool format; /* is this print a formatted print */ + internal_hooks hooks; +} printbuffer; + +/* realloc printbuffer if necessary to have at least "needed" bytes more */ +static unsigned char* ensure(printbuffer * const p, size_t needed) +{ + unsigned char *newbuffer = NULL; + size_t newsize = 0; + + if ((p == NULL) || (p->buffer == NULL)) + { + return NULL; + } + + if ((p->length > 0) && (p->offset >= p->length)) + { + /* make sure that offset is valid */ + return NULL; + } + + if (needed > INT_MAX) + { + /* sizes bigger than INT_MAX are currently not supported */ + return NULL; + } + + needed += p->offset + 1; + if (needed <= p->length) + { + return p->buffer + p->offset; + } + + if (p->noalloc) { + return NULL; + } + + /* calculate new buffer size */ + if (needed > (INT_MAX / 2)) + { + /* overflow of int, use INT_MAX if possible */ + if (needed <= INT_MAX) + { + newsize = INT_MAX; + } + else + { + return NULL; + } + } + else + { + newsize = needed * 2; + } + + if (p->hooks.reallocate != NULL) + { + /* reallocate with realloc if available */ + newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); + if (newbuffer == NULL) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + } + else + { + /* otherwise reallocate manually */ + newbuffer = (unsigned char*)p->hooks.allocate(newsize); + if (!newbuffer) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + if (newbuffer) + { + memcpy(newbuffer, p->buffer, p->offset + 1); + } + p->hooks.deallocate(p->buffer); + } + p->length = newsize; + p->buffer = newbuffer; + + return newbuffer + p->offset; +} + +/* calculate the new length of the string in a printbuffer and update the offset */ +static void update_offset(printbuffer * const buffer) +{ + const unsigned char *buffer_pointer = NULL; + if ((buffer == NULL) || (buffer->buffer == NULL)) + { + return; + } + buffer_pointer = buffer->buffer + buffer->offset; + + buffer->offset += strlen((const char*)buffer_pointer); +} + +/* Render the number nicely from the given item into a string. */ +static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + double d = item->valuedouble; + int length = 0; + size_t i = 0; + unsigned char number_buffer[26]; /* temporary buffer to print the number into */ + unsigned char decimal_point = get_decimal_point(); + double test; + + if (output_buffer == NULL) + { + return false; + } + + /* This checks for NaN and Infinity */ + if ((d * 0) != 0) + { + length = sprintf((char*)number_buffer, "null"); + } + else + { + /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ + length = sprintf((char*)number_buffer, "%1.15g", d); + + /* Check whether the original double can be recovered */ + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || ((double)test != d)) + { + /* If not, print with 17 decimal places of precision */ + length = sprintf((char*)number_buffer, "%1.17g", d); + } + } + + /* sprintf failed or buffer overrun occured */ + if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1))) + { + return false; + } + + /* reserve appropriate space in the output */ + output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); + if (output_pointer == NULL) + { + return false; + } + + /* copy the printed number to the output and replace locale + * dependent decimal point with '.' */ + for (i = 0; i < ((size_t)length); i++) + { + if (number_buffer[i] == decimal_point) + { + output_pointer[i] = '.'; + continue; + } + + output_pointer[i] = number_buffer[i]; + } + output_pointer[i] = '\0'; + + output_buffer->offset += (size_t)length; + + return true; +} + +/* parse 4 digit hexadecimal number */ +static unsigned parse_hex4(const unsigned char * const input) +{ + unsigned int h = 0; + size_t i = 0; + + for (i = 0; i < 4; i++) + { + /* parse digit */ + if ((input[i] >= '0') && (input[i] <= '9')) + { + h += (unsigned int) input[i] - '0'; + } + else if ((input[i] >= 'A') && (input[i] <= 'F')) + { + h += (unsigned int) 10 + input[i] - 'A'; + } + else if ((input[i] >= 'a') && (input[i] <= 'f')) + { + h += (unsigned int) 10 + input[i] - 'a'; + } + else /* invalid */ + { + return 0; + } + + if (i < 3) + { + /* shift left to make place for the next nibble */ + h = h << 4; + } + } + + return h; +} + +/* converts a UTF-16 literal to UTF-8 + * A literal can be one or two sequences of the form \uXXXX */ +static unsigned char utf16_literal_to_utf8(const unsigned char * const input_pointer, const unsigned char * const input_end, unsigned char **output_pointer) +{ + long unsigned int codepoint = 0; + unsigned int first_code = 0; + const unsigned char *first_sequence = input_pointer; + unsigned char utf8_length = 0; + unsigned char utf8_position = 0; + unsigned char sequence_length = 0; + unsigned char first_byte_mark = 0; + + if ((input_end - first_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + /* get the first utf16 sequence */ + first_code = parse_hex4(first_sequence + 2); + + /* check that the code is valid */ + if (((first_code >= 0xDC00) && (first_code <= 0xDFFF))) + { + goto fail; + } + + /* UTF16 surrogate pair */ + if ((first_code >= 0xD800) && (first_code <= 0xDBFF)) + { + const unsigned char *second_sequence = first_sequence + 6; + unsigned int second_code = 0; + sequence_length = 12; /* \uXXXX\uXXXX */ + + if ((input_end - second_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u')) + { + /* missing second half of the surrogate pair */ + goto fail; + } + + /* get the second utf16 sequence */ + second_code = parse_hex4(second_sequence + 2); + /* check that the code is valid */ + if ((second_code < 0xDC00) || (second_code > 0xDFFF)) + { + /* invalid second half of the surrogate pair */ + goto fail; + } + + + /* calculate the unicode codepoint from the surrogate pair */ + codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF)); + } + else + { + sequence_length = 6; /* \uXXXX */ + codepoint = first_code; + } + + /* encode as UTF-8 + * takes at maximum 4 bytes to encode: + * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + if (codepoint < 0x80) + { + /* normal ascii, encoding 0xxxxxxx */ + utf8_length = 1; + } + else if (codepoint < 0x800) + { + /* two bytes, encoding 110xxxxx 10xxxxxx */ + utf8_length = 2; + first_byte_mark = 0xC0; /* 11000000 */ + } + else if (codepoint < 0x10000) + { + /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */ + utf8_length = 3; + first_byte_mark = 0xE0; /* 11100000 */ + } + else if (codepoint <= 0x10FFFF) + { + /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + utf8_length = 4; + first_byte_mark = 0xF0; /* 11110000 */ + } + else + { + /* invalid unicode codepoint */ + goto fail; + } + + /* encode as utf8 */ + for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--) + { + /* 10xxxxxx */ + (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF); + codepoint >>= 6; + } + /* encode first byte */ + if (utf8_length > 1) + { + (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF); + } + else + { + (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F); + } + + *output_pointer += utf8_length; + + return sequence_length; + +fail: + return 0; +} + +/* Parse the input text into an unescaped cinput, and populate item. */ +static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) +{ + const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; + const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; + unsigned char *output_pointer = NULL; + unsigned char *output = NULL; + + /* not a string */ + if (buffer_at_offset(input_buffer)[0] != '\"') + { + goto fail; + } + + { + /* calculate approximate size of the output (overestimate) */ + size_t allocation_length = 0; + size_t skipped_bytes = 0; + while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"')) + { + /* is escape sequence */ + if (input_end[0] == '\\') + { + if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length) + { + /* prevent buffer overflow when last input character is a backslash */ + goto fail; + } + skipped_bytes++; + input_end++; + } + input_end++; + } + if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"')) + { + goto fail; /* string ended unexpectedly */ + } + + /* This is at most how much we need for the output */ + allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes; + output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); + if (output == NULL) + { + goto fail; /* allocation failure */ + } + } + + output_pointer = output; + /* loop through the string literal */ + while (input_pointer < input_end) + { + if (*input_pointer != '\\') + { + *output_pointer++ = *input_pointer++; + } + /* escape sequence */ + else + { + unsigned char sequence_length = 2; + if ((input_end - input_pointer) < 1) + { + goto fail; + } + + switch (input_pointer[1]) + { + case 'b': + *output_pointer++ = '\b'; + break; + case 'f': + *output_pointer++ = '\f'; + break; + case 'n': + *output_pointer++ = '\n'; + break; + case 'r': + *output_pointer++ = '\r'; + break; + case 't': + *output_pointer++ = '\t'; + break; + case '\"': + case '\\': + case '/': + *output_pointer++ = input_pointer[1]; + break; + + /* UTF-16 literal */ + case 'u': + sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer); + if (sequence_length == 0) + { + /* failed to convert UTF16-literal to UTF-8 */ + goto fail; + } + break; + + default: + goto fail; + } + input_pointer += sequence_length; + } + } + + /* zero terminate the output */ + *output_pointer = '\0'; + + item->type = cJSON_String; + item->valuestring = (char*)output; + + input_buffer->offset = (size_t) (input_end - input_buffer->content); + input_buffer->offset++; + + return true; + +fail: + if (output != NULL) + { + input_buffer->hooks.deallocate(output); + } + + if (input_pointer != NULL) + { + input_buffer->offset = (size_t)(input_pointer - input_buffer->content); + } + + return false; +} + +/* Render the cstring provided to an escaped version that can be printed. */ +static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) +{ + const unsigned char *input_pointer = NULL; + unsigned char *output = NULL; + unsigned char *output_pointer = NULL; + size_t output_length = 0; + /* numbers of additional characters needed for escaping */ + size_t escape_characters = 0; + + if (output_buffer == NULL) + { + return false; + } + + /* empty string */ + if (input == NULL) + { + output = ensure(output_buffer, sizeof("\"\"")); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "\"\""); + + return true; + } + + /* set "flag" to 1 if something needs to be escaped */ + for (input_pointer = input; *input_pointer; input_pointer++) + { + switch (*input_pointer) + { + case '\"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + /* one character escape sequence */ + escape_characters++; + break; + default: + if (*input_pointer < 32) + { + /* UTF-16 escape sequence uXXXX */ + escape_characters += 5; + } + break; + } + } + output_length = (size_t)(input_pointer - input) + escape_characters; + + output = ensure(output_buffer, output_length + sizeof("\"\"")); + if (output == NULL) + { + return false; + } + + /* no characters have to be escaped */ + if (escape_characters == 0) + { + output[0] = '\"'; + memcpy(output + 1, input, output_length); + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; + } + + output[0] = '\"'; + output_pointer = output + 1; + /* copy the string */ + for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++) + { + if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\')) + { + /* normal character, copy */ + *output_pointer = *input_pointer; + } + else + { + /* character needs to be escaped */ + *output_pointer++ = '\\'; + switch (*input_pointer) + { + case '\\': + *output_pointer = '\\'; + break; + case '\"': + *output_pointer = '\"'; + break; + case '\b': + *output_pointer = 'b'; + break; + case '\f': + *output_pointer = 'f'; + break; + case '\n': + *output_pointer = 'n'; + break; + case '\r': + *output_pointer = 'r'; + break; + case '\t': + *output_pointer = 't'; + break; + default: + /* escape and print as unicode codepoint */ + sprintf((char*)output_pointer, "u%04x", *input_pointer); + output_pointer += 4; + break; + } + } + } + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; +} + +/* Invoke print_string_ptr (which is useful) on an item. */ +static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) +{ + return print_string_ptr((unsigned char*)item->valuestring, p); +} + +/* Predeclare these prototypes. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer); + +/* Utility to jump whitespace and cr/lf */ +static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL)) + { + return NULL; + } + + while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) + { + buffer->offset++; + } + + if (buffer->offset == buffer->length) + { + buffer->offset--; + } + + return buffer; +} + +/* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */ +static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0)) + { + return NULL; + } + + if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0)) + { + buffer->offset += 3; + } + + return buffer; +} + +/* Parse an object - create a new root, and populate. */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; + cJSON *item = NULL; + + /* reset error position */ + global_error.json = NULL; + global_error.position = 0; + + if (value == NULL) + { + goto fail; + } + + buffer.content = (const unsigned char*)value; + buffer.length = strlen((const char*)value) + sizeof(""); + buffer.offset = 0; + buffer.hooks = global_hooks; + + item = cJSON_New_Item(&global_hooks); + if (item == NULL) /* memory fail */ + { + goto fail; + } + + if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) + { + /* parse failure. ep is set. */ + goto fail; + } + + /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ + if (require_null_terminated) + { + buffer_skip_whitespace(&buffer); + if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0') + { + goto fail; + } + } + if (return_parse_end) + { + *return_parse_end = (const char*)buffer_at_offset(&buffer); + } + + return item; + +fail: + if (item != NULL) + { + cJSON_Delete(item); + } + + if (value != NULL) + { + error local_error; + local_error.json = (const unsigned char*)value; + local_error.position = 0; + + if (buffer.offset < buffer.length) + { + local_error.position = buffer.offset; + } + else if (buffer.length > 0) + { + local_error.position = buffer.length - 1; + } + + if (return_parse_end != NULL) + { + *return_parse_end = (const char*)local_error.json + local_error.position; + } + + global_error = local_error; + } + + return NULL; +} + +/* Default options for cJSON_Parse */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) +{ + return cJSON_ParseWithOpts(value, 0, 0); +} + +#define cjson_min(a, b) ((a < b) ? a : b) + +static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) +{ + static const size_t default_buffer_size = 256; + printbuffer buffer[1]; + unsigned char *printed = NULL; + + memset(buffer, 0, sizeof(buffer)); + + /* create buffer */ + buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size); + buffer->length = default_buffer_size; + buffer->format = format; + buffer->hooks = *hooks; + if (buffer->buffer == NULL) + { + goto fail; + } + + /* print the value */ + if (!print_value(item, buffer)) + { + goto fail; + } + update_offset(buffer); + + /* check if reallocate is available */ + if (hooks->reallocate != NULL) + { + printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1); + if (printed == NULL) { + goto fail; + } + buffer->buffer = NULL; + } + else /* otherwise copy the JSON over to a new buffer */ + { + printed = (unsigned char*) hooks->allocate(buffer->offset + 1); + if (printed == NULL) + { + goto fail; + } + memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1)); + printed[buffer->offset] = '\0'; /* just to be sure */ + + /* free the buffer */ + hooks->deallocate(buffer->buffer); + } + + return printed; + +fail: + if (buffer->buffer != NULL) + { + hooks->deallocate(buffer->buffer); + } + + if (printed != NULL) + { + hooks->deallocate(printed); + } + + return NULL; +} + +/* Render a cJSON item/entity/structure to text. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) +{ + return (char*)print(item, true, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) +{ + return (char*)print(item, false, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if (prebuffer < 0) + { + return NULL; + } + + p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer); + if (!p.buffer) + { + return NULL; + } + + p.length = (size_t)prebuffer; + p.offset = 0; + p.noalloc = false; + p.format = fmt; + p.hooks = global_hooks; + + if (!print_value(item, &p)) + { + global_hooks.deallocate(p.buffer); + return NULL; + } + + return (char*)p.buffer; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if ((len < 0) || (buf == NULL)) + { + return false; + } + + p.buffer = (unsigned char*)buf; + p.length = (size_t)len; + p.offset = 0; + p.noalloc = true; + p.format = fmt; + p.hooks = global_hooks; + + return print_value(item, &p); +} + +/* Parser core - when encountering text, process appropriately. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) +{ + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; /* no input */ + } + + /* parse the different types of values */ + /* null */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0)) + { + item->type = cJSON_NULL; + input_buffer->offset += 4; + return true; + } + /* false */ + if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0)) + { + item->type = cJSON_False; + input_buffer->offset += 5; + return true; + } + /* true */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0)) + { + item->type = cJSON_True; + item->valueint = 1; + input_buffer->offset += 4; + return true; + } + /* string */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"')) + { + return parse_string(item, input_buffer); + } + /* number */ + if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9')))) + { + return parse_number(item, input_buffer); + } + /* array */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '[')) + { + return parse_array(item, input_buffer); + } + /* object */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{')) + { + return parse_object(item, input_buffer); + } + + return false; +} + +/* Render a value to text. */ +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output = NULL; + + if ((item == NULL) || (output_buffer == NULL)) + { + return false; + } + + switch ((item->type) & 0xFF) + { + case cJSON_NULL: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "null"); + return true; + + case cJSON_False: + output = ensure(output_buffer, 6); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "false"); + return true; + + case cJSON_True: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "true"); + return true; + + case cJSON_Number: + return print_number(item, output_buffer); + + case cJSON_Raw: + { + size_t raw_length = 0; + if (item->valuestring == NULL) + { + return false; + } + + raw_length = strlen(item->valuestring) + sizeof(""); + output = ensure(output_buffer, raw_length); + if (output == NULL) + { + return false; + } + memcpy(output, item->valuestring, raw_length); + return true; + } + + case cJSON_String: + return print_string(item, output_buffer); + + case cJSON_Array: + return print_array(item, output_buffer); + + case cJSON_Object: + return print_object(item, output_buffer); + + default: + return false; + } +} + +/* Build an array from input text. */ +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* head of the linked list */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (buffer_at_offset(input_buffer)[0] != '[') + { + /* not an array */ + goto fail; + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']')) + { + /* empty array */ + goto success; + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse next value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']') + { + goto fail; /* expected end of array */ + } + +success: + input_buffer->depth--; + + item->type = cJSON_Array; + item->child = head; + + input_buffer->offset++; + + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an array to text */ +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_element = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output array. */ + /* opening square bracket */ + output_pointer = ensure(output_buffer, 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer = '['; + output_buffer->offset++; + output_buffer->depth++; + + while (current_element != NULL) + { + if (!print_value(current_element, output_buffer)) + { + return false; + } + update_offset(output_buffer); + if (current_element->next) + { + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ','; + if(output_buffer->format) + { + *output_pointer++ = ' '; + } + *output_pointer = '\0'; + output_buffer->offset += length; + } + current_element = current_element->next; + } + + output_pointer = ensure(output_buffer, 2); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ']'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Build an object from the text. */ +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* linked list head */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{')) + { + goto fail; /* not an object */ + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}')) + { + goto success; /* empty object */ + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse the name of the child */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_string(current_item, input_buffer)) + { + goto fail; /* faile to parse name */ + } + buffer_skip_whitespace(input_buffer); + + /* swap valuestring and string, because we parsed the name */ + current_item->string = current_item->valuestring; + current_item->valuestring = NULL; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':')) + { + goto fail; /* invalid object */ + } + + /* parse the value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}')) + { + goto fail; /* expected end of object */ + } + +success: + input_buffer->depth--; + + item->type = cJSON_Object; + item->child = head; + + input_buffer->offset++; + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an object to text. */ +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_item = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output: */ + length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */ + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer++ = '{'; + output_buffer->depth++; + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + output_buffer->offset += length; + + while (current_item) + { + if (output_buffer->format) + { + size_t i; + output_pointer = ensure(output_buffer, output_buffer->depth); + if (output_pointer == NULL) + { + return false; + } + for (i = 0; i < output_buffer->depth; i++) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += output_buffer->depth; + } + + /* print key */ + if (!print_string_ptr((unsigned char*)current_item->string, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ':'; + if (output_buffer->format) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += length; + + /* print value */ + if (!print_value(current_item, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + /* print comma if not last */ + length = (size_t) ((output_buffer->format ? 1 : 0) + (current_item->next ? 1 : 0)); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + if (current_item->next) + { + *output_pointer++ = ','; + } + + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + *output_pointer = '\0'; + output_buffer->offset += length; + + current_item = current_item->next; + } + + output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2); + if (output_pointer == NULL) + { + return false; + } + if (output_buffer->format) + { + size_t i; + for (i = 0; i < (output_buffer->depth - 1); i++) + { + *output_pointer++ = '\t'; + } + } + *output_pointer++ = '}'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Get Array size/item / object item. */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array) +{ + cJSON *child = NULL; + size_t size = 0; + + if (array == NULL) + { + return 0; + } + + child = array->child; + + while(child != NULL) + { + size++; + child = child->next; + } + + /* FIXME: Can overflow here. Cannot be fixed without breaking the API */ + + return (int)size; +} + +static cJSON* get_array_item(const cJSON *array, size_t index) +{ + cJSON *current_child = NULL; + + if (array == NULL) + { + return NULL; + } + + current_child = array->child; + while ((current_child != NULL) && (index > 0)) + { + index--; + current_child = current_child->next; + } + + return current_child; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) +{ + if (index < 0) + { + return NULL; + } + + return get_array_item(array, (size_t)index); +} + +static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) +{ + cJSON *current_element = NULL; + + if ((object == NULL) || (name == NULL)) + { + return NULL; + } + + current_element = object->child; + if (case_sensitive) + { + while ((current_element != NULL) && (strcmp(name, current_element->string) != 0)) + { + current_element = current_element->next; + } + } + else + { + while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) + { + current_element = current_element->next; + } + } + + return current_element; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, false); +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string) +{ + return cJSON_GetObjectItem(object, string) ? 1 : 0; +} + +/* Utility for array list handling. */ +static void suffix_object(cJSON *prev, cJSON *item) +{ + prev->next = item; + item->prev = prev; +} + +/* Utility for handling references. */ +static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) +{ + cJSON *reference = NULL; + if (item == NULL) + { + return NULL; + } + + reference = cJSON_New_Item(hooks); + if (reference == NULL) + { + return NULL; + } + + memcpy(reference, item, sizeof(cJSON)); + reference->string = NULL; + reference->type |= cJSON_IsReference; + reference->next = reference->prev = NULL; + return reference; +} + +static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) +{ + cJSON *child = NULL; + + if ((item == NULL) || (array == NULL)) + { + return false; + } + + child = array->child; + + if (child == NULL) + { + /* list is empty, start new one */ + array->child = item; + } + else + { + /* append to the end */ + while (child->next) + { + child = child->next; + } + suffix_object(child, item); + } + + return true; +} + +/* Add item to array/object. */ +CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item) +{ + add_item_to_array(array, item); +} + +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic push +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wcast-qual" +#endif +/* helper function to cast away const */ +static void* cast_away_const(const void* string) +{ + return (void*)string; +} +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic pop +#endif + + +static cJSON_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool constant_key) +{ + char *new_key = NULL; + int new_type = cJSON_Invalid; + + if ((object == NULL) || (string == NULL) || (item == NULL)) + { + return false; + } + + if (constant_key) + { + new_key = (char*)cast_away_const(string); + new_type = item->type | cJSON_StringIsConst; + } + else + { + new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); + if (new_key == NULL) + { + return false; + } + + new_type = item->type & ~cJSON_StringIsConst; + } + + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + hooks->deallocate(item->string); + } + + item->string = new_key; + item->type = new_type; + + return add_item_to_array(object, item); +} + +CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) +{ + add_item_to_object(object, string, item, &global_hooks, false); +} + +/* Add an item to an object with constant string as key */ +CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) +{ + add_item_to_object(object, string, item, &global_hooks, true); +} + +CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) +{ + if (array == NULL) + { + return; + } + + add_item_to_array(array, create_reference(item, &global_hooks)); +} + +CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) +{ + if ((object == NULL) || (string == NULL)) + { + return; + } + + add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) +{ + cJSON *null = cJSON_CreateNull(); + if (add_item_to_object(object, name, null, &global_hooks, false)) + { + return null; + } + + cJSON_Delete(null); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name) +{ + cJSON *true_item = cJSON_CreateTrue(); + if (add_item_to_object(object, name, true_item, &global_hooks, false)) + { + return true_item; + } + + cJSON_Delete(true_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name) +{ + cJSON *false_item = cJSON_CreateFalse(); + if (add_item_to_object(object, name, false_item, &global_hooks, false)) + { + return false_item; + } + + cJSON_Delete(false_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) +{ + cJSON *bool_item = cJSON_CreateBool(boolean); + if (add_item_to_object(object, name, bool_item, &global_hooks, false)) + { + return bool_item; + } + + cJSON_Delete(bool_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) +{ + cJSON *number_item = cJSON_CreateNumber(number); + if (add_item_to_object(object, name, number_item, &global_hooks, false)) + { + return number_item; + } + + cJSON_Delete(number_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) +{ + cJSON *string_item = cJSON_CreateString(string); + if (add_item_to_object(object, name, string_item, &global_hooks, false)) + { + return string_item; + } + + cJSON_Delete(string_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) +{ + cJSON *raw_item = cJSON_CreateRaw(raw); + if (add_item_to_object(object, name, raw_item, &global_hooks, false)) + { + return raw_item; + } + + cJSON_Delete(raw_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name) +{ + cJSON *object_item = cJSON_CreateObject(); + if (add_item_to_object(object, name, object_item, &global_hooks, false)) + { + return object_item; + } + + cJSON_Delete(object_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name) +{ + cJSON *array = cJSON_CreateArray(); + if (add_item_to_object(object, name, array, &global_hooks, false)) + { + return array; + } + + cJSON_Delete(array); + return NULL; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) +{ + if ((parent == NULL) || (item == NULL)) + { + return NULL; + } + + if (item->prev != NULL) + { + /* not the first element */ + item->prev->next = item->next; + } + if (item->next != NULL) + { + /* not the last element */ + item->next->prev = item->prev; + } + + if (item == parent->child) + { + /* first element */ + parent->child = item->next; + } + /* make sure the detached item doesn't point anywhere anymore */ + item->prev = NULL; + item->next = NULL; + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) +{ + if (which < 0) + { + return NULL; + } + + return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which) +{ + cJSON_Delete(cJSON_DetachItemFromArray(array, which)); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItem(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObject(object, string)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); +} + +/* Replace array/object items with new ones. */ +CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) +{ + cJSON *after_inserted = NULL; + + if (which < 0) + { + return; + } + + after_inserted = get_array_item(array, (size_t)which); + if (after_inserted == NULL) + { + add_item_to_array(array, newitem); + return; + } + + newitem->next = after_inserted; + newitem->prev = after_inserted->prev; + after_inserted->prev = newitem; + if (after_inserted == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) +{ + if ((parent == NULL) || (replacement == NULL) || (item == NULL)) + { + return false; + } + + if (replacement == item) + { + return true; + } + + replacement->next = item->next; + replacement->prev = item->prev; + + if (replacement->next != NULL) + { + replacement->next->prev = replacement; + } + if (replacement->prev != NULL) + { + replacement->prev->next = replacement; + } + if (parent->child == item) + { + parent->child = replacement; + } + + item->next = NULL; + item->prev = NULL; + cJSON_Delete(item); + + return true; +} + +CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) +{ + if (which < 0) + { + return; + } + + cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); +} + +static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) +{ + if ((replacement == NULL) || (string == NULL)) + { + return false; + } + + /* replace the name in the replacement */ + if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) + { + cJSON_free(replacement->string); + } + replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + replacement->type &= ~cJSON_StringIsConst; + + cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); + + return true; +} + +CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) +{ + replace_item_in_object(object, string, newitem, false); +} + +CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) +{ + replace_item_in_object(object, string, newitem, true); +} + +/* Create basic types: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_NULL; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_True; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool b) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = b ? cJSON_True : cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Number; + item->valuedouble = num; + + /* use saturation in case of overflow */ + if (num >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (num <= INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)num; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_String; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) + { + item->type = cJSON_String | cJSON_IsReference; + item->valuestring = (char*)cast_away_const(string); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Object | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) { + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Array | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Raw; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type=cJSON_Array; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item) + { + item->type = cJSON_Object; + } + + return item; +} + +/* Create Arrays: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if (!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber((double)numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0;a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (strings == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for (i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateString(strings[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p,n); + } + p = n; + } + + return a; +} + +/* Duplication */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) +{ + cJSON *newitem = NULL; + cJSON *child = NULL; + cJSON *next = NULL; + cJSON *newchild = NULL; + + /* Bail on bad ptr */ + if (!item) + { + goto fail; + } + /* Create new item */ + newitem = cJSON_New_Item(&global_hooks); + if (!newitem) + { + goto fail; + } + /* Copy over all vars */ + newitem->type = item->type & (~cJSON_IsReference); + newitem->valueint = item->valueint; + newitem->valuedouble = item->valuedouble; + if (item->valuestring) + { + newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); + if (!newitem->valuestring) + { + goto fail; + } + } + if (item->string) + { + newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); + if (!newitem->string) + { + goto fail; + } + } + /* If non-recursive, then we're done! */ + if (!recurse) + { + return newitem; + } + /* Walk the ->next chain for the child. */ + child = item->child; + while (child != NULL) + { + newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ + if (!newchild) + { + goto fail; + } + if (next != NULL) + { + /* If newitem->child already set, then crosswire ->prev and ->next and move on */ + next->next = newchild; + newchild->prev = next; + next = newchild; + } + else + { + /* Set newitem->child and move to it */ + newitem->child = newchild; + next = newchild; + } + child = child->next; + } + + return newitem; + +fail: + if (newitem != NULL) + { + cJSON_Delete(newitem); + } + + return NULL; +} + +CJSON_PUBLIC(void) cJSON_Minify(char *json) +{ + unsigned char *into = (unsigned char*)json; + + if (json == NULL) + { + return; + } + + while (*json) + { + if (*json == ' ') + { + json++; + } + else if (*json == '\t') + { + /* Whitespace characters. */ + json++; + } + else if (*json == '\r') + { + json++; + } + else if (*json=='\n') + { + json++; + } + else if ((*json == '/') && (json[1] == '/')) + { + /* double-slash comments, to end of line. */ + while (*json && (*json != '\n')) + { + json++; + } + } + else if ((*json == '/') && (json[1] == '*')) + { + /* multiline comments. */ + while (*json && !((*json == '*') && (json[1] == '/'))) + { + json++; + } + json += 2; + } + else if (*json == '\"') + { + /* string literals, which are \" sensitive. */ + *into++ = (unsigned char)*json++; + while (*json && (*json != '\"')) + { + if (*json == '\\') + { + *into++ = (unsigned char)*json++; + } + *into++ = (unsigned char)*json++; + } + *into++ = (unsigned char)*json++; + } + else + { + /* All other characters. */ + *into++ = (unsigned char)*json++; + } + } + + /* and null-terminate. */ + *into = '\0'; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Invalid; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_False; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xff) == cJSON_True; +} + + +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & (cJSON_True | cJSON_False)) != 0; +} +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_NULL; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Number; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_String; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Array; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Object; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Raw; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) +{ + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) + { + return false; + } + + /* check if type is valid */ + switch (a->type & 0xFF) + { + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + case cJSON_Number: + case cJSON_String: + case cJSON_Raw: + case cJSON_Array: + case cJSON_Object: + break; + + default: + return false; + } + + /* identical objects are equal */ + if (a == b) + { + return true; + } + + switch (a->type & 0xFF) + { + /* in these cases and equal type is enough */ + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + return true; + + case cJSON_Number: + if (a->valuedouble == b->valuedouble) + { + return true; + } + return false; + + case cJSON_String: + case cJSON_Raw: + if ((a->valuestring == NULL) || (b->valuestring == NULL)) + { + return false; + } + if (strcmp(a->valuestring, b->valuestring) == 0) + { + return true; + } + + return false; + + case cJSON_Array: + { + cJSON *a_element = a->child; + cJSON *b_element = b->child; + + for (; (a_element != NULL) && (b_element != NULL);) + { + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + + a_element = a_element->next; + b_element = b_element->next; + } + + /* one of the arrays is longer than the other */ + if (a_element != b_element) { + return false; + } + + return true; + } + + case cJSON_Object: + { + cJSON *a_element = NULL; + cJSON *b_element = NULL; + cJSON_ArrayForEach(a_element, a) + { + /* TODO This has O(n^2) runtime, which is horrible! */ + b_element = get_object_item(b, a_element->string, case_sensitive); + if (b_element == NULL) + { + return false; + } + + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + } + + /* doing this twice, once on a and b to prevent true comparison if a subset of b + * TODO: Do this the proper way, this is just a fix for now */ + cJSON_ArrayForEach(b_element, b) + { + a_element = get_object_item(a, b_element->string, case_sensitive); + if (a_element == NULL) + { + return false; + } + + if (!cJSON_Compare(b_element, a_element, case_sensitive)) + { + return false; + } + } + + return true; + } + + default: + return false; + } +} + +CJSON_PUBLIC(void *) cJSON_malloc(size_t size) +{ + return global_hooks.allocate(size); +} + +CJSON_PUBLIC(void) cJSON_free(void *object) +{ + global_hooks.deallocate(object); +} diff --git a/lib/sbi/openapi/.openapi-generator/templates/cJSON.h.mustache b/lib/sbi/openapi/.openapi-generator/templates/cJSON.h.mustache new file mode 100644 index 000000000..6e0bde932 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/cJSON.h.mustache @@ -0,0 +1,277 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef cJSON__h +#define cJSON__h + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* project version */ +#define CJSON_VERSION_MAJOR 1 +#define CJSON_VERSION_MINOR 7 +#define CJSON_VERSION_PATCH 7 + +#include + +/* cJSON Types: */ +#define cJSON_Invalid (0) +#define cJSON_False (1 << 0) +#define cJSON_True (1 << 1) +#define cJSON_NULL (1 << 2) +#define cJSON_Number (1 << 3) +#define cJSON_String (1 << 4) +#define cJSON_Array (1 << 5) +#define cJSON_Object (1 << 6) +#define cJSON_Raw (1 << 7) /* raw json */ + +#define cJSON_IsReference 256 +#define cJSON_StringIsConst 512 + +/* The cJSON structure: */ +typedef struct cJSON +{ + /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ + struct cJSON *next; + struct cJSON *prev; + /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + struct cJSON *child; + + /* The type of the item, as above. */ + int type; + + /* The item's string, if type==cJSON_String and type == cJSON_Raw */ + char *valuestring; + /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ + int valueint; + /* The item's number, if type==cJSON_Number */ + double valuedouble; + + /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ + char *string; +} cJSON; + +typedef struct cJSON_Hooks +{ + void *(*malloc_fn)(size_t sz); + void (*free_fn)(void *ptr); +} cJSON_Hooks; + +typedef int cJSON_bool; + +#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) +#define __WINDOWS__ +#endif +#ifdef __WINDOWS__ + +/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 2 define options: + +CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols +CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) +CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol + +For *nix builds that support visibility attribute, you can define similar behavior by + +setting default visibility to hidden by adding +-fvisibility=hidden (for gcc) +or +-xldscope=hidden (for sun cc) +to CFLAGS + +then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does + +*/ + +/* export symbols by default, this is necessary for copy pasting the C and header file */ +#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) +#define CJSON_EXPORT_SYMBOLS +#endif + +#if defined(CJSON_HIDE_SYMBOLS) +#define CJSON_PUBLIC(type) type __stdcall +#elif defined(CJSON_EXPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall +#elif defined(CJSON_IMPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall +#endif +#else /* !WIN32 */ +#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) +#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type +#else +#define CJSON_PUBLIC(type) type +#endif +#endif + +/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. + * This is to prevent stack overflows. */ +#ifndef CJSON_NESTING_LIMIT +#define CJSON_NESTING_LIMIT 1000 +#endif + +/* returns the version of cJSON as a string */ +CJSON_PUBLIC(const char*) cJSON_Version(void); + +/* Supply malloc, realloc and free functions to cJSON */ +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks); + +/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ +/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); +/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ +/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); + +/* Render a cJSON entity to text for transfer/storage. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); +/* Render a cJSON entity to text for transfer/storage without any formatting. */ +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); +/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); +/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ +/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); +/* Delete a cJSON entity and all subentities. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *c); + +/* Returns the number of items in an array (or object). */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); +/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index); +/* Get item "string" from object. Case insensitive. */ +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string); +/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); + +/* Check if the item is a string and return its valuestring */ +CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item); + +/* These functions check the type of an item */ +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item); + +/* These calls create a cJSON item of the appropriate type. */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num); +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); +/* raw json */ +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); + +/* Create a string where valuestring references a string so + * it will not be freed by cJSON_Delete */ +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); +/* Create an object/arrray that only references it's elements so + * they will not be freed by cJSON_Delete */ +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); + +/* These utilities create an Array of count items. */ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count); + +/* Append item to the specified array/object. */ +CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. + * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before + * writing to `item->string` */ +CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ +CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); + +/* Remove/Detatch items from Arrays/Objects. */ +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); + +/* Update array items. */ +CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); + +/* Duplicate a cJSON item */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); +/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will +need to be released. With recurse!=0, it will duplicate any children connected to the item. +The item->next and ->prev pointers are always zero on return from Duplicate. */ +/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. + * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); + + +CJSON_PUBLIC(void) cJSON_Minify(char *json); + +/* Helper functions for creating and adding items to an object at the same time. + * They return the added item or NULL on failure. */ +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name); + +/* When assigning an integer value, it needs to be propagated to valuedouble too. */ +#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) +/* helper for the cJSON_SetNumberValue macro */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); +#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) + +/* Macro for iterating over an array or object */ +#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) + +/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ +CJSON_PUBLIC(void *) cJSON_malloc(size_t size); +CJSON_PUBLIC(void) cJSON_free(void *object); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/sbi/openapi/.openapi-generator/templates/keyValuePair.h.mustache b/lib/sbi/openapi/.openapi-generator/templates/keyValuePair.h.mustache new file mode 100644 index 000000000..6dc64371a --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/keyValuePair.h.mustache @@ -0,0 +1,25 @@ +#ifndef OGS_SBI_MAP_H +#define OGS_SBI_MAP_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_map_s { + char *key; + void *value; +} OpenAPI_map_t; + +OpenAPI_map_t *OpenAPI_map_create(char *key, void *value); + +OpenAPI_map_t *OpenAPI_map_create_allocate(char *key, double value); + +void OpenAPI_map_free(OpenAPI_map_t *OpenAPI_map); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_MAP_H */ diff --git a/lib/sbi/openapi/.openapi-generator/templates/list.c.mustache b/lib/sbi/openapi/.openapi-generator/templates/list.c.mustache new file mode 100644 index 000000000..fae69f502 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/list.c.mustache @@ -0,0 +1,169 @@ +#include +#include +#include + +#include "../include/list.h" +static OpenAPI_lnode_t *listEntry_create(void *data) +{ + OpenAPI_lnode_t *created = ogs_malloc(sizeof(OpenAPI_lnode_t)); + + if (created == NULL) { + // TODO Malloc Failure + return NULL; + } + created->data = data; + + return created; +} + +void OpenAPI_lnode_free(OpenAPI_lnode_t *listEntry, void *additionalData) +{ + ogs_free(listEntry); +} + +void OpenAPI_lnode_print(OpenAPI_lnode_t *listEntry, void *additionalData) +{ + printf("%i\n", *((int *) (listEntry->data))); +} + +OpenAPI_list_t *OpenAPI_list_create(void) +{ + OpenAPI_list_t *createdList = ogs_malloc(sizeof(OpenAPI_list_t)); + + if (createdList == NULL) { + // TODO Malloc Failure + return NULL; + } + createdList->first = NULL; + createdList->last = NULL; + createdList->count = 0; + + return createdList; +} + +void OpenAPI_list_iterate_forward(OpenAPI_list_t *list, + void (*operationToPerform)( + OpenAPI_lnode_t *, void *callbackFunctionUsedData), + void *additionalDataNeededForCallbackFunction) +{ + OpenAPI_lnode_t *current = list->first; + OpenAPI_lnode_t *next; + + if (current == NULL) { + return; + } + + next = current->next; + + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + + while (current != NULL) { + next = current->next; + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + } +} + +void OpenAPI_list_iterate_backward(OpenAPI_list_t *list, + void (*operationToPerform)( + OpenAPI_lnode_t *, void *callbackFunctionUsedData), + void *additionalDataNeededForCallbackFunction) +{ + OpenAPI_lnode_t *current = list->last; + OpenAPI_lnode_t *next = current->prev; + + if (current == NULL) { + return; + } + + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + + while (current != NULL) { + next = current->prev; + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + } +} + +void OpenAPI_list_free(OpenAPI_list_t *list) +{ + if (list){ + OpenAPI_list_iterate_forward(list, OpenAPI_lnode_free, NULL); + ogs_free(list); + } +} + +void OpenAPI_list_add(OpenAPI_list_t *list, void *dataToAddInList) +{ + OpenAPI_lnode_t *newListEntry = listEntry_create(dataToAddInList); + if (newListEntry == NULL) { + // TODO Malloc Failure + return; + } + if (list->first == NULL) { + list->first = newListEntry; + list->last = newListEntry; + + newListEntry->prev = NULL; + newListEntry->next = NULL; + + list->count++; + + return; + } + + list->last->next = newListEntry; + newListEntry->prev = list->last; + newListEntry->next = NULL; + list->last = newListEntry; + + list->count++; +} + +void OpenAPI_list_remove(OpenAPI_list_t *list, OpenAPI_lnode_t *elementToRemove) +{ + OpenAPI_lnode_t *elementBeforeElementToRemove = elementToRemove->prev; + OpenAPI_lnode_t *elementAfterElementToRemove = elementToRemove->next; + + if (elementBeforeElementToRemove != NULL) { + elementBeforeElementToRemove->next = elementAfterElementToRemove; + } else { + list->first = elementAfterElementToRemove; + } + + if (elementAfterElementToRemove != NULL) { + elementAfterElementToRemove->prev = elementBeforeElementToRemove; + } else { + list->last = elementBeforeElementToRemove; + } + + OpenAPI_lnode_free(elementToRemove, NULL); + + list->count--; +} + +OpenAPI_lnode_t *OpenAPI_list_find(OpenAPI_list_t *list, long indexOfElement) +{ + OpenAPI_lnode_t *current; + int i; + + if ((list->count / 2) > indexOfElement) { + current = list->first; + + for(i = 0; i < indexOfElement; i++) { + current = current->next; + } + + return current; + } else { + current = list->last; + + for(i = 1; i < (list->count - indexOfElement); i++) { + current = current->prev; + } + + return current; + } +} diff --git a/lib/sbi/openapi/.openapi-generator/templates/list.h.mustache b/lib/sbi/openapi/.openapi-generator/templates/list.h.mustache new file mode 100644 index 000000000..ae7cea128 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/list.h.mustache @@ -0,0 +1,54 @@ +#ifndef OGS_SBI_LIST_H +#define OGS_SBI_LIST_H + +#include "../external/cJSON.h" +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OpenAPI_malloc(__sIZE) __sIZE == 0 ? NULL : ogs_malloc(__sIZE) + +typedef struct OpenAPI_list_s OpenAPI_list_t; + +typedef struct OpenAPI_lnode_s OpenAPI_lnode_t; + +struct OpenAPI_lnode_s { + OpenAPI_lnode_t *next; + OpenAPI_lnode_t *prev; + void *data; +}; + +typedef struct OpenAPI_list_s { + OpenAPI_lnode_t *first; + OpenAPI_lnode_t *last; + + long count; +} OpenAPI_list_t; + +#define OpenAPI_list_for_each(list, element) for(element = (list != NULL) ? (list)->first : NULL; element != NULL; element = element->next) + +OpenAPI_list_t *OpenAPI_list_create(void); +void OpenAPI_list_free(OpenAPI_list_t *listToFree); + +void OpenAPI_list_add(OpenAPI_list_t *list, void *dataToAddInList); +OpenAPI_lnode_t *OpenAPI_list_find(OpenAPI_list_t *list, long indexOfElement); +void OpenAPI_list_remove( + OpenAPI_list_t *list, OpenAPI_lnode_t *elementToRemove); + +void OpenAPI_list_iterate_forward(OpenAPI_list_t *list, + void (*operationToPerform)(OpenAPI_lnode_t*, void*), + void *additionalDataNeededForCallbackFunction); +void OpenAPI_list_iterate_backward(OpenAPI_list_t *list, + void (*operationToPerform)(OpenAPI_lnode_t*, void*), + void *additionalDataNeededForCallbackFunction); + +void OpenAPI_lnode_print(OpenAPI_lnode_t *listEntry, void *additionalData); +void OpenAPI_lnode_free(OpenAPI_lnode_t *listEntry, void *additionalData); + +#ifdef __cplusplus +} +#endif + +#endif // OGS_SBI_LIST_H diff --git a/lib/sbi/openapi/.openapi-generator/templates/model-body.mustache b/lib/sbi/openapi/.openapi-generator/templates/model-body.mustache new file mode 100644 index 000000000..17a097d4a --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/model-body.mustache @@ -0,0 +1,776 @@ +{{#models}}{{#model}} +#include +#include +#include +#include "{{classname}}.h" + +{{#isEnum}} + char* OpenAPI_{{classname}}_ToString(OpenAPI_{{classVarName}}_e {{classname}}) + { + const char *{{classname}}Array[] = { "NULL"{{#allowableValues}}{{#enumVars}}, "{{{value}}}"{{/enumVars}}{{/allowableValues}} }; + size_t sizeofArray = sizeof({{classname}}Array) / sizeof({{classname}}Array[0]); + if ({{classname}} < sizeofArray) + return (char *){{classname}}Array[{{classname}}]; + else + return (char *)"Unknown"; + } + + OpenAPI_{{classVarName}}_e OpenAPI_{{classname}}_FromString(char* {{classname}}) + { + int stringToReturn = 0; + const char *{{classname}}Array[] = { "NULL"{{#allowableValues}}{{#enumVars}}, "{{{value}}}"{{/enumVars}}{{/allowableValues}} }; + size_t sizeofArray = sizeof({{classname}}Array) / sizeof({{classname}}Array[0]); + while (stringToReturn < sizeofArray) { + if (strcmp({{classname}}, {{classname}}Array[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; + } +{{/isEnum}} +{{^isEnum}} +{{#vars}} + {{^isContainer}} + {{#isPrimitiveType}} + {{#isEnum}} + char *OpenAPI_{{name}}{{classname}}_ToString(OpenAPI_{{classVarName}}_{{name}}_e {{name}}) + { + const char *{{name}}Array[] = { "NULL"{{#allowableValues}}{{#enumVars}}, "{{{value}}}"{{/enumVars}}{{/allowableValues}} }; + size_t sizeofArray = sizeof({{name}}Array) / sizeof({{name}}Array[0]); + if ({{name}} < sizeofArray) + return (char *){{name}}Array[{{name}}]; + else + return (char *)"Unknown"; + } + + OpenAPI_{{classVarName}}_{{name}}_e OpenAPI_{{name}}{{classname}}_FromString(char* {{name}}) + { + int stringToReturn = 0; + const char *{{name}}Array[] = { "NULL"{{#allowableValues}}{{#enumVars}}, "{{{value}}}"{{/enumVars}}{{/allowableValues}} }; + size_t sizeofArray = sizeof({{name}}Array) / sizeof({{name}}Array[0]); + while (stringToReturn < sizeofArray) { + if (strcmp({{name}}, {{name}}Array[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; + } + {{/isEnum}} + {{/isPrimitiveType}} + {{/isContainer}} +{{/vars}} +OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_create( +{{#vars}} + {{^isContainer}} + {{^isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{datatype}}_e {{name}}{{#hasMore}},{{/hasMore}} + {{/isEnum}} + {{^isEnum}} + {{#isModel}} + OpenAPI_{{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} + {{/isModel}} + {{#isUuid}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isUuid}} + {{#isEmail}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isEmail}} + {{#isFreeFormObject}} + OpenAPI_{{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} + {{/isFreeFormObject}} + {{/isEnum}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{classVarName}}_{{name}}_e {{name}}{{#hasMore}},{{/hasMore}} + {{/isEnum}} + {{^isEnum}} + {{#isNumeric}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isNumeric}} + {{#isBoolean}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isBoolean}} + {{#isString}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isString}} + {{/isEnum}} + {{#isByteArray}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isByteArray}} + {{#isBinary}} + OpenAPI_{{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isBinary}} + {{#isDate}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isDate}} + {{#isDateTime}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isDateTime}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + OpenAPI_{{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} + {{/isListContainer}} + {{#isMapContainer}} + OpenAPI_{{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isMapContainer}} + {{/isContainer}} +{{/vars}}) +{ + OpenAPI_{{classname}}_t *{{classname}}_local_var = OpenAPI_malloc(sizeof(OpenAPI_{{classname}}_t)); + if (!{{classname}}_local_var) { + return NULL; + } +{{#vars}} + {{classname}}_local_var->{{{name}}} = {{{name}}}; +{{/vars}} + + return {{classname}}_local_var; +} + +void OpenAPI_{{classname}}_free(OpenAPI_{{classname}}_t *{{classname}}) +{ + if (NULL == {{classname}}) { + return ; + } + OpenAPI_lnode_t *node; +{{#vars}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnum}} + {{#isModel}} + OpenAPI_{{{complexType}}}_free({{{classname}}}->{{{name}}}); + {{/isModel}} + {{#isUuid}} + ogs_free({{{classname}}}->{{{name}}}); + {{/isUuid}} + {{#isEmail}} + ogs_free({{{classname}}}->{{{name}}}); + {{/isEmail}} + {{#isFreeFormObject}} + OpenAPI_object_free({{{classname}}}->{{{name}}}); + {{/isFreeFormObject}} + {{/isEnum}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{^isEnum}} + {{#isString}} + ogs_free({{{classname}}}->{{{name}}}); + {{/isString}} + {{/isEnum}} + {{#isBinary}} + ogs_free({{{classname}}}->{{{name}}}->data); + {{/isBinary}} + {{#isDate}} + ogs_free({{{classname}}}->{{{name}}}); + {{/isDate}} + {{#isDateTime}} + ogs_free({{{classname}}}->{{{name}}}); + {{/isDateTime}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + {{#isPrimitiveType}} + {{^isEnum}} + OpenAPI_list_for_each({{classname}}->{{name}}, node) { + ogs_free(node->data); + } + {{/isEnum}} + OpenAPI_list_free({{classname}}->{{name}}); + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{^isEnum}} + OpenAPI_list_for_each({{classname}}->{{name}}, node) { + OpenAPI_{{complexType}}_free(node->data); + } + {{/isEnum}} + OpenAPI_list_free({{classname}}->{{name}}); + {{/isPrimitiveType}} + {{/isListContainer}} + {{#isMapContainer}} + OpenAPI_list_for_each({{classname}}->{{name}}, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_{{complexType}}_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free({{classname}}->{{name}}); + {{/isMapContainer}} + {{/isContainer}} +{{/vars}} + ogs_free({{classname}}); +} + +cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname}}) +{ + cJSON *item = NULL; + + if ({{classname}} == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + return NULL; + } + + item = cJSON_CreateObject(); +{{#vars}} + {{#required}} + if (!{{{classname}}}->{{{name}}}) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/required}} + {{^required}} + if ({{{classname}}}->{{{name}}}) { + {{/required}} + {{^isContainer}} + {{#isPrimitiveType}} + {{#isEnum}} + if (cJSON_AddStringToObject(item, "{{{baseName}}}", OpenAPI_{{{name}}}{{classname}}_ToString({{{classname}}}->{{{name}}})) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isEnum}} + {{^isEnum}} + {{#isNumeric}} + if (cJSON_AddNumberToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isNumeric}} + {{#isBoolean}} + if (cJSON_AddBoolToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isBoolean}} + {{#isString}} + if (cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isString}} + {{/isEnum}} + {{#isByteArray}} + if (cJSON_AddNumberToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isByteArray}} + {{#isBinary}} + char* encoded_str_{{{name}}} = OpenAPI_base64encode({{{classname}}}->{{{name}}}->data,{{{classname}}}->{{{name}}}->len); + if (cJSON_AddStringToObject(item, "{{{baseName}}}", encoded_str_{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + ogs_free(encoded_str_{{{name}}}); + {{/isBinary}} + {{#isDate}} + if (cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isDate}} + {{#isDateTime}} + if (cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isDateTime}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isEnum}} + if (cJSON_AddStringToObject(item, "{{{baseName}}}", OpenAPI_{{{complexType}}}_ToString({{{classname}}}->{{{name}}})) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isEnum}} + {{^isEnum}} + {{#isModel}} + cJSON *{{{name}}}_local_JSON = OpenAPI_{{complexType}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_convertToJSON({{{classname}}}->{{{name}}}); + if ({{{name}}}_local_JSON == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + cJSON_AddItemToObject(item, "{{{baseName}}}", {{{name}}}_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isModel}} + {{#isUuid}} + if (cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isUuid}} + {{#isEmail}} + if (cJSON_AddStringToObject(item, "{{{baseName}}}", {{{classname}}}->{{{name}}}) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isEmail}} + {{#isFreeFormObject}} + cJSON *{{{name}}}_object = OpenAPI_object_convertToJSON({{{classname}}}->{{{name}}}); + if ({{{name}}}_object == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + cJSON_AddItemToObject(item, "{{{baseName}}}", {{{name}}}_object); + if (item->child == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isFreeFormObject}} + {{/isEnum}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + {{#isPrimitiveType}} + {{^isEnum}} + cJSON *{{{name}}} = cJSON_AddArrayToObject(item, "{{{baseName}}}"); + if ({{{name}}} == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + + OpenAPI_lnode_t *{{{name}}}_node; + OpenAPI_list_for_each({{{classname}}}->{{{name}}}, {{{name}}}_node) { + {{#items}} + {{#isString}} + if (cJSON_AddStringToObject({{{name}}}, "", (char*){{{name}}}_node->data) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isString}} + {{#isBoolean}} + if (cJSON_AddBoolToObject({{{name}}}, "", *(cJSON_bool *){{{name}}}_node->data) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isBoolean}} + {{#isNumeric}} + if (cJSON_AddNumberToObject({{{name}}}, "", *(double *){{{name}}}_node->data) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isNumeric}} + {{/items}} + } + {{/isEnum}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{^isEnum}} + cJSON *{{{name}}}List = cJSON_AddArrayToObject(item, "{{{baseName}}}"); + if ({{{name}}}List == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + + OpenAPI_lnode_t *{{{name}}}_node; + if ({{{classname}}}->{{{name}}}) { + OpenAPI_list_for_each({{classname}}->{{{name}}}, {{{name}}}_node) { + cJSON *itemLocal = OpenAPI_{{complexType}}_convertToJSON({{#isEnum}}{{#items}}(OpenAPI_{{classVarName}}_{{name}}_e){{/items}}{{/isEnum}}{{{name}}}_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + cJSON_AddItemToArray({{{name}}}List, itemLocal); + } + } + {{/isEnum}} + {{#isEnum}} + cJSON *{{{name}}} = cJSON_AddArrayToObject(item, "{{{baseName}}}"); + if ({{{name}}} == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + OpenAPI_lnode_t *{{{name}}}_node; + OpenAPI_list_for_each({{classname}}->{{{name}}}, {{{name}}}_node) { + if (cJSON_AddStringToObject({{{name}}}, "", OpenAPI_{{{complexType}}}_ToString((OpenAPI_{{{complexType}}}_e){{{name}}}_node->data)) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + } + {{/isEnum}} + {{/isPrimitiveType}} + {{/isListContainer}} + {{#isMapContainer}} + cJSON *{{{name}}} = cJSON_AddObjectToObject(item, "{{{baseName}}}"); + if ({{{name}}} == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + cJSON *localMapObject = {{{name}}}; + OpenAPI_lnode_t *{{{name}}}_node; + if ({{{classname}}}->{{{name}}}) { + OpenAPI_list_for_each({{{classname}}}->{{{name}}}, {{{name}}}_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*){{{name}}}_node->data; + {{#isPrimitiveType}} + {{#isString}} + if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isString}} + {{#isNumeric}} + if (cJSON_AddNumberToObject(localMapObject, localKeyValue->key, *(double *)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isNumeric}} + {{#isBoolean}} + if (cJSON_AddBoolToObject(localMapObject, localKeyValue->key, *(cJSON_bool *)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + {{/isBoolean}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + cJSON *itemLocal = OpenAPI_{{complexType}}_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]"); + goto end; + } + cJSON_AddItemToObject({{{name}}}, localKeyValue->key, itemLocal); + {{/isPrimitiveType}} + } + } + {{/isMapContainer}} + {{/isContainer}} + {{^required}} + } + {{/required}} + +{{/vars}} +end: + return item; +} + +OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname}}JSON) +{ + OpenAPI_{{classname}}_t *{{classname}}_local_var = NULL; +{{#vars}} + cJSON *{{{name}}} = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{baseName}}}"); + {{#required}} + if (!{{{name}}}) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/required}} + + {{^isContainer}} + {{#isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{classVarName}}_{{name}}_e {{name}}Variable; + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{name}}Variable = OpenAPI_{{name}}{{classname}}_FromString({{{name}}}->valuestring); + {{/isEnum}} + {{^isEnum}} + {{#isNumeric}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsNumber({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isNumeric}} + {{#isBoolean}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsBool({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isBoolean}} + {{#isString}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isString}} + {{/isEnum}} + {{#isByteArray}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsNumber({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isByteArray}} + {{#isBinary}} + OpenAPI_binary_t* decoded_str_{{{name}}} = OpenAPI_malloc(sizeof(struct binary_t)); + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + decoded_str_{{{name}}}->data = OpenAPI_base64decode({{{name}}}->valuestring, strlen({{{name}}}->valuestring), &decoded_str_{{{name}}}->len); + if (!decoded_str_{{{name}}}->data) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isBinary}} + {{#isDate}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isDate}} + {{#isDateTime}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isDateTime}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{complexType}}_e {{name}}Variable; + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{name}}Variable = OpenAPI_{{complexType}}_FromString({{{name}}}->valuestring); + {{/isEnum}} + {{^isEnum}} + {{#isModel}} + {{^isFreeFormObject}}OpenAPI_{{complexType}}{{/isFreeFormObject}}{{#isFreeFormObject}}OpenAPI_object{{/isFreeFormObject}}_t *{{name}}_local_nonprim = NULL; + {{^required}}if ({{{name}}}) { {{/required}} + {{{name}}}_local_nonprim = OpenAPI_{{complexType}}{{#isFreeFormObject}}object{{/isFreeFormObject}}_parseFromJSON({{{name}}}); + {{/isModel}} + {{#isUuid}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isUuid}} + {{#isEmail}} + {{^required}}if ({{{name}}}) { {{/required}} + if (!cJSON_IsString({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{/isEmail}} + {{#isFreeFormObject}} + OpenAPI_object_t *{{name}}_local_object = NULL; + {{^required}}if ({{{name}}}) { {{/required}} + {{{name}}}_local_object = OpenAPI_object_parseFromJSON({{{name}}}); + {{/isFreeFormObject}} + {{/isEnum}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + {{#isPrimitiveType}} + {{^isEnum}} + OpenAPI_list_t *{{{name}}}List; + {{^required}}if ({{{name}}}) { {{/required}} + cJSON *{{{name}}}_local; + if (!cJSON_IsArray({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{{name}}}List = OpenAPI_list_create(); + + cJSON_ArrayForEach({{{name}}}_local, {{{name}}}) { + {{#items}} + {{#isString}} + if (!cJSON_IsString({{{name}}}_local)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + OpenAPI_list_add({{{name}}}List , ogs_strdup({{{name}}}_local->valuestring)); + {{/isString}} + {{#isNumeric}} + if (!cJSON_IsNumber({{{name}}}_local)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + OpenAPI_list_add({{{name}}}List , &{{{name}}}_local->valuedouble); + {{/isNumeric}} + {{#isBoolean}} + if (!cJSON_IsBool({{{name}}}_local)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + OpenAPI_list_add({{{name}}}List , {{{name}}}_local->valueint); + {{/isBoolean}} + {{/items}} + } + {{/isEnum}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{^isEnum}} + OpenAPI_list_t *{{{name}}}List; + {{^required}}if ({{{name}}}) { {{/required}} + cJSON *{{{name}}}_local_nonprimitive; + if (!cJSON_IsArray({{{name}}})){ + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + + {{{name}}}List = OpenAPI_list_create(); + + cJSON_ArrayForEach({{{name}}}_local_nonprimitive, {{{name}}} ) { + if (!cJSON_IsObject({{{name}}}_local_nonprimitive)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{#isEnum}}{{#items}}{{datatypeWithEnum}}_e {{/items}}{{/isEnum}}{{^isEnum}}OpenAPI_{{complexType}}_t *{{/isEnum}}{{{name}}}Item = OpenAPI_{{complexType}}_parseFromJSON({{{name}}}_local_nonprimitive); + + OpenAPI_list_add({{{name}}}List, {{#isEnum}}{{#items}}(void *){{/items}}{{/isEnum}}{{{name}}}Item); + } + {{/isEnum}} + {{#isEnum}} + OpenAPI_list_t *{{{name}}}List; + {{^required}}if ({{{name}}}) { {{/required}} + cJSON *{{{name}}}_local_nonprimitive; + if (!cJSON_IsArray({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + + {{{name}}}List = OpenAPI_list_create(); + + cJSON_ArrayForEach({{{name}}}_local_nonprimitive, {{{name}}} ) { + if (!cJSON_IsString({{{name}}}_local_nonprimitive)){ + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + + OpenAPI_list_add({{{name}}}List, (void *)OpenAPI_{{{complexType}}}_FromString({{{name}}}_local_nonprimitive->valuestring)); + } + {{/isEnum}} + {{/isPrimitiveType}} + {{/isListContainer}} + {{#isMapContainer}} + OpenAPI_list_t *{{{name}}}List; + {{^required}}if ({{{name}}}) { {{/required}} + cJSON *{{{name}}}_local_map; + if (!cJSON_IsObject({{{name}}})) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + {{{name}}}List = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach({{{name}}}_local_map, {{{name}}}) { + cJSON *localMapObject = {{{name}}}_local_map; + {{#isPrimitiveType}} + {{#isString}} + if (!cJSON_IsString(localMapObject)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string),ogs_strdup(localMapObject->valuestring)); + {{/isString}} + {{#isBoolean}} + if (!cJSON_IsBool(localMapObject)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), &localMapObject->valueint); + {{/isBoolean}} + {{#isNumeric}} + if (!cJSON_IsNumber(localMapObject)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string),&localMapObject->valuedouble ); + {{/isNumeric}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + if (!cJSON_IsObject({{{name}}}_local_map)) { + ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_{{complexType}}_parseFromJSON(localMapObject)); + {{/isPrimitiveType}} + OpenAPI_list_add({{{name}}}List , localMapKeyPair); + } + {{/isMapContainer}} + {{/isContainer}} + {{^required}} + } + {{/required}} + +{{/vars}} + {{classname}}_local_var = OpenAPI_{{classname}}_create ( +{{#vars}} + {{^isContainer}} + {{^isPrimitiveType}} + {{#isEnum}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}Variable{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{/isEnum}} + {{^isEnum}} + {{#isModel}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}_local_nonprim{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isModel}} + {{#isUuid}} + {{^required}}{{{name}}} ? {{/required}}ogs_strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isUuid}} + {{#isEmail}} + {{^required}}{{{name}}} ? {{/required}}ogs_strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isEmail}} + {{#isFreeFormObject}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}_local_object{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isFreeFormObject}} + {{/isEnum}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#isEnum}} + {{^required}}{{{name}}} ? {{/required}}{{name}}Variable{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{/isEnum}} + {{^isEnum}} + {{#isNumeric}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}->valuedouble{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{/isNumeric}} + {{#isBoolean}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}->valueint{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{/isBoolean}} + {{#isString}} + {{^required}}{{{name}}} ? {{/required}}ogs_strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isString}} + {{/isEnum}} + {{#isByteArray}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}->valueint{{^required}} : 0{{/required}}{{#hasMore}},{{/hasMore}} + {{/isByteArray}} + {{#isBinary}} + {{^required}}{{{name}}} ? {{/required}}decoded_str_{{{name}}}{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isBinary}} + {{#isDate}} + {{^required}}{{{name}}} ? {{/required}}ogs_strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isDate}} + {{#isDateTime}} + {{^required}}{{{name}}} ? {{/required}}ogs_strdup({{{name}}}->valuestring){{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isDateTime}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isListContainer}} + {{#isMapContainer}} + {{^required}}{{{name}}} ? {{/required}}{{{name}}}List{{^required}} : NULL{{/required}}{{#hasMore}},{{/hasMore}} + {{/isMapContainer}} + {{/isContainer}} +{{/vars}} + ); + + return {{classname}}_local_var; +end: + return NULL; +} +{{/isEnum}} +{{/model}}{{/models}} diff --git a/lib/sbi/openapi/.openapi-generator/templates/model-header.mustache b/lib/sbi/openapi/.openapi-generator/templates/model-header.mustache new file mode 100644 index 000000000..362fbdb09 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/model-header.mustache @@ -0,0 +1,181 @@ +{{#models}}{{#model}}/* + * {{classname}}.h + * + * {{description}} + */ + +#ifndef _OpenAPI_{{classname}}_H_ +#define _OpenAPI_{{classname}}_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +{{#imports}} +#include "{{{.}}}.h" +{{/imports}} + +#ifdef __cplusplus +extern "C" { +#endif + +{{#isEnum}} + {{#allowableValues}} + typedef enum { OpenAPI_{{classVarName}}_NULL = 0{{#enumVars}}, OpenAPI_{{classVarName}}_{{{value}}}{{/enumVars}} } OpenAPI_{{classVarName}}_e; + {{/allowableValues}} + + char* OpenAPI_{{classname}}_ToString(OpenAPI_{{classVarName}}_e {{classname}}); + + OpenAPI_{{classVarName}}_e OpenAPI_{{classname}}_FromString(char* {{classname}}); +{{/isEnum}} +{{^isEnum}} + typedef struct OpenAPI_{{classname}}_s OpenAPI_{{classname}}_t; +{{#vars}} + {{^isContainer}} + {{#isPrimitiveType}} + {{#isEnum}} + {{#allowableValues}} + typedef enum { OpenAPI_{{classVarName}}_{{enumName}}_NULL = 0{{#enumVars}}, OpenAPI_{{classVarName}}_{{enumName}}_{{{value}}}{{/enumVars}} } OpenAPI_{{classVarName}}_{{name}}_e; + {{/allowableValues}} + + char* OpenAPI_{{classVarName}}_{{name}}_ToString(OpenAPI_{{classVarName}}_{{name}}_e {{name}}); + + OpenAPI_{{classVarName}}_{{name}}_e OpenAPI_{{classVarName}}_{{name}}_FromString(char* {{name}}); + {{/isEnum}} + {{/isPrimitiveType}} + {{/isContainer}} +{{/vars}} + typedef struct OpenAPI_{{classname}}_s { +{{#vars}} + {{^isContainer}} + {{^isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{datatype}}_e {{name}}; + {{/isEnum}} + {{^isEnum}} + {{#isModel}} + struct OpenAPI_{{datatype}}_s *{{name}}; + {{/isModel}} + {{#isUuid}} + {{datatype}} *{{name}}; + {{/isUuid}} + {{#isEmail}} + {{datatype}} *{{name}}; + {{/isEmail}} + {{#isFreeFormObject}} + OpenAPI_{{datatype}}_t *{{name}}; + {{/isFreeFormObject}} + {{/isEnum}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{classVarName}}_{{name}}_e {{name}}; + {{/isEnum}} + {{^isEnum}} + {{#isNumeric}} + {{datatype}} {{name}}; + {{/isNumeric}} + {{#isBoolean}} + {{datatype}} {{name}}; + {{/isBoolean}} + {{#isString}} + {{datatype}} *{{name}}; + {{/isString}} + {{/isEnum}} + {{#isByteArray}} + {{datatype}} {{name}}; + {{/isByteArray}} + {{#isBinary}} + OpenAPI_{{datatype}} {{name}}; + {{/isBinary}} + {{#isDate}} + {{datatype}} *{{name}}; + {{/isDate}} + {{#isDateTime}} + {{datatype}} *{{name}}; + {{/isDateTime}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + OpenAPI_{{datatype}}_t *{{name}}; + {{/isListContainer}} + {{#isMapContainer}} + OpenAPI_{{datatype}} {{name}}; + {{/isMapContainer}} + {{/isContainer}} +{{/vars}} +} OpenAPI_{{classname}}_t; + +OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_create( +{{#vars}} + {{^isContainer}} + {{^isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{datatype}}_e {{name}}{{#hasMore}},{{/hasMore}} + {{/isEnum}} + {{^isEnum}} + {{#isModel}} + OpenAPI_{{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} + {{/isModel}} + {{#isUuid}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isUuid}} + {{#isEmail}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isEmail}} + {{#isFreeFormObject}} + OpenAPI_{{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} + {{/isFreeFormObject}} + {{/isEnum}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#isEnum}} + OpenAPI_{{classVarName}}_{{name}}_e {{name}}{{#hasMore}},{{/hasMore}} + {{/isEnum}} + {{^isEnum}} + {{#isNumeric}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isNumeric}} + {{#isBoolean}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isBoolean}} + {{#isString}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isString}} + {{/isEnum}} + {{#isByteArray}} + {{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isByteArray}} + {{#isBinary}} + OpenAPI_{{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isBinary}} + {{#isDate}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isDate}} + {{#isDateTime}} + {{datatype}} *{{name}}{{#hasMore}},{{/hasMore}} + {{/isDateTime}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} + OpenAPI_{{datatype}}_t *{{name}}{{#hasMore}},{{/hasMore}} + {{/isListContainer}} + {{#isMapContainer}} + OpenAPI_{{datatype}} {{name}}{{#hasMore}},{{/hasMore}} + {{/isMapContainer}} + {{/isContainer}} +{{/vars}}); +void OpenAPI_{{classname}}_free(OpenAPI_{{classname}}_t *{{classname}}); +OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname}}JSON); +cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname}}); +{{/isEnum}} + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_{{classname}}_H_ */ +{{/model}}{{/models}} diff --git a/lib/sbi/openapi/.openapi-generator/templates/object-body.mustache b/lib/sbi/openapi/.openapi-generator/templates/object-body.mustache new file mode 100644 index 000000000..cf94a1a8e --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/object-body.mustache @@ -0,0 +1,35 @@ +#include +#include +#include +#include "object.h" + +OpenAPI_object_t *OpenAPI_object_create(void) +{ + OpenAPI_object_t *object = ogs_malloc(sizeof(OpenAPI_object_t)); + + return object; +} + +void OpenAPI_object_free(OpenAPI_object_t *object) +{ + ogs_free (object); +} + +cJSON *OpenAPI_object_convertToJSON(OpenAPI_object_t *object) +{ + cJSON *item = cJSON_CreateObject(); + + return item; +fail: + cJSON_Delete(item); + return NULL; +} + +OpenAPI_object_t *OpenAPI_object_parseFromJSON(cJSON *objectJSON) +{ + OpenAPI_object_t *object = NULL; + + return object; +end: + return NULL; +} diff --git a/lib/sbi/openapi/.openapi-generator/templates/object-header.mustache b/lib/sbi/openapi/.openapi-generator/templates/object-header.mustache new file mode 100644 index 000000000..bc874ce50 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/templates/object-header.mustache @@ -0,0 +1,30 @@ +#ifndef OGS_SBI_OBJECT_H +#define OGS_SBI_OBJECT_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_object_s { + void *temporary; +} OpenAPI_object_t; + +OpenAPI_object_t *OpenAPI_object_create(void); + +void OpenAPI_object_free(OpenAPI_object_t *object); + +OpenAPI_object_t *OpenAPI_object_parseFromJSON(cJSON *objectJSON); + +cJSON *OpenAPI_object_convertToJSON(OpenAPI_object_t *object); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_OBJECT_H */ diff --git a/lib/sbi/openapi/.openapi-generator/uncrustify.cfg b/lib/sbi/openapi/.openapi-generator/uncrustify.cfg new file mode 100644 index 000000000..984d19ec0 --- /dev/null +++ b/lib/sbi/openapi/.openapi-generator/uncrustify.cfg @@ -0,0 +1,2132 @@ +# Uncrustify-0.66 + +# +# General options +# + +# The type of line endings. Default=Auto. +newlines = auto # auto/lf/crlf/cr + +# The original size of tabs in the input. Default=8. +input_tab_size = 8 # unsigned number + +# The size of tabs in the output (only used if align_with_tabs=true). Default=8. +output_tab_size = 8 # unsigned number + +# The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn). +string_escape_char = 92 # unsigned number + +# Alternate string escape char for Pawn. Only works right before the quote char. +string_escape_char2 = 0 # unsigned number + +# Replace tab characters found in string literals with the escape sequence \t instead. +string_replace_tab_chars = false # false/true + +# Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. +# If True, 'assert(x<0 && y>=3)' will be broken. Default=False +# Improvements to template detection may make this option obsolete. +tok_split_gte = false # false/true + +# Override the default ' *INDENT-OFF*' in comments for disabling processing of part of the file. +disable_processing_cmt = "" # string + +# Override the default ' *INDENT-ON*' in comments for enabling processing of part of the file. +enable_processing_cmt = "" # string + +# Enable parsing of digraphs. Default=False. +enable_digraphs = false # false/true + +# Control what to do with the UTF-8 BOM (recommend 'remove'). +utf8_bom = ignore # ignore/add/remove/force + +# If the file contains bytes with values between 128 and 255, but is not UTF-8, then output as UTF-8. +utf8_byte = false # false/true + +# Force the output encoding to UTF-8. +utf8_force = false # false/true + +# +# Spacing options +# + +# Add or remove space around arithmetic operator '+', '-', '/', '*', etc +# also '>>>' '<<' '>>' '%' '|'. +sp_arith = ignore # ignore/add/remove/force + +# Add or remove space around arithmetic operator '+' and '-'. Overrides sp_arith +sp_arith_additive = ignore # ignore/add/remove/force + +# Add or remove space around assignment operator '=', '+=', etc. +sp_assign = ignore # ignore/add/remove/force + +# Add or remove space around '=' in C++11 lambda capture specifications. Overrides sp_assign. +sp_cpp_lambda_assign = ignore # ignore/add/remove/force + +# Add or remove space after the capture specification in C++11 lambda. +sp_cpp_lambda_paren = ignore # ignore/add/remove/force + +# Add or remove space around assignment operator '=' in a prototype. +sp_assign_default = ignore # ignore/add/remove/force + +# Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. +sp_before_assign = ignore # ignore/add/remove/force + +# Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. +sp_after_assign = ignore # ignore/add/remove/force + +# Add or remove space in 'NS_ENUM ('. +sp_enum_paren = ignore # ignore/add/remove/force + +# Add or remove space around assignment '=' in enum. +sp_enum_assign = ignore # ignore/add/remove/force + +# Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_before_assign = ignore # ignore/add/remove/force + +# Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_after_assign = ignore # ignore/add/remove/force + +# Add or remove space around assignment ':' in enum. +sp_enum_colon = ignore # ignore/add/remove/force + +# Add or remove space around preprocessor '##' concatenation operator. Default=Add. +sp_pp_concat = add # ignore/add/remove/force + +# Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. +sp_pp_stringify = ignore # ignore/add/remove/force + +# Add or remove space before preprocessor '#' stringify operator as in '#define x(y) L#y'. +sp_before_pp_stringify = ignore # ignore/add/remove/force + +# Add or remove space around boolean operators '&&' and '||'. +sp_bool = ignore # ignore/add/remove/force + +# Add or remove space around compare operator '<', '>', '==', etc. +sp_compare = ignore # ignore/add/remove/force + +# Add or remove space inside '(' and ')'. +sp_inside_paren = ignore # ignore/add/remove/force + +# Add or remove space between nested parens: '((' vs ') )'. +sp_paren_paren = ignore # ignore/add/remove/force + +# Add or remove space between back-to-back parens: ')(' vs ') ('. +sp_cparen_oparen = ignore # ignore/add/remove/force + +# Whether to balance spaces inside nested parens. +sp_balance_nested_parens = false # false/true + +# Add or remove space between ')' and '{'. +sp_paren_brace = ignore # ignore/add/remove/force + +# Add or remove space before pointer star '*'. +sp_before_ptr_star = ignore # ignore/add/remove/force + +# Add or remove space before pointer star '*' that isn't followed by a variable name +# If set to 'ignore', sp_before_ptr_star is used instead. +sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force + +# Add or remove space between pointer stars '*'. +sp_between_ptr_star = ignore # ignore/add/remove/force + +# Add or remove space after pointer star '*', if followed by a word. +sp_after_ptr_star = ignore # ignore/add/remove/force + +# Add or remove space after pointer star '*', if followed by a qualifier. +sp_after_ptr_star_qualifier = ignore # ignore/add/remove/force + +# Add or remove space after a pointer star '*', if followed by a func proto/def. +sp_after_ptr_star_func = ignore # ignore/add/remove/force + +# Add or remove space after a pointer star '*', if followed by an open paren (function types). +sp_ptr_star_paren = ignore # ignore/add/remove/force + +# Add or remove space before a pointer star '*', if followed by a func proto/def. +sp_before_ptr_star_func = ignore # ignore/add/remove/force + +# Add or remove space before a reference sign '&'. +sp_before_byref = ignore # ignore/add/remove/force + +# Add or remove space before a reference sign '&' that isn't followed by a variable name. +# If set to 'ignore', sp_before_byref is used instead. +sp_before_unnamed_byref = ignore # ignore/add/remove/force + +# Add or remove space after reference sign '&', if followed by a word. +sp_after_byref = ignore # ignore/add/remove/force + +# Add or remove space after a reference sign '&', if followed by a func proto/def. +sp_after_byref_func = ignore # ignore/add/remove/force + +# Add or remove space before a reference sign '&', if followed by a func proto/def. +sp_before_byref_func = ignore # ignore/add/remove/force + +# Add or remove space between type and word. Default=Force. +sp_after_type = force # ignore/add/remove/force + +# Add or remove space before the paren in the D constructs 'template Foo(' and 'class Foo('. +sp_before_template_paren = ignore # ignore/add/remove/force + +# Add or remove space in 'template <' vs 'template<'. +# If set to ignore, sp_before_angle is used. +sp_template_angle = ignore # ignore/add/remove/force + +# Add or remove space before '<>'. +sp_before_angle = ignore # ignore/add/remove/force + +# Add or remove space inside '<' and '>'. +sp_inside_angle = ignore # ignore/add/remove/force + +# Add or remove space between '<>' and ':'. +sp_angle_colon = ignore # ignore/add/remove/force + +# Add or remove space after '<>'. +sp_after_angle = ignore # ignore/add/remove/force + +# Add or remove space between '<>' and '(' as found in 'new List(foo);'. +sp_angle_paren = ignore # ignore/add/remove/force + +# Add or remove space between '<>' and '()' as found in 'new List();'. +sp_angle_paren_empty = ignore # ignore/add/remove/force + +# Add or remove space between '<>' and a word as in 'List m;' or 'template static ...'. +sp_angle_word = ignore # ignore/add/remove/force + +# Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add. +sp_angle_shift = add # ignore/add/remove/force + +# Permit removal of the space between '>>' in 'foo >' (C++11 only). Default=False. +# sp_angle_shift cannot remove the space without this option. +sp_permit_cpp11_shift = false # false/true + +# Add or remove space before '(' of 'if', 'for', 'switch', 'while', etc. +sp_before_sparen = ignore # ignore/add/remove/force + +# Add or remove space inside if-condition '(' and ')'. +sp_inside_sparen = ignore # ignore/add/remove/force + +# Add or remove space before if-condition ')'. Overrides sp_inside_sparen. +sp_inside_sparen_close = ignore # ignore/add/remove/force + +# Add or remove space after if-condition '('. Overrides sp_inside_sparen. +sp_inside_sparen_open = ignore # ignore/add/remove/force + +# Add or remove space after ')' of 'if', 'for', 'switch', and 'while', etc. +sp_after_sparen = ignore # ignore/add/remove/force + +# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while', etc. +sp_sparen_brace = ignore # ignore/add/remove/force + +# Add or remove space between 'invariant' and '(' in the D language. +sp_invariant_paren = ignore # ignore/add/remove/force + +# Add or remove space after the ')' in 'invariant (C) c' in the D language. +sp_after_invariant_paren = ignore # ignore/add/remove/force + +# Add or remove space before empty statement ';' on 'if', 'for' and 'while'. +sp_special_semi = ignore # ignore/add/remove/force + +# Add or remove space before ';'. Default=Remove. +sp_before_semi = remove # ignore/add/remove/force + +# Add or remove space before ';' in non-empty 'for' statements. +sp_before_semi_for = ignore # ignore/add/remove/force + +# Add or remove space before a semicolon of an empty part of a for statement. +sp_before_semi_for_empty = ignore # ignore/add/remove/force + +# Add or remove space after ';', except when followed by a comment. Default=Add. +sp_after_semi = add # ignore/add/remove/force + +# Add or remove space after ';' in non-empty 'for' statements. Default=Force. +sp_after_semi_for = force # ignore/add/remove/force + +# Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). +sp_after_semi_for_empty = ignore # ignore/add/remove/force + +# Add or remove space before '[' (except '[]'). +sp_before_square = ignore # ignore/add/remove/force + +# Add or remove space before '[]'. +sp_before_squares = ignore # ignore/add/remove/force + +# Add or remove space inside a non-empty '[' and ']'. +sp_inside_square = ignore # ignore/add/remove/force + +# Add or remove space after ',', 'a,b' vs 'a, b'. +sp_after_comma = ignore # ignore/add/remove/force + +# Add or remove space before ','. Default=Remove. +sp_before_comma = remove # ignore/add/remove/force + +# Add or remove space between ',' and ']' in multidimensional array type 'int[,,]'. Only for C#. +sp_after_mdatype_commas = ignore # ignore/add/remove/force + +# Add or remove space between '[' and ',' in multidimensional array type 'int[,,]'. Only for C#. +sp_before_mdatype_commas = ignore # ignore/add/remove/force + +# Add or remove space between ',' in multidimensional array type 'int[,,]'. Only for C#. +sp_between_mdatype_commas = ignore # ignore/add/remove/force + +# Add or remove space between an open paren and comma: '(,' vs '( ,'. Default=Force. +sp_paren_comma = force # ignore/add/remove/force + +# Add or remove space before the variadic '...' when preceded by a non-punctuator. +sp_before_ellipsis = ignore # ignore/add/remove/force + +# Add or remove space after class ':'. +sp_after_class_colon = ignore # ignore/add/remove/force + +# Add or remove space before class ':'. +sp_before_class_colon = ignore # ignore/add/remove/force + +# Add or remove space after class constructor ':'. +sp_after_constr_colon = ignore # ignore/add/remove/force + +# Add or remove space before class constructor ':'. +sp_before_constr_colon = ignore # ignore/add/remove/force + +# Add or remove space before case ':'. Default=Remove. +sp_before_case_colon = remove # ignore/add/remove/force + +# Add or remove space between 'operator' and operator sign. +sp_after_operator = ignore # ignore/add/remove/force + +# Add or remove space between the operator symbol and the open paren, as in 'operator ++('. +sp_after_operator_sym = ignore # ignore/add/remove/force + +# Overrides sp_after_operator_sym when the operator has no arguments, as in 'operator *()'. +sp_after_operator_sym_empty = ignore # ignore/add/remove/force + +# Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'. +sp_after_cast = ignore # ignore/add/remove/force + +# Add or remove spaces inside cast parens. +sp_inside_paren_cast = ignore # ignore/add/remove/force + +# Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)'. +sp_cpp_cast_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'sizeof' and '('. +sp_sizeof_paren = ignore # ignore/add/remove/force + +# Add or remove space after the tag keyword (Pawn). +sp_after_tag = ignore # ignore/add/remove/force + +# Add or remove space inside enum '{' and '}'. +sp_inside_braces_enum = ignore # ignore/add/remove/force + +# Add or remove space inside struct/union '{' and '}'. +sp_inside_braces_struct = ignore # ignore/add/remove/force + +# Add or remove space after open brace in an unnamed temporary direct-list-initialization. +sp_after_type_brace_init_lst_open = ignore # ignore/add/remove/force + +# Add or remove space before close brace in an unnamed temporary direct-list-initialization. +sp_before_type_brace_init_lst_close = ignore # ignore/add/remove/force + +# Add or remove space inside an unnamed temporary direct-list-initialization. +sp_inside_type_brace_init_lst = ignore # ignore/add/remove/force + +# Add or remove space inside '{' and '}'. +sp_inside_braces = ignore # ignore/add/remove/force + +# Add or remove space inside '{}'. +sp_inside_braces_empty = ignore # ignore/add/remove/force + +# Add or remove space between return type and function name +# A minimum of 1 is forced except for pointer return types. +sp_type_func = ignore # ignore/add/remove/force + +# Add or remove space between type and open brace of an unnamed temporary direct-list-initialization. +sp_type_brace_init_lst = ignore # ignore/add/remove/force + +# Add or remove space between function name and '(' on function declaration. +sp_func_proto_paren = ignore # ignore/add/remove/force + +# Add or remove space between function name and '()' on function declaration without parameters. +sp_func_proto_paren_empty = ignore # ignore/add/remove/force + +# Add or remove space between function name and '(' on function definition. +sp_func_def_paren = ignore # ignore/add/remove/force + +# Add or remove space between function name and '()' on function definition without parameters. +sp_func_def_paren_empty = ignore # ignore/add/remove/force + +# Add or remove space inside empty function '()'. +sp_inside_fparens = ignore # ignore/add/remove/force + +# Add or remove space inside function '(' and ')'. +sp_inside_fparen = ignore # ignore/add/remove/force + +# Add or remove space inside the first parens in the function type: 'void (*x)(...)'. +sp_inside_tparen = ignore # ignore/add/remove/force + +# Add or remove between the parens in the function type: 'void (*x)(...)'. +sp_after_tparen_close = ignore # ignore/add/remove/force + +# Add or remove space between ']' and '(' when part of a function call. +sp_square_fparen = ignore # ignore/add/remove/force + +# Add or remove space between ')' and '{' of function. +sp_fparen_brace = ignore # ignore/add/remove/force + +# Java: Add or remove space between ')' and '{{' of double brace initializer. +sp_fparen_dbrace = ignore # ignore/add/remove/force + +# Add or remove space between function name and '(' on function calls. +sp_func_call_paren = ignore # ignore/add/remove/force + +# Add or remove space between function name and '()' on function calls without parameters. +# If set to 'ignore' (the default), sp_func_call_paren is used. +sp_func_call_paren_empty = ignore # ignore/add/remove/force + +# Add or remove space between the user function name and '(' on function calls +# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. +sp_func_call_user_paren = ignore # ignore/add/remove/force + +# Add or remove space between a constructor/destructor and the open paren. +sp_func_class_paren = ignore # ignore/add/remove/force + +# Add or remove space between a constructor without parameters or destructor and '()'. +sp_func_class_paren_empty = ignore # ignore/add/remove/force + +# Add or remove space between 'return' and '('. +sp_return_paren = ignore # ignore/add/remove/force + +# Add or remove space between '__attribute__' and '('. +sp_attribute_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'defined' and '(' in '#if defined (FOO)'. +sp_defined_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'throw' and '(' in 'throw (something)'. +sp_throw_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'throw' and anything other than '(' as in '@throw [...];'. +sp_after_throw = ignore # ignore/add/remove/force + +# Add or remove space between 'catch' and '(' in 'catch (something) { }' +# If set to ignore, sp_before_sparen is used. +sp_catch_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'version' and '(' in 'version (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_version_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language) +# If set to ignore, sp_before_sparen is used. +sp_scope_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'super' and '(' in 'super (something)'. Default=Remove. +sp_super_paren = remove # ignore/add/remove/force + +# Add or remove space between 'this' and '(' in 'this (something)'. Default=Remove. +sp_this_paren = remove # ignore/add/remove/force + +# Add or remove space between macro and value. +sp_macro = ignore # ignore/add/remove/force + +# Add or remove space between macro function ')' and value. +sp_macro_func = ignore # ignore/add/remove/force + +# Add or remove space between 'else' and '{' if on the same line. +sp_else_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'else' if on the same line. +sp_brace_else = ignore # ignore/add/remove/force + +# Add or remove space between '}' and the name of a typedef on the same line. +sp_brace_typedef = ignore # ignore/add/remove/force + +# Add or remove space between 'catch' and '{' if on the same line. +sp_catch_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'catch' if on the same line. +sp_brace_catch = ignore # ignore/add/remove/force + +# Add or remove space between 'finally' and '{' if on the same line. +sp_finally_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'finally' if on the same line. +sp_brace_finally = ignore # ignore/add/remove/force + +# Add or remove space between 'try' and '{' if on the same line. +sp_try_brace = ignore # ignore/add/remove/force + +# Add or remove space between get/set and '{' if on the same line. +sp_getset_brace = ignore # ignore/add/remove/force + +# Add or remove space between a variable and '{' for C++ uniform initialization. Default=Add. +sp_word_brace = add # ignore/add/remove/force + +# Add or remove space between a variable and '{' for a namespace. Default=Add. +sp_word_brace_ns = add # ignore/add/remove/force + +# Add or remove space before the '::' operator. +sp_before_dc = ignore # ignore/add/remove/force + +# Add or remove space after the '::' operator. +sp_after_dc = ignore # ignore/add/remove/force + +# Add or remove around the D named array initializer ':' operator. +sp_d_array_colon = ignore # ignore/add/remove/force + +# Add or remove space after the '!' (not) operator. Default=Remove. +sp_not = remove # ignore/add/remove/force + +# Add or remove space after the '~' (invert) operator. Default=Remove. +sp_inv = remove # ignore/add/remove/force + +# Add or remove space after the '&' (address-of) operator. Default=Remove +# This does not affect the spacing after a '&' that is part of a type. +sp_addr = remove # ignore/add/remove/force + +# Add or remove space around the '.' or '->' operators. Default=Remove. +sp_member = remove # ignore/add/remove/force + +# Add or remove space after the '*' (dereference) operator. Default=Remove +# This does not affect the spacing after a '*' that is part of a type. +sp_deref = remove # ignore/add/remove/force + +# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove. +sp_sign = remove # ignore/add/remove/force + +# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove. +sp_incdec = remove # ignore/add/remove/force + +# Add or remove space before a backslash-newline at the end of a line. Default=Add. +sp_before_nl_cont = add # ignore/add/remove/force + +# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'. +sp_after_oc_scope = ignore # ignore/add/remove/force + +# Add or remove space after the colon in message specs +# '-(int) f:(int) x;' vs '-(int) f: (int) x;'. +sp_after_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space before the colon in message specs +# '-(int) f: (int) x;' vs '-(int) f : (int) x;'. +sp_before_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space after the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};'. +sp_after_oc_dict_colon = ignore # ignore/add/remove/force + +# Add or remove space before the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};'. +sp_before_oc_dict_colon = ignore # ignore/add/remove/force + +# Add or remove space after the colon in message specs +# '[object setValue:1];' vs '[object setValue: 1];'. +sp_after_send_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space before the colon in message specs +# '[object setValue:1];' vs '[object setValue :1];'. +sp_before_send_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space after the (type) in message specs +# '-(int)f: (int) x;' vs '-(int)f: (int)x;'. +sp_after_oc_type = ignore # ignore/add/remove/force + +# Add or remove space after the first (type) in message specs +# '-(int) f:(int)x;' vs '-(int)f:(int)x;'. +sp_after_oc_return_type = ignore # ignore/add/remove/force + +# Add or remove space between '@selector' and '(' +# '@selector(msgName)' vs '@selector (msgName)' +# Also applies to @protocol() constructs. +sp_after_oc_at_sel = ignore # ignore/add/remove/force + +# Add or remove space between '@selector(x)' and the following word +# '@selector(foo) a:' vs '@selector(foo)a:'. +sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force + +# Add or remove space inside '@selector' parens +# '@selector(foo)' vs '@selector( foo )' +# Also applies to @protocol() constructs. +sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force + +# Add or remove space before a block pointer caret +# '^int (int arg){...}' vs. ' ^int (int arg){...}'. +sp_before_oc_block_caret = ignore # ignore/add/remove/force + +# Add or remove space after a block pointer caret +# '^int (int arg){...}' vs. '^ int (int arg){...}'. +sp_after_oc_block_caret = ignore # ignore/add/remove/force + +# Add or remove space between the receiver and selector in a message. +# '[receiver selector ...]'. +sp_after_oc_msg_receiver = ignore # ignore/add/remove/force + +# Add or remove space after @property. +sp_after_oc_property = ignore # ignore/add/remove/force + +# Add or remove space around the ':' in 'b ? t : f'. +sp_cond_colon = ignore # ignore/add/remove/force + +# Add or remove space before the ':' in 'b ? t : f'. Overrides sp_cond_colon. +sp_cond_colon_before = ignore # ignore/add/remove/force + +# Add or remove space after the ':' in 'b ? t : f'. Overrides sp_cond_colon. +sp_cond_colon_after = ignore # ignore/add/remove/force + +# Add or remove space around the '?' in 'b ? t : f'. +sp_cond_question = ignore # ignore/add/remove/force + +# Add or remove space before the '?' in 'b ? t : f'. Overrides sp_cond_question. +sp_cond_question_before = ignore # ignore/add/remove/force + +# Add or remove space after the '?' in 'b ? t : f'. Overrides sp_cond_question. +sp_cond_question_after = ignore # ignore/add/remove/force + +# In the abbreviated ternary form (a ?: b), add/remove space between ? and :.'. Overrides all other sp_cond_* options. +sp_cond_ternary_short = ignore # ignore/add/remove/force + +# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. +sp_case_label = ignore # ignore/add/remove/force + +# Control the space around the D '..' operator. +sp_range = ignore # ignore/add/remove/force + +# Control the spacing after ':' in 'for (TYPE VAR : EXPR)'. Only JAVA. +sp_after_for_colon = ignore # ignore/add/remove/force + +# Control the spacing before ':' in 'for (TYPE VAR : EXPR)'. Only JAVA. +sp_before_for_colon = ignore # ignore/add/remove/force + +# Control the spacing in 'extern (C)' (D). +sp_extern_paren = ignore # ignore/add/remove/force + +# Control the space after the opening of a C++ comment '// A' vs '//A'. +sp_cmt_cpp_start = ignore # ignore/add/remove/force + +# True: If space is added with sp_cmt_cpp_start, do it after doxygen sequences like '///', '///<', '//!' and '//!<'. +sp_cmt_cpp_doxygen = false # false/true + +# True: If space is added with sp_cmt_cpp_start, do it after Qt translator or meta-data comments like '//:', '//=', and '//~'. +sp_cmt_cpp_qttr = false # false/true + +# Controls the spaces between #else or #endif and a trailing comment. +sp_endif_cmt = ignore # ignore/add/remove/force + +# Controls the spaces after 'new', 'delete' and 'delete[]'. +sp_after_new = ignore # ignore/add/remove/force + +# Controls the spaces between new and '(' in 'new()'. +sp_between_new_paren = ignore # ignore/add/remove/force + +# Controls the spaces between ')' and 'type' in 'new(foo) BAR'. +sp_after_newop_paren = ignore # ignore/add/remove/force + +# Controls the spaces inside paren of the new operator: 'new(foo) BAR'. +sp_inside_newop_paren = ignore # ignore/add/remove/force + +# Controls the space after open paren of the new operator: 'new(foo) BAR'. +# Overrides sp_inside_newop_paren. +sp_inside_newop_paren_open = ignore # ignore/add/remove/force + +# Controls the space before close paren of the new operator: 'new(foo) BAR'. +# Overrides sp_inside_newop_paren. +sp_inside_newop_paren_close = ignore # ignore/add/remove/force + +# Controls the spaces before a trailing or embedded comment. +sp_before_tr_emb_cmt = ignore # ignore/add/remove/force + +# Number of spaces before a trailing or embedded comment. +sp_num_before_tr_emb_cmt = 0 # unsigned number + +# Control space between a Java annotation and the open paren. +sp_annotation_paren = ignore # ignore/add/remove/force + +# If True, vbrace tokens are dropped to the previous token and skipped. +sp_skip_vbrace_tokens = false # false/true + +# If True, a is inserted after #define. +force_tab_after_define = false # false/true + +# +# Indenting +# + +# The number of columns to indent per level. +# Usually 2, 3, 4, or 8. Default=8. +indent_columns = 4 # unsigned number + +# The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. +# For FreeBSD, this is set to 4. Negative value is absolute and not increased for each '(' level. +indent_continue = 0 # number + +# The continuation indent for func_*_param if they are true. +# If non-zero, this overrides the indent. +indent_param = 0 # unsigned number + +# How to use tabs when indenting code +# 0=spaces only +# 1=indent with tabs to brace level, align with spaces (default) +# 2=indent and align with tabs, using spaces when not on a tabstop +indent_with_tabs = 0 # unsigned number + +# Comments that are not a brace level are indented with tabs on a tabstop. +# Requires indent_with_tabs=2. If false, will use spaces. +indent_cmt_with_tabs = false # false/true + +# Whether to indent strings broken by '\' so that they line up. +indent_align_string = false # false/true + +# The number of spaces to indent multi-line XML strings. +# Requires indent_align_string=True. +indent_xml_string = 0 # unsigned number + +# Spaces to indent '{' from level. +indent_brace = 0 # unsigned number + +# Whether braces are indented to the body level. +indent_braces = false # false/true + +# Disabled indenting function braces if indent_braces is True. +indent_braces_no_func = false # false/true + +# Disabled indenting class braces if indent_braces is True. +indent_braces_no_class = false # false/true + +# Disabled indenting struct braces if indent_braces is True. +indent_braces_no_struct = false # false/true + +# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # false/true + +# Indent based on the paren open instead of the brace open in '({\n', default is to indent by brace. +indent_paren_open_brace = false # false/true + +# indent a C# delegate by another level, default is to not indent by another level. +indent_cs_delegate_brace = false # false/true + +# Whether the 'namespace' body is indented. +indent_namespace = false # false/true + +# Only indent one namespace and no sub-namespaces. +# Requires indent_namespace=True. +indent_namespace_single_indent = false # false/true + +# The number of spaces to indent a namespace block. +indent_namespace_level = 0 # unsigned number + +# If the body of the namespace is longer than this number, it won't be indented. +# Requires indent_namespace=True. Default=0 (no limit) +indent_namespace_limit = 0 # unsigned number + +# Whether the 'extern "C"' body is indented. +indent_extern = false # false/true + +# Whether the 'class' body is indented. +indent_class = false # false/true + +# Whether to indent the stuff after a leading base class colon. +indent_class_colon = false # false/true + +# Indent based on a class colon instead of the stuff after the colon. +# Requires indent_class_colon=True. Default=False. +indent_class_on_colon = false # false/true + +# Whether to indent the stuff after a leading class initializer colon. +indent_constr_colon = false # false/true + +# Virtual indent from the ':' for member initializers. Default=2. +indent_ctor_init_leading = 2 # unsigned number + +# Additional indent for constructor initializer list. +# Negative values decrease indent down to the first column. Default=0. +indent_ctor_init = 0 # number + +# False=treat 'else\nif' as 'else if' for indenting purposes +# True=indent the 'if' one level. +indent_else_if = false # false/true + +# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute. +indent_var_def_blk = 0 # number + +# Indent continued variable declarations instead of aligning. +indent_var_def_cont = false # false/true + +# Indent continued shift expressions ('<<' and '>>') instead of aligning. +# Turn align_left_shift off when enabling this. +indent_shift = false # false/true + +# True: force indentation of function definition to start in column 1 +# False: use the default behavior. +indent_func_def_force_col1 = false # false/true + +# True: indent continued function call parameters one indent level +# False: align parameters under the open paren. +indent_func_call_param = false # false/true + +# Same as indent_func_call_param, but for function defs. +indent_func_def_param = false # false/true + +# Same as indent_func_call_param, but for function protos. +indent_func_proto_param = false # false/true + +# Same as indent_func_call_param, but for class declarations. +indent_func_class_param = false # false/true + +# Same as indent_func_call_param, but for class variable constructors. +indent_func_ctor_var_param = false # false/true + +# Same as indent_func_call_param, but for templates. +indent_template_param = false # false/true + +# Double the indent for indent_func_xxx_param options. +# Use both values of the options indent_columns and indent_param. +indent_func_param_double = false # false/true + +# Indentation column for standalone 'const' function decl/proto qualifier. +indent_func_const = 0 # unsigned number + +# Indentation column for standalone 'throw' function decl/proto qualifier. +indent_func_throw = 0 # unsigned number + +# The number of spaces to indent a continued '->' or '.' +# Usually set to 0, 1, or indent_columns. +indent_member = 0 # unsigned number + +# Spaces to indent single line ('//') comments on lines before code. +indent_sing_line_comments = 0 # unsigned number + +# If set, will indent trailing single line ('//') comments relative +# to the code instead of trying to keep the same absolute column. +indent_relative_single_line_comments = false # false/true + +# Spaces to indent 'case' from 'switch' +# Usually 0 or indent_columns. +indent_switch_case = 0 # unsigned number + +# Whether to indent preproccesor statements inside of switch statements. +indent_switch_pp = true # false/true + +# Spaces to shift the 'case' line, without affecting any other lines +# Usually 0. +indent_case_shift = 0 # unsigned number + +# Spaces to indent '{' from 'case'. +# By default, the brace will appear under the 'c' in case. +# Usually set to 0 or indent_columns. +# negative value are OK. +indent_case_brace = 0 # number + +# Whether to indent comments found in first column. +indent_col1_comment = false # false/true + +# How to indent goto labels +# >0: absolute column where 1 is the leftmost column +# <=0: subtract from brace indent +# Default=1 +indent_label = 1 # number + +# Same as indent_label, but for access specifiers that are followed by a colon. Default=1 +indent_access_spec = 1 # number + +# Indent the code after an access specifier by one level. +# If set, this option forces 'indent_access_spec=0'. +indent_access_spec_body = false # false/true + +# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended). +indent_paren_nl = false # false/true + +# Controls the indent of a close paren after a newline. +# 0: Indent to body level +# 1: Align under the open paren +# 2: Indent to the brace level +indent_paren_close = 0 # unsigned number + +# Controls the indent of the open paren of a function definition, if on it's own line.If True, indents the open paren +indent_paren_after_func_def = false # false/true + +# Controls the indent of the open paren of a function declaration, if on it's own line.If True, indents the open paren +indent_paren_after_func_decl = false # false/true + +# Controls the indent of the open paren of a function call, if on it's own line.If True, indents the open paren +indent_paren_after_func_call = false # false/true + +# Controls the indent of a comma when inside a paren.If True, aligns under the open paren. +indent_comma_paren = false # false/true + +# Controls the indent of a BOOL operator when inside a paren.If True, aligns under the open paren. +indent_bool_paren = false # false/true + +# If 'indent_bool_paren' is True, controls the indent of the first expression. If True, aligns the first expression to the following ones. +indent_first_bool_expr = false # false/true + +# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended). +indent_square_nl = false # false/true + +# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies. +indent_preserve_sql = false # false/true + +# Align continued statements at the '='. Default=True +# If False or the '=' is followed by a newline, the next line is indent one tab. +indent_align_assign = true # false/true + +# Indent OC blocks at brace level instead of usual rules. +indent_oc_block = false # false/true + +# Indent OC blocks in a message relative to the parameter name. +# 0=use indent_oc_block rules, 1+=spaces to indent +indent_oc_block_msg = 0 # unsigned number + +# Minimum indent for subsequent parameters +indent_oc_msg_colon = 0 # unsigned number + +# If True, prioritize aligning with initial colon (and stripping spaces from lines, if necessary). +# Default=True. +indent_oc_msg_prioritize_first_colon = true # false/true + +# If indent_oc_block_msg and this option are on, blocks will be indented the way that Xcode does by default (from keyword if the parameter is on its own line; otherwise, from the previous indentation level). +indent_oc_block_msg_xcode_style = false # false/true + +# If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is relative to a msg keyword. +indent_oc_block_msg_from_keyword = false # false/true + +# If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is relative to a msg colon. +indent_oc_block_msg_from_colon = false # false/true + +# If indent_oc_block_msg and this option are on, blocks will be indented from where the block caret is. +indent_oc_block_msg_from_caret = false # false/true + +# If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is. +indent_oc_block_msg_from_brace = false # false/true + +# When identing after virtual brace open and newline add further spaces to reach this min. indent. +indent_min_vbrace_open = 0 # unsigned number + +# True: When identing after virtual brace open and newline add further spaces after regular indent to reach next tabstop. +indent_vbrace_open_on_tabstop = false # false/true + +# If True, a brace followed by another token (not a newline) will indent all contained lines to match the token.Default=True. +indent_token_after_brace = true # false/true + +# If True, cpp lambda body will be indentedDefault=False. +indent_cpp_lambda_body = false # false/true + +# indent (or not) an using block if no braces are used. Only for C#.Default=True. +indent_using_block = true # false/true + +# indent the continuation of ternary operator. +# 0: (Default) off +# 1: When the `if_false` is a continuation, indent it under `if_false` +# 2: When the `:` is a continuation, indent it under `?` +indent_ternary_operator = 0 # unsigned number + +# If true, ignore indent and align for asm blocks as they have their own indentation. +indent_ignore_asm_block = false # false/true + +# +# Newline adding and removing options +# + +# Whether to collapse empty blocks between '{' and '}'. +nl_collapse_empty_body = false # false/true + +# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'. +nl_assign_leave_one_liners = false # false/true + +# Don't split one-line braced statements inside a class xx { } body. +nl_class_leave_one_liners = false # false/true + +# Don't split one-line enums: 'enum foo { BAR = 15 };' +nl_enum_leave_one_liners = false # false/true + +# Don't split one-line get or set functions. +nl_getset_leave_one_liners = false # false/true + +# Don't split one-line function definitions - 'int foo() { return 0; }'. +nl_func_leave_one_liners = false # false/true + +# Don't split one-line C++11 lambdas - '[]() { return 0; }'. +nl_cpp_lambda_leave_one_liners = false # false/true + +# Don't split one-line if/else statements - 'if(a) b++;'. +nl_if_leave_one_liners = false # false/true + +# Don't split one-line while statements - 'while(a) b++;'. +nl_while_leave_one_liners = false # false/true + +# Don't split one-line OC messages. +nl_oc_msg_leave_one_liner = false # false/true + +# Add or remove newline between Objective-C block signature and '{'. +nl_oc_block_brace = ignore # ignore/add/remove/force + +# Add or remove newlines at the start of the file. +nl_start_of_file = ignore # ignore/add/remove/force + +# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force'. +nl_start_of_file_min = 0 # unsigned number + +# Add or remove newline at the end of the file. +nl_end_of_file = ignore # ignore/add/remove/force + +# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force'). +nl_end_of_file_min = 0 # unsigned number + +# Add or remove newline between '=' and '{'. +nl_assign_brace = ignore # ignore/add/remove/force + +# Add or remove newline between '=' and '[' (D only). +nl_assign_square = ignore # ignore/add/remove/force + +# Add or remove newline after '= [' (D only). Will also affect the newline before the ']'. +nl_after_square_assign = ignore # ignore/add/remove/force + +# The number of blank lines after a block of variable definitions at the top of a function body +# 0 = No change (default). +nl_func_var_def_blk = 0 # unsigned number + +# The number of newlines before a block of typedefs +# 0 = No change (default) +# is overridden by the option 'nl_after_access_spec'. +nl_typedef_blk_start = 0 # unsigned number + +# The number of newlines after a block of typedefs +# 0 = No change (default). +nl_typedef_blk_end = 0 # unsigned number + +# The maximum consecutive newlines within a block of typedefs +# 0 = No change (default). +nl_typedef_blk_in = 0 # unsigned number + +# The number of newlines before a block of variable definitions not at the top of a function body +# 0 = No change (default) +# is overridden by the option 'nl_after_access_spec'. +nl_var_def_blk_start = 0 # unsigned number + +# The number of newlines after a block of variable definitions not at the top of a function body +# 0 = No change (default). +nl_var_def_blk_end = 0 # unsigned number + +# The maximum consecutive newlines within a block of variable definitions +# 0 = No change (default). +nl_var_def_blk_in = 0 # unsigned number + +# Add or remove newline between a function call's ')' and '{', as in: +# list_for_each(item, &list) { }. +nl_fcall_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'enum' and '{'. +nl_enum_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'enum' and 'class'. +nl_enum_class = ignore # ignore/add/remove/force + +# Add or remove newline between 'enum class' and the identifier. +nl_enum_class_identifier = ignore # ignore/add/remove/force + +# Add or remove newline between 'enum class' type and ':'. +nl_enum_identifier_colon = ignore # ignore/add/remove/force + +# Add or remove newline between 'enum class identifier :' and 'type' and/or 'type'. +nl_enum_colon_type = ignore # ignore/add/remove/force + +# Add or remove newline between 'struct and '{'. +nl_struct_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'union' and '{'. +nl_union_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'if' and '{'. +nl_if_brace = ignore # ignore/add/remove/force + +# Add or remove newline between '}' and 'else'. +nl_brace_else = ignore # ignore/add/remove/force + +# Add or remove newline between 'else if' and '{' +# If set to ignore, nl_if_brace is used instead. +nl_elseif_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'else' and '{'. +nl_else_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'else' and 'if'. +nl_else_if = ignore # ignore/add/remove/force + +# Add or remove newline before 'if'/'else if' closing parenthesis. +nl_before_if_closing_paren = ignore # ignore/add/remove/force + +# Add or remove newline between '}' and 'finally'. +nl_brace_finally = ignore # ignore/add/remove/force + +# Add or remove newline between 'finally' and '{'. +nl_finally_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'try' and '{'. +nl_try_brace = ignore # ignore/add/remove/force + +# Add or remove newline between get/set and '{'. +nl_getset_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'for' and '{'. +nl_for_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'catch' and '{'. +nl_catch_brace = ignore # ignore/add/remove/force + +# Add or remove newline between '}' and 'catch'. +nl_brace_catch = ignore # ignore/add/remove/force + +# Add or remove newline between '}' and ']'. +nl_brace_square = ignore # ignore/add/remove/force + +# Add or remove newline between '}' and ')' in a function invocation. +nl_brace_fparen = ignore # ignore/add/remove/force + +# Add or remove newline between 'while' and '{'. +nl_while_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'scope (x)' and '{' (D). +nl_scope_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'unittest' and '{' (D). +nl_unittest_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'version (x)' and '{' (D). +nl_version_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'using' and '{'. +nl_using_brace = ignore # ignore/add/remove/force + +# Add or remove newline between two open or close braces. +# Due to general newline/brace handling, REMOVE may not work. +nl_brace_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'do' and '{'. +nl_do_brace = ignore # ignore/add/remove/force + +# Add or remove newline between '}' and 'while' of 'do' statement. +nl_brace_while = ignore # ignore/add/remove/force + +# Add or remove newline between 'switch' and '{'. +nl_switch_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'synchronized' and '{'. +nl_synchronized_brace = ignore # ignore/add/remove/force + +# Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. +# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch and nl_catch_brace. +nl_multi_line_cond = false # false/true + +# Force a newline in a define after the macro name for multi-line defines. +nl_multi_line_define = false # false/true + +# Whether to put a newline before 'case' statement, not after the first 'case'. +nl_before_case = false # false/true + +# Add or remove newline between ')' and 'throw'. +nl_before_throw = ignore # ignore/add/remove/force + +# Whether to put a newline after 'case' statement. +nl_after_case = false # false/true + +# Add or remove a newline between a case ':' and '{'. Overrides nl_after_case. +nl_case_colon_brace = ignore # ignore/add/remove/force + +# Newline between namespace and {. +nl_namespace_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'template<>' and whatever follows. +nl_template_class = ignore # ignore/add/remove/force + +# Add or remove newline between 'class' and '{'. +nl_class_brace = ignore # ignore/add/remove/force + +# Add or remove newline before/after each ',' in the base class list, +# (tied to pos_class_comma). +nl_class_init_args = ignore # ignore/add/remove/force + +# Add or remove newline after each ',' in the constructor member initialization. +# Related to nl_constr_colon, pos_constr_colon and pos_constr_comma. +nl_constr_init_args = ignore # ignore/add/remove/force + +# Add or remove newline before first element, after comma, and after last element in enum. +nl_enum_own_lines = ignore # ignore/add/remove/force + +# Add or remove newline between return type and function name in a function definition. +nl_func_type_name = ignore # ignore/add/remove/force + +# Add or remove newline between return type and function name inside a class {} +# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. +nl_func_type_name_class = ignore # ignore/add/remove/force + +# Add or remove newline between class specification and '::' in 'void A::f() { }' +# Only appears in separate member implementation (does not appear with in-line implmementation). +nl_func_class_scope = ignore # ignore/add/remove/force + +# Add or remove newline between function scope and name +# Controls the newline after '::' in 'void A::f() { }'. +nl_func_scope_name = ignore # ignore/add/remove/force + +# Add or remove newline between return type and function name in a prototype. +nl_func_proto_type_name = ignore # ignore/add/remove/force + +# Add or remove newline between a function name and the opening '(' in the declaration. +nl_func_paren = ignore # ignore/add/remove/force + +# Overrides nl_func_paren for functions with no parameters. +nl_func_paren_empty = ignore # ignore/add/remove/force + +# Add or remove newline between a function name and the opening '(' in the definition. +nl_func_def_paren = ignore # ignore/add/remove/force + +# Overrides nl_func_def_paren for functions with no parameters. +nl_func_def_paren_empty = ignore # ignore/add/remove/force + +# Add or remove newline between a function name and the opening '(' in the call +nl_func_call_paren = ignore # ignore/add/remove/force + +# Overrides nl_func_call_paren for functions with no parameters. +nl_func_call_paren_empty = ignore # ignore/add/remove/force + +# Add or remove newline after '(' in a function declaration. +nl_func_decl_start = ignore # ignore/add/remove/force + +# Add or remove newline after '(' in a function definition. +nl_func_def_start = ignore # ignore/add/remove/force + +# Overrides nl_func_decl_start when there is only one parameter. +nl_func_decl_start_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_start when there is only one parameter. +nl_func_def_start_single = ignore # ignore/add/remove/force + +# Whether to add newline after '(' in a function declaration if '(' and ')' are in different lines. +nl_func_decl_start_multi_line = false # false/true + +# Whether to add newline after '(' in a function definition if '(' and ')' are in different lines. +nl_func_def_start_multi_line = false # false/true + +# Add or remove newline after each ',' in a function declaration. +nl_func_decl_args = ignore # ignore/add/remove/force + +# Add or remove newline after each ',' in a function definition. +nl_func_def_args = ignore # ignore/add/remove/force + +# Whether to add newline after each ',' in a function declaration if '(' and ')' are in different lines. +nl_func_decl_args_multi_line = false # false/true + +# Whether to add newline after each ',' in a function definition if '(' and ')' are in different lines. +nl_func_def_args_multi_line = false # false/true + +# Add or remove newline before the ')' in a function declaration. +nl_func_decl_end = ignore # ignore/add/remove/force + +# Add or remove newline before the ')' in a function definition. +nl_func_def_end = ignore # ignore/add/remove/force + +# Overrides nl_func_decl_end when there is only one parameter. +nl_func_decl_end_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_end when there is only one parameter. +nl_func_def_end_single = ignore # ignore/add/remove/force + +# Whether to add newline before ')' in a function declaration if '(' and ')' are in different lines. +nl_func_decl_end_multi_line = false # false/true + +# Whether to add newline before ')' in a function definition if '(' and ')' are in different lines. +nl_func_def_end_multi_line = false # false/true + +# Add or remove newline between '()' in a function declaration. +nl_func_decl_empty = ignore # ignore/add/remove/force + +# Add or remove newline between '()' in a function definition. +nl_func_def_empty = ignore # ignore/add/remove/force + +# Add or remove newline between '()' in a function call. +nl_func_call_empty = ignore # ignore/add/remove/force + +# Whether to add newline after '(' in a function call if '(' and ')' are in different lines. +nl_func_call_start_multi_line = false # false/true + +# Whether to add newline after each ',' in a function call if '(' and ')' are in different lines. +nl_func_call_args_multi_line = false # false/true + +# Whether to add newline before ')' in a function call if '(' and ')' are in different lines. +nl_func_call_end_multi_line = false # false/true + +# Whether to put each OC message parameter on a separate line +# See nl_oc_msg_leave_one_liner. +nl_oc_msg_args = false # false/true + +# Add or remove newline between function signature and '{'. +nl_fdef_brace = ignore # ignore/add/remove/force + +# Add or remove newline between C++11 lambda signature and '{'. +nl_cpp_ldef_brace = ignore # ignore/add/remove/force + +# Add or remove a newline between the return keyword and return expression. +nl_return_expr = ignore # ignore/add/remove/force + +# Whether to put a newline after semicolons, except in 'for' statements. +nl_after_semicolon = false # false/true + +# Java: Control the newline between the ')' and '{{' of the double brace initializer. +nl_paren_dbrace_open = ignore # ignore/add/remove/force + +# Whether to put a newline after the type in an unnamed temporary direct-list-initialization. +nl_type_brace_init_lst = ignore # ignore/add/remove/force + +# Whether to put a newline after open brace in an unnamed temporary direct-list-initialization. +nl_type_brace_init_lst_open = ignore # ignore/add/remove/force + +# Whether to put a newline before close brace in an unnamed temporary direct-list-initialization. +nl_type_brace_init_lst_close = ignore # ignore/add/remove/force + +# Whether to put a newline after brace open. +# This also adds a newline before the matching brace close. +nl_after_brace_open = false # false/true + +# If nl_after_brace_open and nl_after_brace_open_cmt are True, a newline is +# placed between the open brace and a trailing single-line comment. +nl_after_brace_open_cmt = false # false/true + +# Whether to put a newline after a virtual brace open with a non-empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open = false # false/true + +# Whether to put a newline after a virtual brace open with an empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open_empty = false # false/true + +# Whether to put a newline after a brace close. +# Does not apply if followed by a necessary ';'. +nl_after_brace_close = false # false/true + +# Whether to put a newline after a virtual brace close. +# Would add a newline before return in: 'if (foo) a++; return;'. +nl_after_vbrace_close = false # false/true + +# Control the newline between the close brace and 'b' in: 'struct { int a; } b;' +# Affects enums, unions and structures. If set to ignore, uses nl_after_brace_close. +nl_brace_struct_var = ignore # ignore/add/remove/force + +# Whether to alter newlines in '#define' macros. +nl_define_macro = false # false/true + +# Whether to remove blanks after '#ifxx' and '#elxx', or before '#elxx' and '#endif'. Does not affect top-level #ifdefs. +nl_squeeze_ifdef = false # false/true + +# Makes the nl_squeeze_ifdef option affect the top-level #ifdefs as well. +nl_squeeze_ifdef_top_level = false # false/true + +# Add or remove blank line before 'if'. +nl_before_if = ignore # ignore/add/remove/force + +# Add or remove blank line after 'if' statement. +# Add/Force work only if the next token is not a closing brace. +nl_after_if = ignore # ignore/add/remove/force + +# Add or remove blank line before 'for'. +nl_before_for = ignore # ignore/add/remove/force + +# Add or remove blank line after 'for' statement. +nl_after_for = ignore # ignore/add/remove/force + +# Add or remove blank line before 'while'. +nl_before_while = ignore # ignore/add/remove/force + +# Add or remove blank line after 'while' statement. +nl_after_while = ignore # ignore/add/remove/force + +# Add or remove blank line before 'switch'. +nl_before_switch = ignore # ignore/add/remove/force + +# Add or remove blank line after 'switch' statement. +nl_after_switch = ignore # ignore/add/remove/force + +# Add or remove blank line before 'synchronized'. +nl_before_synchronized = ignore # ignore/add/remove/force + +# Add or remove blank line after 'synchronized' statement. +nl_after_synchronized = ignore # ignore/add/remove/force + +# Add or remove blank line before 'do'. +nl_before_do = ignore # ignore/add/remove/force + +# Add or remove blank line after 'do/while' statement. +nl_after_do = ignore # ignore/add/remove/force + +# Whether to double-space commented-entries in struct/union/enum. +nl_ds_struct_enum_cmt = false # false/true + +# force nl before } of a struct/union/enum +# (lower priority than 'eat_blanks_before_close_brace'). +nl_ds_struct_enum_close_brace = false # false/true + +# Add or remove blank line before 'func_class_def'. +nl_before_func_class_def = 0 # unsigned number + +# Add or remove blank line before 'func_class_proto'. +nl_before_func_class_proto = 0 # unsigned number + +# Add or remove a newline before/after a class colon, +# (tied to pos_class_colon). +nl_class_colon = ignore # ignore/add/remove/force + +# Add or remove a newline around a class constructor colon. +# Related to nl_constr_init_args, pos_constr_colon and pos_constr_comma. +nl_constr_colon = ignore # ignore/add/remove/force + +# Change simple unbraced if statements into a one-liner +# 'if(b)\n i++;' => 'if(b) i++;'. +nl_create_if_one_liner = false # false/true + +# Change simple unbraced for statements into a one-liner +# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);'. +nl_create_for_one_liner = false # false/true + +# Change simple unbraced while statements into a one-liner +# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);'. +nl_create_while_one_liner = false # false/true + +# Change a one-liner if statement into simple unbraced if +# 'if(b) i++;' => 'if(b)\n i++;'. +nl_split_if_one_liner = false # false/true + +# Change a one-liner for statement into simple unbraced for +# 'for (i=0;<5;i++) foo(i);' => 'for (i=0;<5;i++)\n foo(i);'. +nl_split_for_one_liner = false # false/true + +# Change a one-liner while statement into simple unbraced while +# 'while (i<5) foo(i++);' => 'while (i<5)\n foo(i++);'. +nl_split_while_one_liner = false # false/true + +# +# Blank line options +# + +# The maximum consecutive newlines (3 = 2 blank lines). +nl_max = 0 # unsigned number + +# The maximum consecutive newlines in function. +nl_max_blank_in_func = 0 # unsigned number + +# The number of newlines after a function prototype, if followed by another function prototype. +nl_after_func_proto = 0 # unsigned number + +# The number of newlines after a function prototype, if not followed by another function prototype. +nl_after_func_proto_group = 0 # unsigned number + +# The number of newlines after a function class prototype, if followed by another function class prototype. +nl_after_func_class_proto = 0 # unsigned number + +# The number of newlines after a function class prototype, if not followed by another function class prototype. +nl_after_func_class_proto_group = 0 # unsigned number + +# The number of newlines before a multi-line function def body. +nl_before_func_body_def = 0 # unsigned number + +# The number of newlines before a multi-line function prototype body. +nl_before_func_body_proto = 0 # unsigned number + +# The number of newlines after '}' of a multi-line function body. +nl_after_func_body = 0 # unsigned number + +# The number of newlines after '}' of a multi-line function body in a class declaration. +nl_after_func_body_class = 0 # unsigned number + +# The number of newlines after '}' of a single line function body. +nl_after_func_body_one_liner = 0 # unsigned number + +# The minimum number of newlines before a multi-line comment. +# Doesn't apply if after a brace open or another multi-line comment. +nl_before_block_comment = 0 # unsigned number + +# The minimum number of newlines before a single-line C comment. +# Doesn't apply if after a brace open or other single-line C comments. +nl_before_c_comment = 0 # unsigned number + +# The minimum number of newlines before a CPP comment. +# Doesn't apply if after a brace open or other CPP comments. +nl_before_cpp_comment = 0 # unsigned number + +# Whether to force a newline after a multi-line comment. +nl_after_multiline_comment = false # false/true + +# Whether to force a newline after a label's colon. +nl_after_label_colon = false # false/true + +# The number of newlines after '}' or ';' of a struct/enum/union definition. +nl_after_struct = 0 # unsigned number + +# The number of newlines before a class definition. +nl_before_class = 0 # unsigned number + +# The number of newlines after '}' or ';' of a class definition. +nl_after_class = 0 # unsigned number + +# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# Will not change the newline count if after a brace open. +# 0 = No change. +nl_before_access_spec = 0 # unsigned number + +# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:' or 'slots:' label. +# 0 = No change. +# Overrides 'nl_typedef_blk_start' and 'nl_var_def_blk_start'. +nl_after_access_spec = 0 # unsigned number + +# The number of newlines between a function def and the function comment. +# 0 = No change. +nl_comment_func_def = 0 # unsigned number + +# The number of newlines after a try-catch-finally block that isn't followed by a brace close. +# 0 = No change. +nl_after_try_catch_finally = 0 # unsigned number + +# The number of newlines before and after a property, indexer or event decl. +# 0 = No change. +nl_around_cs_property = 0 # unsigned number + +# The number of newlines between the get/set/add/remove handlers in C#. +# 0 = No change. +nl_between_get_set = 0 # unsigned number + +# Add or remove newline between C# property and the '{'. +nl_property_brace = ignore # ignore/add/remove/force + +# Whether to remove blank lines after '{'. +eat_blanks_after_open_brace = false # false/true + +# Whether to remove blank lines before '}'. +eat_blanks_before_close_brace = false # false/true + +# How aggressively to remove extra newlines not in preproc. +# 0: No change +# 1: Remove most newlines not handled by other config +# 2: Remove all newlines and reformat completely by config +nl_remove_extra_newlines = 0 # unsigned number + +# Whether to put a blank line before 'return' statements, unless after an open brace. +nl_before_return = false # false/true + +# Whether to put a blank line after 'return' statements, unless followed by a close brace. +nl_after_return = false # false/true + +# Whether to put a newline after a Java annotation statement. +# Only affects annotations that are after a newline. +nl_after_annotation = ignore # ignore/add/remove/force + +# Controls the newline between two annotations. +nl_between_annotation = ignore # ignore/add/remove/force + +# +# Positioning options +# + +# The position of arithmetic operators in wrapped expressions. +pos_arith = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of assignment in wrapped expressions. +# Do not affect '=' followed by '{'. +pos_assign = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of boolean operators in wrapped expressions. +pos_bool = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of comparison operators in wrapped expressions. +pos_compare = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of conditional (b ? t : f) operators in wrapped expressions. +pos_conditional = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in wrapped expressions. +pos_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in enum entries. +pos_enum_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in the base class list if there are more than one line, +# (tied to nl_class_init_args). +pos_class_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in the constructor initialization list. +# Related to nl_constr_colon, nl_constr_init_args and pos_constr_colon. +pos_constr_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of trailing/leading class colon, between class and base class list +# (tied to nl_class_colon). +pos_class_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of colons between constructor and member initialization, +# (tied to nl_constr_colon). +# Related to nl_constr_colon, nl_constr_init_args and pos_constr_comma. +pos_constr_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force + +# +# Line Splitting options +# + +# Try to limit code width to N number of columns +code_width = 0 # unsigned number + +# Whether to fully split long 'for' statements at semi-colons. +ls_for_split_full = false # false/true + +# Whether to fully split long function protos/calls at commas. +ls_func_split_full = false # false/true + +# Whether to split lines as close to code_width as possible and ignore some groupings. +ls_code_width = false # false/true + +# +# Code alignment (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs. +align_keep_tabs = false # false/true + +# Whether to use tabs for aligning. +align_with_tabs = false # false/true + +# Whether to bump out to the next tab when aligning. +align_on_tabstop = false # false/true + +# Whether to right-align numbers. +align_number_right = false # false/true + +# Whether to keep whitespace not required for alignment. +align_keep_extra_space = false # false/true + +# Align variable definitions in prototypes and functions. +align_func_params = false # false/true + +# The span for aligning parameter definitions in function on parameter name (0=don't align). +align_func_params_span = 0 # unsigned number + +# The threshold for aligning function parameter definitions (0=no limit). +align_func_params_thresh = 0 # unsigned number + +# The gap for aligning function parameter definitions. +align_func_params_gap = 0 # unsigned number + +# Align parameters in single-line functions that have the same name. +# The function names must already be aligned with each other. +align_same_func_call_params = false # false/true + +# The span for aligning variable definitions (0=don't align) +align_var_def_span = 0 # unsigned number + +# How to align the star in variable definitions. +# 0=Part of the type 'void * foo;' +# 1=Part of the variable 'void *foo;' +# 2=Dangling 'void *foo;' +align_var_def_star_style = 0 # unsigned number + +# How to align the '&' in variable definitions. +# 0=Part of the type +# 1=Part of the variable +# 2=Dangling +align_var_def_amp_style = 0 # unsigned number + +# The threshold for aligning variable definitions (0=no limit) +align_var_def_thresh = 0 # unsigned number + +# The gap for aligning variable definitions. +align_var_def_gap = 0 # unsigned number + +# Whether to align the colon in struct bit fields. +align_var_def_colon = false # false/true + +# align variable defs gap for bit colons. +align_var_def_colon_gap = 0 # unsigned number + +# Whether to align any attribute after the variable name. +align_var_def_attribute = false # false/true + +# Whether to align inline struct/enum/union variable definitions. +align_var_def_inline = false # false/true + +# The span for aligning on '=' in assignments (0=don't align) +align_assign_span = 0 # unsigned number + +# The threshold for aligning on '=' in assignments (0=no limit) +align_assign_thresh = 0 # unsigned number + +# The span for aligning on '=' in enums (0=don't align) +align_enum_equ_span = 0 # unsigned number + +# The threshold for aligning on '=' in enums (0=no limit) +align_enum_equ_thresh = 0 # unsigned number + +# The span for aligning class (0=don't align) +align_var_class_span = 0 # unsigned number + +# The threshold for aligning class member definitions (0=no limit). +align_var_class_thresh = 0 # unsigned number + +# The gap for aligning class member definitions. +align_var_class_gap = 0 # unsigned number + +# The span for aligning struct/union (0=don't align) +align_var_struct_span = 0 # unsigned number + +# The threshold for aligning struct/union member definitions (0=no limit) +align_var_struct_thresh = 0 # unsigned number + +# The gap for aligning struct/union member definitions. +align_var_struct_gap = 0 # unsigned number + +# The span for aligning struct initializer values (0=don't align) +align_struct_init_span = 0 # unsigned number + +# The minimum space between the type and the synonym of a typedef. +align_typedef_gap = 0 # unsigned number + +# The span for aligning single-line typedefs (0=don't align). +align_typedef_span = 0 # unsigned number + +# How to align typedef'd functions with other typedefs +# 0: Don't mix them at all +# 1: align the open paren with the types +# 2: align the function type name with the other type names +align_typedef_func = 0 # unsigned number + +# Controls the positioning of the '*' in typedefs. Just try it. +# 0: Align on typedef type, ignore '*' +# 1: The '*' is part of type name: typedef int *pint; +# 2: The '*' is part of the type, but dangling: typedef int *pint; +align_typedef_star_style = 0 # unsigned number + +# Controls the positioning of the '&' in typedefs. Just try it. +# 0: Align on typedef type, ignore '&' +# 1: The '&' is part of type name: typedef int &pint; +# 2: The '&' is part of the type, but dangling: typedef int &pint; +align_typedef_amp_style = 0 # unsigned number + +# The span for aligning comments that end lines (0=don't align) +align_right_cmt_span = 0 # unsigned number + +# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment. +align_right_cmt_mix = false # false/true + +# If a trailing comment is more than this number of columns away from the text it follows, +# it will qualify for being aligned. This has to be > 0 to do anything. +align_right_cmt_gap = 0 # unsigned number + +# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) +align_right_cmt_at_col = 0 # unsigned number + +# The span for aligning function prototypes (0=don't align). +align_func_proto_span = 0 # unsigned number + +# Minimum gap between the return type and the function name. +align_func_proto_gap = 0 # unsigned number + +# Align function protos on the 'operator' keyword instead of what follows. +align_on_operator = false # false/true + +# Whether to mix aligning prototype and variable declarations. +# If True, align_var_def_XXX options are used instead of align_func_proto_XXX options. +align_mix_var_proto = false # false/true + +# Align single-line functions with function prototypes, uses align_func_proto_span. +align_single_line_func = false # false/true + +# Aligning the open brace of single-line functions. +# Requires align_single_line_func=True, uses align_func_proto_span. +align_single_line_brace = false # false/true + +# Gap for align_single_line_brace. +align_single_line_brace_gap = 0 # unsigned number + +# The span for aligning ObjC msg spec (0=don't align) +align_oc_msg_spec_span = 0 # unsigned number + +# Whether to align macros wrapped with a backslash and a newline. +# This will not work right if the macro contains a multi-line comment. +align_nl_cont = false # false/true + +# # Align macro functions and variables together. +align_pp_define_together = false # false/true + +# The minimum space between label and value of a preprocessor define. +align_pp_define_gap = 0 # unsigned number + +# The span for aligning on '#define' bodies (0=don't align, other=number of lines including comments between blocks) +align_pp_define_span = 0 # unsigned number + +# Align lines that start with '<<' with previous '<<'. Default=True. +align_left_shift = true # false/true + +# Align text after asm volatile () colons. +align_asm_colon = false # false/true + +# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) +align_oc_msg_colon_span = 0 # unsigned number + +# If True, always align with the first parameter, even if it is too short. +align_oc_msg_colon_first = false # false/true + +# Aligning parameters in an Obj-C '+' or '-' declaration on the ':'. +align_oc_decl_colon = false # false/true + +# +# Comment modifications +# + +# Try to wrap comments at cmt_width columns +cmt_width = 0 # unsigned number + +# Set the comment reflow mode (Default=0) +# 0: no reflowing (apart from the line wrapping due to cmt_width) +# 1: no touching at all +# 2: full reflow +cmt_reflow_mode = 0 # unsigned number + +# Whether to convert all tabs to spaces in comments. Default is to leave tabs inside comments alone, unless used for indenting. +cmt_convert_tab_to_spaces = false # false/true + +# If False, disable all multi-line comment changes, including cmt_width. keyword substitution and leading chars. +# Default=True. +cmt_indent_multi = true # false/true + +# Whether to group c-comments that look like they are in a block. +cmt_c_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined c-comment. +cmt_c_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined c-comment. +cmt_c_nl_end = false # false/true + +# Whether to group cpp-comments that look like they are in a block. +cmt_cpp_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined cpp-comment. +cmt_cpp_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined cpp-comment. +cmt_cpp_nl_end = false # false/true + +# Whether to change cpp-comments into c-comments. +cmt_cpp_to_c = false # false/true + +# Whether to put a star on subsequent comment lines. +cmt_star_cont = false # false/true + +# The number of spaces to insert at the start of subsequent comment lines. +cmt_sp_before_star_cont = 0 # unsigned number + +# The number of spaces to insert after the star on subsequent comment lines. +cmt_sp_after_star_cont = 0 # number + +# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of +# the comment are the same length. Default=True. +cmt_multi_check_last = true # false/true + +# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of +# the comment are the same length AND if the length is bigger as the first_len minimum. Default=4 +cmt_multi_first_len_minimum = 4 # unsigned number + +# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_header = "" # string + +# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_footer = "" # string + +# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. +# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. +# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... }. +cmt_insert_func_header = "" # string + +# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. +# Will substitute $(class) with the class name. +cmt_insert_class_header = "" # string + +# The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment. +# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. +cmt_insert_oc_msg_header = "" # string + +# If a preprocessor is encountered when stepping backwards from a function name, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. +cmt_insert_before_preproc = false # false/true + +# If a function is declared inline to a class definition, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_func_header. +cmt_insert_before_inlines = true # false/true + +# If the function is a constructor/destructor, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_func_header. +cmt_insert_before_ctor_dtor = false # false/true + +# +# Code modifying options (non-whitespace) +# + +# Add or remove braces on single-line 'do' statement. +mod_full_brace_do = ignore # ignore/add/remove/force + +# Add or remove braces on single-line 'for' statement. +mod_full_brace_for = ignore # ignore/add/remove/force + +# Add or remove braces on single-line function definitions. (Pawn). +mod_full_brace_function = ignore # ignore/add/remove/force + +# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. +mod_full_brace_if = ignore # ignore/add/remove/force + +# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. +# If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. +mod_full_brace_if_chain = false # false/true + +# Make all if/elseif/else statements with at least one 'else' or 'else if' fully braced. +# If mod_full_brace_if_chain is used together with this option, all if-else chains will get braces, +# and simple 'if' statements will lose them (if possible). +mod_full_brace_if_chain_only = false # false/true + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # unsigned number + +# Blocks removal of braces if the parenthesis of if/for/while/.. span multiple lines. +mod_full_brace_nl_block_rem_mlcond = false # false/true + +# Add or remove braces on single-line 'while' statement. +mod_full_brace_while = ignore # ignore/add/remove/force + +# Add or remove braces on single-line 'using ()' statement. +mod_full_brace_using = ignore # ignore/add/remove/force + +# Add or remove unnecessary paren on 'return' statement. +mod_paren_on_return = ignore # ignore/add/remove/force + +# Whether to change optional semicolons to real semicolons. +mod_pawn_semicolon = false # false/true + +# Add parens on 'while' and 'if' statement around bools. +mod_full_paren_if_bool = false # false/true + +# Whether to remove superfluous semicolons. +mod_remove_extra_semicolon = false # false/true + +# If a function body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_function_closebrace_comment = 0 # unsigned number + +# If a namespace body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_namespace_closebrace_comment = 0 # unsigned number + +# If a class body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_class_closebrace_comment = 0 # unsigned number + +# If a switch body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_switch_closebrace_comment = 0 # unsigned number + +# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after +# the #endif, a comment will be added. +mod_add_long_ifdef_endif_comment = 0 # unsigned number + +# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after +# the #else, a comment will be added. +mod_add_long_ifdef_else_comment = 0 # unsigned number + +# If True, will sort consecutive single-line 'import' statements [Java, D]. +mod_sort_import = false # false/true + +# If True, will sort consecutive single-line 'using' statements [C#]. +mod_sort_using = false # false/true + +# If True, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] +# This is generally a bad idea, as it may break your code. +mod_sort_include = false # false/true + +# If True, it will move a 'break' that appears after a fully braced 'case' before the close brace. +mod_move_case_break = false # false/true + +# Will add or remove the braces around a fully braced case statement. +# Will only remove the braces if there are no variable declarations in the block. +mod_case_brace = ignore # ignore/add/remove/force + +# If True, it will remove a void 'return;' that appears as the last statement in a function. +mod_remove_empty_return = false # false/true + +# If True, it will organize the properties (Obj-C). +mod_sort_oc_properties = false # false/true + +# Determines weight of class property modifier (Obj-C). +mod_sort_oc_property_class_weight = 0 # number + +# Determines weight of atomic, nonatomic (Obj-C). +mod_sort_oc_property_thread_safe_weight = 0 # number + +# Determines weight of readwrite (Obj-C). +mod_sort_oc_property_readwrite_weight = 0 # number + +# Determines weight of reference type (retain, copy, assign, weak, strong) (Obj-C). +mod_sort_oc_property_reference_weight = 0 # number + +# Determines weight of getter type (getter=) (Obj-C). +mod_sort_oc_property_getter_weight = 0 # number + +# Determines weight of setter type (setter=) (Obj-C). +mod_sort_oc_property_setter_weight = 0 # number + +# Determines weight of nullability type (nullable, nonnull, null_unspecified, null_resettable) (Obj-C). +mod_sort_oc_property_nullability_weight = 0 # number + +# +# Preprocessor options +# + +# Control indent of preprocessors inside #if blocks at brace level 0 (file-level). +pp_indent = ignore # ignore/add/remove/force + +# Whether to indent #if/#else/#endif at the brace level (True) or from column 1 (False). +pp_indent_at_level = false # false/true + +# Specifies the number of columns to indent preprocessors per level at brace level 0 (file-level). +# If pp_indent_at_level=False, specifies the number of columns to indent preprocessors per level at brace level > 0 (function-level). +# Default=1. +pp_indent_count = 1 # unsigned number + +# Add or remove space after # based on pp_level of #if blocks. +pp_space = ignore # ignore/add/remove/force + +# Sets the number of spaces added with pp_space. +pp_space_count = 0 # unsigned number + +# The indent for #region and #endregion in C# and '#pragma region' in C/C++. +pp_indent_region = 0 # number + +# Whether to indent the code between #region and #endregion. +pp_region_indent_code = false # false/true + +# If pp_indent_at_level=True, sets the indent for #if, #else and #endif when not at file-level. +# 0: indent preprocessors using output_tab_size. +# >0: column at which all preprocessors will be indented. +pp_indent_if = 0 # number + +# Control whether to indent the code between #if, #else and #endif. +pp_if_indent_code = false # false/true + +# Whether to indent '#define' at the brace level (True) or from column 1 (false). +pp_define_at_level = false # false/true + +# Whether to ignore the '#define' body while formatting. +pp_ignore_define_body = false # false/true + +# Whether to indent case statements between #if, #else, and #endif. +# Only applies to the indent of the preprocesser that the case statements directly inside of. +pp_indent_case = true # false/true + +# Whether to indent whole function definitions between #if, #else, and #endif. +# Only applies to the indent of the preprocesser that the function definition is directly inside of. +pp_indent_func_def = true # false/true + +# Whether to indent extern C blocks between #if, #else, and #endif. +# Only applies to the indent of the preprocesser that the extern block is directly inside of. +pp_indent_extern = true # false/true + +# Whether to indent braces directly inside #if, #else, and #endif. +# Only applies to the indent of the preprocesser that the braces are directly inside of. +pp_indent_brace = true # false/true + +# +# Sort includes options +# + +# The regex for include category with priority 0. +include_category_0 = "" # string + +# The regex for include category with priority 1. +include_category_1 = "" # string + +# The regex for include category with priority 2. +include_category_2 = "" # string + +# +# Use or Do not Use options +# + +# True: indent_func_call_param will be used (default) +# False: indent_func_call_param will NOT be used. +use_indent_func_call_param = true # false/true + +# The value of the indentation for a continuation line is calculate differently if the line is: +# a declaration :your case with QString fileName ... +# an assignment :your case with pSettings = new QSettings( ... +# At the second case the option value might be used twice: +# at the assignment +# at the function call (if present) +# To prevent the double use of the option value, use this option with the value 'True'. +# True: indent_continue will be used only once +# False: indent_continue will be used every time (default). +use_indent_continue_only_once = false # false/true + +# SIGNAL/SLOT Qt macros have special formatting options. See options_for_QT.cpp for details. +# Default=True. +use_options_overriding_for_qt_macros = true # false/true + +# +# Warn levels - 1: error, 2: warning (default), 3: note +# + +# Warning is given if doing tab-to-\t replacement and we have found one in a C# verbatim string literal. +warn_level_tabs_found_in_verbatim_string_literals = 2 # unsigned number + +# Meaning of the settings: +# Ignore - do not do any changes +# Add - makes sure there is 1 or more space/brace/newline/etc +# Force - makes sure there is exactly 1 space/brace/newline/etc, +# behaves like Add in some contexts +# Remove - removes space/brace/newline/etc +# +# +# - Token(s) can be treated as specific type(s) with the 'set' option: +# `set tokenType tokenString [tokenString...]` +# +# Example: +# `set BOOL __AND__ __OR__` +# +# tokenTypes are defined in src/token_enum.h, use them without the +# 'CT_' prefix: 'CT_BOOL' -> 'BOOL' +# +# +# - Token(s) can be treated as type(s) with the 'type' option. +# `type tokenString [tokenString...]` +# +# Example: +# `type int c_uint_8 Rectangle` +# +# This can also be achieved with `set TYPE int c_uint_8 Rectangle` +# +# +# To embed whitespace in tokenStrings use the '\' escape character, or quote +# the tokenStrings. These quotes are supported: "'` +# +# +# - Support for the auto detection of languages through the file ending can be +# added using the 'file_ext' command. +# `file_ext langType langString [langString..]` +# +# Example: +# `file_ext CPP .ch .cxx .cpp.in` +# +# langTypes are defined in uncrusify_types.h in the lang_flag_e enum, use +# them without the 'LANG_' prefix: 'LANG_CPP' -> 'CPP' +# +# +# - Custom macro-based indentation can be set up using 'macro-open', +# 'macro-else' and 'macro-close'. +# `(macro-open | macro-else | macro-close) tokenString` +# +# Example: +# `macro-open BEGIN_TEMPLATE_MESSAGE_MAP` +# `macro-open BEGIN_MESSAGE_MAP` +# `macro-close END_MESSAGE_MAP` +# +## option(s) with 'not default' value: 0 +# diff --git a/lib/sbi/openapi/external/cJSON.c b/lib/sbi/openapi/external/cJSON.c new file mode 100644 index 000000000..fc796619d --- /dev/null +++ b/lib/sbi/openapi/external/cJSON.c @@ -0,0 +1,2939 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +/* cJSON */ +/* JSON parser in C. */ + +/* disable warnings about old C89 functions in MSVC */ +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifdef __GNUC__ +#pragma GCC visibility push(default) +#endif +#if defined(_MSC_VER) +#pragma warning (push) +/* disable warning about single line comments in system headers */ +#pragma warning (disable : 4001) +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef ENABLE_LOCALES +#include +#endif + +#if defined(_MSC_VER) +#pragma warning (pop) +#endif +#ifdef __GNUC__ +#pragma GCC visibility pop +#endif + +#include "cJSON.h" + +/* define our own boolean type */ +#define true ((cJSON_bool)1) +#define false ((cJSON_bool)0) + +typedef struct { + const unsigned char *json; + size_t position; +} error; +static error global_error = { NULL, 0 }; + +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) +{ + return (const char*) (global_error.json + global_error.position); +} + +CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) { + if (!cJSON_IsString(item)) { + return NULL; + } + + return item->valuestring; +} + +/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 7) + #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. +#endif + +CJSON_PUBLIC(const char*) cJSON_Version(void) +{ + static char version[15]; + sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + + return version; +} + +/* Case insensitive string comparison, doesn't consider two NULL pointers equal though */ +static int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } + + if (string1 == string2) + { + return 0; + } + + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } + + return tolower(*string1) - tolower(*string2); +} + +typedef struct internal_hooks +{ + void *(*allocate)(size_t size); + void (*deallocate)(void *pointer); + void *(*reallocate)(void *pointer, size_t size); +} internal_hooks; + +#if 0 /* modified by acetcom */ +#if defined(_MSC_VER) +/* work around MSVC error C2322: '...' address of dillimport '...' is not static */ +static void *internal_malloc(size_t size) +{ + return malloc(size); +} +static void internal_free(void *pointer) +{ + free(pointer); +} +static void *internal_realloc(void *pointer, size_t size) +{ + return realloc(pointer, size); +} +#else +#define internal_malloc malloc +#define internal_free free +#define internal_realloc realloc +#endif +#else +#include "ogs-core.h" +#define internal_malloc ogs_malloc +#define internal_free ogs_free +#define internal_realloc ogs_realloc +#endif + +static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; + +static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) +{ + size_t length = 0; + unsigned char *copy = NULL; + + if (string == NULL) + { + return NULL; + } + + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*)hooks->allocate(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); + + return copy; +} + +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) +{ + if (hooks == NULL) + { + /* Reset hooks */ + global_hooks.allocate = malloc; + global_hooks.deallocate = free; + global_hooks.reallocate = realloc; + return; + } + + global_hooks.allocate = malloc; + if (hooks->malloc_fn != NULL) + { + global_hooks.allocate = hooks->malloc_fn; + } + + global_hooks.deallocate = free; + if (hooks->free_fn != NULL) + { + global_hooks.deallocate = hooks->free_fn; + } + + /* use realloc only if both free and malloc are used */ + global_hooks.reallocate = NULL; + if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) + { + global_hooks.reallocate = realloc; + } +} + +/* Internal constructor. */ +static cJSON *cJSON_New_Item(const internal_hooks * const hooks) +{ + cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); + if (node) + { + memset(node, '\0', sizeof(cJSON)); + } + + return node; +} + +/* Delete a cJSON structure. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item) +{ + cJSON *next = NULL; + while (item != NULL) + { + next = item->next; + if (!(item->type & cJSON_IsReference) && (item->child != NULL)) + { + cJSON_Delete(item->child); + } + if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) + { + global_hooks.deallocate(item->valuestring); + } + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + global_hooks.deallocate(item->string); + } + global_hooks.deallocate(item); + item = next; + } +} + +/* get the decimal point character of the current locale */ +static unsigned char get_decimal_point(void) +{ +#ifdef ENABLE_LOCALES + struct lconv *lconv = localeconv(); + return (unsigned char) lconv->decimal_point[0]; +#else + return '.'; +#endif +} + +typedef struct +{ + const unsigned char *content; + size_t length; + size_t offset; + size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ + internal_hooks hooks; +} parse_buffer; + +/* check if the given size is left to read in a given parse buffer (starting with 1) */ +#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) +/* check if the buffer can be accessed at the given index (starting with 0) */ +#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) +#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) +/* get a pointer to the buffer at the position */ +#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) + +/* Parse the input text to generate a number, and populate the result into item. */ +static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) +{ + double number = 0; + unsigned char *after_end = NULL; + unsigned char number_c_string[64]; + unsigned char decimal_point = get_decimal_point(); + size_t i = 0; + + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; + } + + /* copy the number into a temporary buffer and replace '.' with the decimal point + * of the current locale (for strtod) + * This also takes care of '\0' not necessarily being available for marking the end of the input */ + for (i = 0; (i < (sizeof(number_c_string) - 1)) && can_access_at_index(input_buffer, i); i++) + { + switch (buffer_at_offset(input_buffer)[i]) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '+': + case '-': + case 'e': + case 'E': + number_c_string[i] = buffer_at_offset(input_buffer)[i]; + break; + + case '.': + number_c_string[i] = decimal_point; + break; + + default: + goto loop_end; + } + } +loop_end: + number_c_string[i] = '\0'; + + number = strtod((const char*)number_c_string, (char**)&after_end); + if (number_c_string == after_end) + { + return false; /* parse_error */ + } + + item->valuedouble = number; + + /* use saturation in case of overflow */ + if (number >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (number <= INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)number; + } + + item->type = cJSON_Number; + + input_buffer->offset += (size_t)(after_end - number_c_string); + return true; +} + +/* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number) +{ + if (number >= INT_MAX) + { + object->valueint = INT_MAX; + } + else if (number <= INT_MIN) + { + object->valueint = INT_MIN; + } + else + { + object->valueint = (int)number; + } + + return object->valuedouble = number; +} + +typedef struct +{ + unsigned char *buffer; + size_t length; + size_t offset; + size_t depth; /* current nesting depth (for formatted printing) */ + cJSON_bool noalloc; + cJSON_bool format; /* is this print a formatted print */ + internal_hooks hooks; +} printbuffer; + +/* realloc printbuffer if necessary to have at least "needed" bytes more */ +static unsigned char* ensure(printbuffer * const p, size_t needed) +{ + unsigned char *newbuffer = NULL; + size_t newsize = 0; + + if ((p == NULL) || (p->buffer == NULL)) + { + return NULL; + } + + if ((p->length > 0) && (p->offset >= p->length)) + { + /* make sure that offset is valid */ + return NULL; + } + + if (needed > INT_MAX) + { + /* sizes bigger than INT_MAX are currently not supported */ + return NULL; + } + + needed += p->offset + 1; + if (needed <= p->length) + { + return p->buffer + p->offset; + } + + if (p->noalloc) { + return NULL; + } + + /* calculate new buffer size */ + if (needed > (INT_MAX / 2)) + { + /* overflow of int, use INT_MAX if possible */ + if (needed <= INT_MAX) + { + newsize = INT_MAX; + } + else + { + return NULL; + } + } + else + { + newsize = needed * 2; + } + + if (p->hooks.reallocate != NULL) + { + /* reallocate with realloc if available */ + newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); + if (newbuffer == NULL) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + } + else + { + /* otherwise reallocate manually */ + newbuffer = (unsigned char*)p->hooks.allocate(newsize); + if (!newbuffer) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + if (newbuffer) + { + memcpy(newbuffer, p->buffer, p->offset + 1); + } + p->hooks.deallocate(p->buffer); + } + p->length = newsize; + p->buffer = newbuffer; + + return newbuffer + p->offset; +} + +/* calculate the new length of the string in a printbuffer and update the offset */ +static void update_offset(printbuffer * const buffer) +{ + const unsigned char *buffer_pointer = NULL; + if ((buffer == NULL) || (buffer->buffer == NULL)) + { + return; + } + buffer_pointer = buffer->buffer + buffer->offset; + + buffer->offset += strlen((const char*)buffer_pointer); +} + +/* Render the number nicely from the given item into a string. */ +static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + double d = item->valuedouble; + int length = 0; + size_t i = 0; + unsigned char number_buffer[26]; /* temporary buffer to print the number into */ + unsigned char decimal_point = get_decimal_point(); + double test; + + if (output_buffer == NULL) + { + return false; + } + + /* This checks for NaN and Infinity */ + if ((d * 0) != 0) + { + length = sprintf((char*)number_buffer, "null"); + } + else + { + /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ + length = sprintf((char*)number_buffer, "%1.15g", d); + + /* Check whether the original double can be recovered */ + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || ((double)test != d)) + { + /* If not, print with 17 decimal places of precision */ + length = sprintf((char*)number_buffer, "%1.17g", d); + } + } + + /* sprintf failed or buffer overrun occured */ + if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1))) + { + return false; + } + + /* reserve appropriate space in the output */ + output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); + if (output_pointer == NULL) + { + return false; + } + + /* copy the printed number to the output and replace locale + * dependent decimal point with '.' */ + for (i = 0; i < ((size_t)length); i++) + { + if (number_buffer[i] == decimal_point) + { + output_pointer[i] = '.'; + continue; + } + + output_pointer[i] = number_buffer[i]; + } + output_pointer[i] = '\0'; + + output_buffer->offset += (size_t)length; + + return true; +} + +/* parse 4 digit hexadecimal number */ +static unsigned parse_hex4(const unsigned char * const input) +{ + unsigned int h = 0; + size_t i = 0; + + for (i = 0; i < 4; i++) + { + /* parse digit */ + if ((input[i] >= '0') && (input[i] <= '9')) + { + h += (unsigned int) input[i] - '0'; + } + else if ((input[i] >= 'A') && (input[i] <= 'F')) + { + h += (unsigned int) 10 + input[i] - 'A'; + } + else if ((input[i] >= 'a') && (input[i] <= 'f')) + { + h += (unsigned int) 10 + input[i] - 'a'; + } + else /* invalid */ + { + return 0; + } + + if (i < 3) + { + /* shift left to make place for the next nibble */ + h = h << 4; + } + } + + return h; +} + +/* converts a UTF-16 literal to UTF-8 + * A literal can be one or two sequences of the form \uXXXX */ +static unsigned char utf16_literal_to_utf8(const unsigned char * const input_pointer, const unsigned char * const input_end, unsigned char **output_pointer) +{ + long unsigned int codepoint = 0; + unsigned int first_code = 0; + const unsigned char *first_sequence = input_pointer; + unsigned char utf8_length = 0; + unsigned char utf8_position = 0; + unsigned char sequence_length = 0; + unsigned char first_byte_mark = 0; + + if ((input_end - first_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + /* get the first utf16 sequence */ + first_code = parse_hex4(first_sequence + 2); + + /* check that the code is valid */ + if (((first_code >= 0xDC00) && (first_code <= 0xDFFF))) + { + goto fail; + } + + /* UTF16 surrogate pair */ + if ((first_code >= 0xD800) && (first_code <= 0xDBFF)) + { + const unsigned char *second_sequence = first_sequence + 6; + unsigned int second_code = 0; + sequence_length = 12; /* \uXXXX\uXXXX */ + + if ((input_end - second_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u')) + { + /* missing second half of the surrogate pair */ + goto fail; + } + + /* get the second utf16 sequence */ + second_code = parse_hex4(second_sequence + 2); + /* check that the code is valid */ + if ((second_code < 0xDC00) || (second_code > 0xDFFF)) + { + /* invalid second half of the surrogate pair */ + goto fail; + } + + + /* calculate the unicode codepoint from the surrogate pair */ + codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF)); + } + else + { + sequence_length = 6; /* \uXXXX */ + codepoint = first_code; + } + + /* encode as UTF-8 + * takes at maximum 4 bytes to encode: + * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + if (codepoint < 0x80) + { + /* normal ascii, encoding 0xxxxxxx */ + utf8_length = 1; + } + else if (codepoint < 0x800) + { + /* two bytes, encoding 110xxxxx 10xxxxxx */ + utf8_length = 2; + first_byte_mark = 0xC0; /* 11000000 */ + } + else if (codepoint < 0x10000) + { + /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */ + utf8_length = 3; + first_byte_mark = 0xE0; /* 11100000 */ + } + else if (codepoint <= 0x10FFFF) + { + /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + utf8_length = 4; + first_byte_mark = 0xF0; /* 11110000 */ + } + else + { + /* invalid unicode codepoint */ + goto fail; + } + + /* encode as utf8 */ + for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--) + { + /* 10xxxxxx */ + (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF); + codepoint >>= 6; + } + /* encode first byte */ + if (utf8_length > 1) + { + (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF); + } + else + { + (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F); + } + + *output_pointer += utf8_length; + + return sequence_length; + +fail: + return 0; +} + +/* Parse the input text into an unescaped cinput, and populate item. */ +static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) +{ + const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; + const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; + unsigned char *output_pointer = NULL; + unsigned char *output = NULL; + + /* not a string */ + if (buffer_at_offset(input_buffer)[0] != '\"') + { + goto fail; + } + + { + /* calculate approximate size of the output (overestimate) */ + size_t allocation_length = 0; + size_t skipped_bytes = 0; + while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"')) + { + /* is escape sequence */ + if (input_end[0] == '\\') + { + if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length) + { + /* prevent buffer overflow when last input character is a backslash */ + goto fail; + } + skipped_bytes++; + input_end++; + } + input_end++; + } + if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"')) + { + goto fail; /* string ended unexpectedly */ + } + + /* This is at most how much we need for the output */ + allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes; + output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); + if (output == NULL) + { + goto fail; /* allocation failure */ + } + } + + output_pointer = output; + /* loop through the string literal */ + while (input_pointer < input_end) + { + if (*input_pointer != '\\') + { + *output_pointer++ = *input_pointer++; + } + /* escape sequence */ + else + { + unsigned char sequence_length = 2; + if ((input_end - input_pointer) < 1) + { + goto fail; + } + + switch (input_pointer[1]) + { + case 'b': + *output_pointer++ = '\b'; + break; + case 'f': + *output_pointer++ = '\f'; + break; + case 'n': + *output_pointer++ = '\n'; + break; + case 'r': + *output_pointer++ = '\r'; + break; + case 't': + *output_pointer++ = '\t'; + break; + case '\"': + case '\\': + case '/': + *output_pointer++ = input_pointer[1]; + break; + + /* UTF-16 literal */ + case 'u': + sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer); + if (sequence_length == 0) + { + /* failed to convert UTF16-literal to UTF-8 */ + goto fail; + } + break; + + default: + goto fail; + } + input_pointer += sequence_length; + } + } + + /* zero terminate the output */ + *output_pointer = '\0'; + + item->type = cJSON_String; + item->valuestring = (char*)output; + + input_buffer->offset = (size_t) (input_end - input_buffer->content); + input_buffer->offset++; + + return true; + +fail: + if (output != NULL) + { + input_buffer->hooks.deallocate(output); + } + + if (input_pointer != NULL) + { + input_buffer->offset = (size_t)(input_pointer - input_buffer->content); + } + + return false; +} + +/* Render the cstring provided to an escaped version that can be printed. */ +static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) +{ + const unsigned char *input_pointer = NULL; + unsigned char *output = NULL; + unsigned char *output_pointer = NULL; + size_t output_length = 0; + /* numbers of additional characters needed for escaping */ + size_t escape_characters = 0; + + if (output_buffer == NULL) + { + return false; + } + + /* empty string */ + if (input == NULL) + { + output = ensure(output_buffer, sizeof("\"\"")); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "\"\""); + + return true; + } + + /* set "flag" to 1 if something needs to be escaped */ + for (input_pointer = input; *input_pointer; input_pointer++) + { + switch (*input_pointer) + { + case '\"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + /* one character escape sequence */ + escape_characters++; + break; + default: + if (*input_pointer < 32) + { + /* UTF-16 escape sequence uXXXX */ + escape_characters += 5; + } + break; + } + } + output_length = (size_t)(input_pointer - input) + escape_characters; + + output = ensure(output_buffer, output_length + sizeof("\"\"")); + if (output == NULL) + { + return false; + } + + /* no characters have to be escaped */ + if (escape_characters == 0) + { + output[0] = '\"'; + memcpy(output + 1, input, output_length); + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; + } + + output[0] = '\"'; + output_pointer = output + 1; + /* copy the string */ + for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++) + { + if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\')) + { + /* normal character, copy */ + *output_pointer = *input_pointer; + } + else + { + /* character needs to be escaped */ + *output_pointer++ = '\\'; + switch (*input_pointer) + { + case '\\': + *output_pointer = '\\'; + break; + case '\"': + *output_pointer = '\"'; + break; + case '\b': + *output_pointer = 'b'; + break; + case '\f': + *output_pointer = 'f'; + break; + case '\n': + *output_pointer = 'n'; + break; + case '\r': + *output_pointer = 'r'; + break; + case '\t': + *output_pointer = 't'; + break; + default: + /* escape and print as unicode codepoint */ + sprintf((char*)output_pointer, "u%04x", *input_pointer); + output_pointer += 4; + break; + } + } + } + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; +} + +/* Invoke print_string_ptr (which is useful) on an item. */ +static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) +{ + return print_string_ptr((unsigned char*)item->valuestring, p); +} + +/* Predeclare these prototypes. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer); + +/* Utility to jump whitespace and cr/lf */ +static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL)) + { + return NULL; + } + + while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) + { + buffer->offset++; + } + + if (buffer->offset == buffer->length) + { + buffer->offset--; + } + + return buffer; +} + +/* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */ +static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0)) + { + return NULL; + } + + if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0)) + { + buffer->offset += 3; + } + + return buffer; +} + +/* Parse an object - create a new root, and populate. */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; + cJSON *item = NULL; + + /* reset error position */ + global_error.json = NULL; + global_error.position = 0; + + if (value == NULL) + { + goto fail; + } + + buffer.content = (const unsigned char*)value; + buffer.length = strlen((const char*)value) + sizeof(""); + buffer.offset = 0; + buffer.hooks = global_hooks; + + item = cJSON_New_Item(&global_hooks); + if (item == NULL) /* memory fail */ + { + goto fail; + } + + if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) + { + /* parse failure. ep is set. */ + goto fail; + } + + /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ + if (require_null_terminated) + { + buffer_skip_whitespace(&buffer); + if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0') + { + goto fail; + } + } + if (return_parse_end) + { + *return_parse_end = (const char*)buffer_at_offset(&buffer); + } + + return item; + +fail: + if (item != NULL) + { + cJSON_Delete(item); + } + + if (value != NULL) + { + error local_error; + local_error.json = (const unsigned char*)value; + local_error.position = 0; + + if (buffer.offset < buffer.length) + { + local_error.position = buffer.offset; + } + else if (buffer.length > 0) + { + local_error.position = buffer.length - 1; + } + + if (return_parse_end != NULL) + { + *return_parse_end = (const char*)local_error.json + local_error.position; + } + + global_error = local_error; + } + + return NULL; +} + +/* Default options for cJSON_Parse */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) +{ + return cJSON_ParseWithOpts(value, 0, 0); +} + +#define cjson_min(a, b) ((a < b) ? a : b) + +static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) +{ + static const size_t default_buffer_size = 256; + printbuffer buffer[1]; + unsigned char *printed = NULL; + + memset(buffer, 0, sizeof(buffer)); + + /* create buffer */ + buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size); + buffer->length = default_buffer_size; + buffer->format = format; + buffer->hooks = *hooks; + if (buffer->buffer == NULL) + { + goto fail; + } + + /* print the value */ + if (!print_value(item, buffer)) + { + goto fail; + } + update_offset(buffer); + + /* check if reallocate is available */ + if (hooks->reallocate != NULL) + { + printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1); + if (printed == NULL) { + goto fail; + } + buffer->buffer = NULL; + } + else /* otherwise copy the JSON over to a new buffer */ + { + printed = (unsigned char*) hooks->allocate(buffer->offset + 1); + if (printed == NULL) + { + goto fail; + } + memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1)); + printed[buffer->offset] = '\0'; /* just to be sure */ + + /* free the buffer */ + hooks->deallocate(buffer->buffer); + } + + return printed; + +fail: + if (buffer->buffer != NULL) + { + hooks->deallocate(buffer->buffer); + } + + if (printed != NULL) + { + hooks->deallocate(printed); + } + + return NULL; +} + +/* Render a cJSON item/entity/structure to text. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) +{ + return (char*)print(item, true, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) +{ + return (char*)print(item, false, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if (prebuffer < 0) + { + return NULL; + } + + p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer); + if (!p.buffer) + { + return NULL; + } + + p.length = (size_t)prebuffer; + p.offset = 0; + p.noalloc = false; + p.format = fmt; + p.hooks = global_hooks; + + if (!print_value(item, &p)) + { + global_hooks.deallocate(p.buffer); + return NULL; + } + + return (char*)p.buffer; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if ((len < 0) || (buf == NULL)) + { + return false; + } + + p.buffer = (unsigned char*)buf; + p.length = (size_t)len; + p.offset = 0; + p.noalloc = true; + p.format = fmt; + p.hooks = global_hooks; + + return print_value(item, &p); +} + +/* Parser core - when encountering text, process appropriately. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) +{ + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; /* no input */ + } + + /* parse the different types of values */ + /* null */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0)) + { + item->type = cJSON_NULL; + input_buffer->offset += 4; + return true; + } + /* false */ + if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0)) + { + item->type = cJSON_False; + input_buffer->offset += 5; + return true; + } + /* true */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0)) + { + item->type = cJSON_True; + item->valueint = 1; + input_buffer->offset += 4; + return true; + } + /* string */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"')) + { + return parse_string(item, input_buffer); + } + /* number */ + if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9')))) + { + return parse_number(item, input_buffer); + } + /* array */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '[')) + { + return parse_array(item, input_buffer); + } + /* object */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{')) + { + return parse_object(item, input_buffer); + } + + return false; +} + +/* Render a value to text. */ +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output = NULL; + + if ((item == NULL) || (output_buffer == NULL)) + { + return false; + } + + switch ((item->type) & 0xFF) + { + case cJSON_NULL: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "null"); + return true; + + case cJSON_False: + output = ensure(output_buffer, 6); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "false"); + return true; + + case cJSON_True: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "true"); + return true; + + case cJSON_Number: + return print_number(item, output_buffer); + + case cJSON_Raw: + { + size_t raw_length = 0; + if (item->valuestring == NULL) + { + return false; + } + + raw_length = strlen(item->valuestring) + sizeof(""); + output = ensure(output_buffer, raw_length); + if (output == NULL) + { + return false; + } + memcpy(output, item->valuestring, raw_length); + return true; + } + + case cJSON_String: + return print_string(item, output_buffer); + + case cJSON_Array: + return print_array(item, output_buffer); + + case cJSON_Object: + return print_object(item, output_buffer); + + default: + return false; + } +} + +/* Build an array from input text. */ +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* head of the linked list */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (buffer_at_offset(input_buffer)[0] != '[') + { + /* not an array */ + goto fail; + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']')) + { + /* empty array */ + goto success; + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse next value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']') + { + goto fail; /* expected end of array */ + } + +success: + input_buffer->depth--; + + item->type = cJSON_Array; + item->child = head; + + input_buffer->offset++; + + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an array to text */ +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_element = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output array. */ + /* opening square bracket */ + output_pointer = ensure(output_buffer, 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer = '['; + output_buffer->offset++; + output_buffer->depth++; + + while (current_element != NULL) + { + if (!print_value(current_element, output_buffer)) + { + return false; + } + update_offset(output_buffer); + if (current_element->next) + { + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ','; + if(output_buffer->format) + { + *output_pointer++ = ' '; + } + *output_pointer = '\0'; + output_buffer->offset += length; + } + current_element = current_element->next; + } + + output_pointer = ensure(output_buffer, 2); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ']'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Build an object from the text. */ +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* linked list head */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{')) + { + goto fail; /* not an object */ + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}')) + { + goto success; /* empty object */ + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse the name of the child */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_string(current_item, input_buffer)) + { + goto fail; /* faile to parse name */ + } + buffer_skip_whitespace(input_buffer); + + /* swap valuestring and string, because we parsed the name */ + current_item->string = current_item->valuestring; + current_item->valuestring = NULL; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':')) + { + goto fail; /* invalid object */ + } + + /* parse the value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}')) + { + goto fail; /* expected end of object */ + } + +success: + input_buffer->depth--; + + item->type = cJSON_Object; + item->child = head; + + input_buffer->offset++; + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an object to text. */ +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_item = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output: */ + length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */ + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer++ = '{'; + output_buffer->depth++; + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + output_buffer->offset += length; + + while (current_item) + { + if (output_buffer->format) + { + size_t i; + output_pointer = ensure(output_buffer, output_buffer->depth); + if (output_pointer == NULL) + { + return false; + } + for (i = 0; i < output_buffer->depth; i++) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += output_buffer->depth; + } + + /* print key */ + if (!print_string_ptr((unsigned char*)current_item->string, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ':'; + if (output_buffer->format) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += length; + + /* print value */ + if (!print_value(current_item, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + /* print comma if not last */ + length = (size_t) ((output_buffer->format ? 1 : 0) + (current_item->next ? 1 : 0)); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + if (current_item->next) + { + *output_pointer++ = ','; + } + + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + *output_pointer = '\0'; + output_buffer->offset += length; + + current_item = current_item->next; + } + + output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2); + if (output_pointer == NULL) + { + return false; + } + if (output_buffer->format) + { + size_t i; + for (i = 0; i < (output_buffer->depth - 1); i++) + { + *output_pointer++ = '\t'; + } + } + *output_pointer++ = '}'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Get Array size/item / object item. */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array) +{ + cJSON *child = NULL; + size_t size = 0; + + if (array == NULL) + { + return 0; + } + + child = array->child; + + while(child != NULL) + { + size++; + child = child->next; + } + + /* FIXME: Can overflow here. Cannot be fixed without breaking the API */ + + return (int)size; +} + +static cJSON* get_array_item(const cJSON *array, size_t index) +{ + cJSON *current_child = NULL; + + if (array == NULL) + { + return NULL; + } + + current_child = array->child; + while ((current_child != NULL) && (index > 0)) + { + index--; + current_child = current_child->next; + } + + return current_child; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) +{ + if (index < 0) + { + return NULL; + } + + return get_array_item(array, (size_t)index); +} + +static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) +{ + cJSON *current_element = NULL; + + if ((object == NULL) || (name == NULL)) + { + return NULL; + } + + current_element = object->child; + if (case_sensitive) + { + while ((current_element != NULL) && (strcmp(name, current_element->string) != 0)) + { + current_element = current_element->next; + } + } + else + { + while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) + { + current_element = current_element->next; + } + } + + return current_element; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, false); +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string) +{ + return cJSON_GetObjectItem(object, string) ? 1 : 0; +} + +/* Utility for array list handling. */ +static void suffix_object(cJSON *prev, cJSON *item) +{ + prev->next = item; + item->prev = prev; +} + +/* Utility for handling references. */ +static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) +{ + cJSON *reference = NULL; + if (item == NULL) + { + return NULL; + } + + reference = cJSON_New_Item(hooks); + if (reference == NULL) + { + return NULL; + } + + memcpy(reference, item, sizeof(cJSON)); + reference->string = NULL; + reference->type |= cJSON_IsReference; + reference->next = reference->prev = NULL; + return reference; +} + +static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) +{ + cJSON *child = NULL; + + if ((item == NULL) || (array == NULL)) + { + return false; + } + + child = array->child; + + if (child == NULL) + { + /* list is empty, start new one */ + array->child = item; + } + else + { + /* append to the end */ + while (child->next) + { + child = child->next; + } + suffix_object(child, item); + } + + return true; +} + +/* Add item to array/object. */ +CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item) +{ + add_item_to_array(array, item); +} + +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic push +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wcast-qual" +#endif +/* helper function to cast away const */ +static void* cast_away_const(const void* string) +{ + return (void*)string; +} +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic pop +#endif + + +static cJSON_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool constant_key) +{ + char *new_key = NULL; + int new_type = cJSON_Invalid; + + if ((object == NULL) || (string == NULL) || (item == NULL)) + { + return false; + } + + if (constant_key) + { + new_key = (char*)cast_away_const(string); + new_type = item->type | cJSON_StringIsConst; + } + else + { + new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); + if (new_key == NULL) + { + return false; + } + + new_type = item->type & ~cJSON_StringIsConst; + } + + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + hooks->deallocate(item->string); + } + + item->string = new_key; + item->type = new_type; + + return add_item_to_array(object, item); +} + +CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) +{ + add_item_to_object(object, string, item, &global_hooks, false); +} + +/* Add an item to an object with constant string as key */ +CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) +{ + add_item_to_object(object, string, item, &global_hooks, true); +} + +CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) +{ + if (array == NULL) + { + return; + } + + add_item_to_array(array, create_reference(item, &global_hooks)); +} + +CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) +{ + if ((object == NULL) || (string == NULL)) + { + return; + } + + add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) +{ + cJSON *null = cJSON_CreateNull(); + if (add_item_to_object(object, name, null, &global_hooks, false)) + { + return null; + } + + cJSON_Delete(null); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name) +{ + cJSON *true_item = cJSON_CreateTrue(); + if (add_item_to_object(object, name, true_item, &global_hooks, false)) + { + return true_item; + } + + cJSON_Delete(true_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name) +{ + cJSON *false_item = cJSON_CreateFalse(); + if (add_item_to_object(object, name, false_item, &global_hooks, false)) + { + return false_item; + } + + cJSON_Delete(false_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) +{ + cJSON *bool_item = cJSON_CreateBool(boolean); + if (add_item_to_object(object, name, bool_item, &global_hooks, false)) + { + return bool_item; + } + + cJSON_Delete(bool_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) +{ + cJSON *number_item = cJSON_CreateNumber(number); + if (add_item_to_object(object, name, number_item, &global_hooks, false)) + { + return number_item; + } + + cJSON_Delete(number_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) +{ + cJSON *string_item = cJSON_CreateString(string); + if (add_item_to_object(object, name, string_item, &global_hooks, false)) + { + return string_item; + } + + cJSON_Delete(string_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) +{ + cJSON *raw_item = cJSON_CreateRaw(raw); + if (add_item_to_object(object, name, raw_item, &global_hooks, false)) + { + return raw_item; + } + + cJSON_Delete(raw_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name) +{ + cJSON *object_item = cJSON_CreateObject(); + if (add_item_to_object(object, name, object_item, &global_hooks, false)) + { + return object_item; + } + + cJSON_Delete(object_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name) +{ + cJSON *array = cJSON_CreateArray(); + if (add_item_to_object(object, name, array, &global_hooks, false)) + { + return array; + } + + cJSON_Delete(array); + return NULL; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) +{ + if ((parent == NULL) || (item == NULL)) + { + return NULL; + } + + if (item->prev != NULL) + { + /* not the first element */ + item->prev->next = item->next; + } + if (item->next != NULL) + { + /* not the last element */ + item->next->prev = item->prev; + } + + if (item == parent->child) + { + /* first element */ + parent->child = item->next; + } + /* make sure the detached item doesn't point anywhere anymore */ + item->prev = NULL; + item->next = NULL; + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) +{ + if (which < 0) + { + return NULL; + } + + return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which) +{ + cJSON_Delete(cJSON_DetachItemFromArray(array, which)); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItem(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObject(object, string)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); +} + +/* Replace array/object items with new ones. */ +CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) +{ + cJSON *after_inserted = NULL; + + if (which < 0) + { + return; + } + + after_inserted = get_array_item(array, (size_t)which); + if (after_inserted == NULL) + { + add_item_to_array(array, newitem); + return; + } + + newitem->next = after_inserted; + newitem->prev = after_inserted->prev; + after_inserted->prev = newitem; + if (after_inserted == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) +{ + if ((parent == NULL) || (replacement == NULL) || (item == NULL)) + { + return false; + } + + if (replacement == item) + { + return true; + } + + replacement->next = item->next; + replacement->prev = item->prev; + + if (replacement->next != NULL) + { + replacement->next->prev = replacement; + } + if (replacement->prev != NULL) + { + replacement->prev->next = replacement; + } + if (parent->child == item) + { + parent->child = replacement; + } + + item->next = NULL; + item->prev = NULL; + cJSON_Delete(item); + + return true; +} + +CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) +{ + if (which < 0) + { + return; + } + + cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); +} + +static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) +{ + if ((replacement == NULL) || (string == NULL)) + { + return false; + } + + /* replace the name in the replacement */ + if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) + { + cJSON_free(replacement->string); + } + replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + replacement->type &= ~cJSON_StringIsConst; + + cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); + + return true; +} + +CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) +{ + replace_item_in_object(object, string, newitem, false); +} + +CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) +{ + replace_item_in_object(object, string, newitem, true); +} + +/* Create basic types: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_NULL; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_True; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool b) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = b ? cJSON_True : cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Number; + item->valuedouble = num; + + /* use saturation in case of overflow */ + if (num >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (num <= INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)num; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_String; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) + { + item->type = cJSON_String | cJSON_IsReference; + item->valuestring = (char*)cast_away_const(string); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Object | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) { + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Array | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Raw; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type=cJSON_Array; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item) + { + item->type = cJSON_Object; + } + + return item; +} + +/* Create Arrays: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if (!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber((double)numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (strings == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for (i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateString(strings[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p,n); + } + p = n; + } + + return a; +} + +/* Duplication */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) +{ + cJSON *newitem = NULL; + cJSON *child = NULL; + cJSON *next = NULL; + cJSON *newchild = NULL; + + /* Bail on bad ptr */ + if (!item) + { + goto fail; + } + /* Create new item */ + newitem = cJSON_New_Item(&global_hooks); + if (!newitem) + { + goto fail; + } + /* Copy over all vars */ + newitem->type = item->type & (~cJSON_IsReference); + newitem->valueint = item->valueint; + newitem->valuedouble = item->valuedouble; + if (item->valuestring) + { + newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); + if (!newitem->valuestring) + { + goto fail; + } + } + if (item->string) + { + newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); + if (!newitem->string) + { + goto fail; + } + } + /* If non-recursive, then we're done! */ + if (!recurse) + { + return newitem; + } + /* Walk the ->next chain for the child. */ + child = item->child; + while (child != NULL) + { + newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ + if (!newchild) + { + goto fail; + } + if (next != NULL) + { + /* If newitem->child already set, then crosswire ->prev and ->next and move on */ + next->next = newchild; + newchild->prev = next; + next = newchild; + } + else + { + /* Set newitem->child and move to it */ + newitem->child = newchild; + next = newchild; + } + child = child->next; + } + + return newitem; + +fail: + if (newitem != NULL) + { + cJSON_Delete(newitem); + } + + return NULL; +} + +CJSON_PUBLIC(void) cJSON_Minify(char *json) +{ + unsigned char *into = (unsigned char*)json; + + if (json == NULL) + { + return; + } + + while (*json) + { + if (*json == ' ') + { + json++; + } + else if (*json == '\t') + { + /* Whitespace characters. */ + json++; + } + else if (*json == '\r') + { + json++; + } + else if (*json=='\n') + { + json++; + } + else if ((*json == '/') && (json[1] == '/')) + { + /* double-slash comments, to end of line. */ + while (*json && (*json != '\n')) + { + json++; + } + } + else if ((*json == '/') && (json[1] == '*')) + { + /* multiline comments. */ + while (*json && !((*json == '*') && (json[1] == '/'))) + { + json++; + } + json += 2; + } + else if (*json == '\"') + { + /* string literals, which are \" sensitive. */ + *into++ = (unsigned char)*json++; + while (*json && (*json != '\"')) + { + if (*json == '\\') + { + *into++ = (unsigned char)*json++; + } + *into++ = (unsigned char)*json++; + } + *into++ = (unsigned char)*json++; + } + else + { + /* All other characters. */ + *into++ = (unsigned char)*json++; + } + } + + /* and null-terminate. */ + *into = '\0'; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Invalid; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_False; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xff) == cJSON_True; +} + + +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & (cJSON_True | cJSON_False)) != 0; +} +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_NULL; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Number; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_String; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Array; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Object; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Raw; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) +{ + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) + { + return false; + } + + /* check if type is valid */ + switch (a->type & 0xFF) + { + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + case cJSON_Number: + case cJSON_String: + case cJSON_Raw: + case cJSON_Array: + case cJSON_Object: + break; + + default: + return false; + } + + /* identical objects are equal */ + if (a == b) + { + return true; + } + + switch (a->type & 0xFF) + { + /* in these cases and equal type is enough */ + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + return true; + + case cJSON_Number: + if (a->valuedouble == b->valuedouble) + { + return true; + } + return false; + + case cJSON_String: + case cJSON_Raw: + if ((a->valuestring == NULL) || (b->valuestring == NULL)) + { + return false; + } + if (strcmp(a->valuestring, b->valuestring) == 0) + { + return true; + } + + return false; + + case cJSON_Array: + { + cJSON *a_element = a->child; + cJSON *b_element = b->child; + + for (; (a_element != NULL) && (b_element != NULL);) + { + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + + a_element = a_element->next; + b_element = b_element->next; + } + + /* one of the arrays is longer than the other */ + if (a_element != b_element) { + return false; + } + + return true; + } + + case cJSON_Object: + { + cJSON *a_element = NULL; + cJSON *b_element = NULL; + cJSON_ArrayForEach(a_element, a) + { + /* TODO This has O(n^2) runtime, which is horrible! */ + b_element = get_object_item(b, a_element->string, case_sensitive); + if (b_element == NULL) + { + return false; + } + + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + } + + /* doing this twice, once on a and b to prevent true comparison if a subset of b + * TODO: Do this the proper way, this is just a fix for now */ + cJSON_ArrayForEach(b_element, b) + { + a_element = get_object_item(a, b_element->string, case_sensitive); + if (a_element == NULL) + { + return false; + } + + if (!cJSON_Compare(b_element, a_element, case_sensitive)) + { + return false; + } + } + + return true; + } + + default: + return false; + } +} + +CJSON_PUBLIC(void *) cJSON_malloc(size_t size) +{ + return global_hooks.allocate(size); +} + +CJSON_PUBLIC(void) cJSON_free(void *object) +{ + global_hooks.deallocate(object); +} diff --git a/lib/sbi/openapi/external/cJSON.h b/lib/sbi/openapi/external/cJSON.h new file mode 100644 index 000000000..b1592c640 --- /dev/null +++ b/lib/sbi/openapi/external/cJSON.h @@ -0,0 +1,277 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +#ifndef cJSON__h +#define cJSON__h + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* project version */ +#define CJSON_VERSION_MAJOR 1 +#define CJSON_VERSION_MINOR 7 +#define CJSON_VERSION_PATCH 7 + +#include + +/* cJSON Types: */ +#define cJSON_Invalid (0) +#define cJSON_False (1 << 0) +#define cJSON_True (1 << 1) +#define cJSON_NULL (1 << 2) +#define cJSON_Number (1 << 3) +#define cJSON_String (1 << 4) +#define cJSON_Array (1 << 5) +#define cJSON_Object (1 << 6) +#define cJSON_Raw (1 << 7) /* raw json */ + +#define cJSON_IsReference 256 +#define cJSON_StringIsConst 512 + +/* The cJSON structure: */ +typedef struct cJSON +{ + /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ + struct cJSON *next; + struct cJSON *prev; + /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + struct cJSON *child; + + /* The type of the item, as above. */ + int type; + + /* The item's string, if type==cJSON_String and type == cJSON_Raw */ + char *valuestring; + /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ + int valueint; + /* The item's number, if type==cJSON_Number */ + double valuedouble; + + /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ + char *string; +} cJSON; + +typedef struct cJSON_Hooks +{ + void *(*malloc_fn)(size_t sz); + void (*free_fn)(void *ptr); +} cJSON_Hooks; + +typedef int cJSON_bool; + +#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) +#define __WINDOWS__ +#endif +#ifdef __WINDOWS__ + +/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 2 define options: + + CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols + CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) + CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol + + For *nix builds that support visibility attribute, you can define similar behavior by + + setting default visibility to hidden by adding + -fvisibility=hidden (for gcc) + or + -xldscope=hidden (for sun cc) + to CFLAGS + + then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does + + */ + +/* export symbols by default, this is necessary for copy pasting the C and header file */ +#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) +#define CJSON_EXPORT_SYMBOLS +#endif + +#if defined(CJSON_HIDE_SYMBOLS) +#define CJSON_PUBLIC(type) type __stdcall +#elif defined(CJSON_EXPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall +#elif defined(CJSON_IMPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall +#endif +#else /* !WIN32 */ +#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) +#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type +#else +#define CJSON_PUBLIC(type) type +#endif +#endif + +/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. + * This is to prevent stack overflows. */ +#ifndef CJSON_NESTING_LIMIT +#define CJSON_NESTING_LIMIT 1000 +#endif + +/* returns the version of cJSON as a string */ +CJSON_PUBLIC(const char*) cJSON_Version(void); + +/* Supply malloc, realloc and free functions to cJSON */ +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks); + +/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ +/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); +/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ +/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); + +/* Render a cJSON entity to text for transfer/storage. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); +/* Render a cJSON entity to text for transfer/storage without any formatting. */ +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); +/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); +/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ +/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); +/* Delete a cJSON entity and all subentities. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *c); + +/* Returns the number of items in an array (or object). */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); +/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index); +/* Get item "string" from object. Case insensitive. */ +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string); +/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); + +/* Check if the item is a string and return its valuestring */ +CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item); + +/* These functions check the type of an item */ +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item); +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item); + +/* These calls create a cJSON item of the appropriate type. */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num); +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); +/* raw json */ +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); + +/* Create a string where valuestring references a string so + * it will not be freed by cJSON_Delete */ +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); +/* Create an object/arrray that only references it's elements so + * they will not be freed by cJSON_Delete */ +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); + +/* These utilities create an Array of count items. */ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count); + +/* Append item to the specified array/object. */ +CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. + * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before + * writing to `item->string` */ +CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ +CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); + +/* Remove/Detatch items from Arrays/Objects. */ +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string); +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); + +/* Update array items. */ +CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); + +/* Duplicate a cJSON item */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); +/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will + need to be released. With recurse!=0, it will duplicate any children connected to the item. + The item->next and ->prev pointers are always zero on return from Duplicate. */ +/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. + * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); + + +CJSON_PUBLIC(void) cJSON_Minify(char *json); + +/* Helper functions for creating and adding items to an object at the same time. + * They return the added item or NULL on failure. */ +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name); +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name); + +/* When assigning an integer value, it needs to be propagated to valuedouble too. */ +#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) +/* helper for the cJSON_SetNumberValue macro */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); +#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) + +/* Macro for iterating over an array or object */ +#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) + +/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ +CJSON_PUBLIC(void *) cJSON_malloc(size_t size); +CJSON_PUBLIC(void) cJSON_free(void *object); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/sbi/openapi/external/cJSON.licence b/lib/sbi/openapi/external/cJSON.licence new file mode 100644 index 000000000..47234478c --- /dev/null +++ b/lib/sbi/openapi/external/cJSON.licence @@ -0,0 +1,19 @@ +Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/lib/sbi/openapi/include/binary.h b/lib/sbi/openapi/include/binary.h new file mode 100644 index 000000000..15e6b3c29 --- /dev/null +++ b/lib/sbi/openapi/include/binary.h @@ -0,0 +1,27 @@ +#ifndef OGS_SBI_BINARY_H +#define OGS_SBI_BINARY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_binary_s { + uint8_t* data; + unsigned int len; +} OpenAPI_binary_t; + +OpenAPI_binary_t *OpenAPI_instantiate_binary_t(char *data, int len); + +char *OpenAPI_base64encode(const void *b64_encode_this, + int encode_this_many_bytes); + +char *OpenAPI_base64decode(const void *b64_decode_this, + int decode_this_many_bytes, int *decoded_bytes); + +#ifdef __cplusplus +} +#endif + +#endif // OGS_SBI_BINARY_H diff --git a/lib/sbi/openapi/include/keyValuePair.h b/lib/sbi/openapi/include/keyValuePair.h new file mode 100644 index 000000000..6dc64371a --- /dev/null +++ b/lib/sbi/openapi/include/keyValuePair.h @@ -0,0 +1,25 @@ +#ifndef OGS_SBI_MAP_H +#define OGS_SBI_MAP_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_map_s { + char *key; + void *value; +} OpenAPI_map_t; + +OpenAPI_map_t *OpenAPI_map_create(char *key, void *value); + +OpenAPI_map_t *OpenAPI_map_create_allocate(char *key, double value); + +void OpenAPI_map_free(OpenAPI_map_t *OpenAPI_map); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_MAP_H */ diff --git a/lib/sbi/openapi/include/list.h b/lib/sbi/openapi/include/list.h new file mode 100644 index 000000000..2cce300f7 --- /dev/null +++ b/lib/sbi/openapi/include/list.h @@ -0,0 +1,54 @@ +#ifndef OGS_SBI_LIST_H +#define OGS_SBI_LIST_H + +#include "../external/cJSON.h" +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OpenAPI_malloc(__sIZE) __sIZE == 0 ? NULL : ogs_malloc(__sIZE) + +typedef struct OpenAPI_list_s OpenAPI_list_t; + +typedef struct OpenAPI_lnode_s OpenAPI_lnode_t; + +struct OpenAPI_lnode_s { + OpenAPI_lnode_t *next; + OpenAPI_lnode_t *prev; + void *data; +}; + +typedef struct OpenAPI_list_s { + OpenAPI_lnode_t *first; + OpenAPI_lnode_t *last; + + long count; +} OpenAPI_list_t; + +#define OpenAPI_list_for_each(list, element) for(element = (list != NULL) ? (list)->first : NULL; element != NULL; element = element->next) + +OpenAPI_list_t *OpenAPI_list_create(void); +void OpenAPI_list_free(OpenAPI_list_t *listToFree); + +void OpenAPI_list_add(OpenAPI_list_t *list, void *dataToAddInList); +OpenAPI_lnode_t *OpenAPI_list_find(OpenAPI_list_t *list, long indexOfElement); +void OpenAPI_list_remove( + OpenAPI_list_t *list, OpenAPI_lnode_t *elementToRemove); + +void OpenAPI_list_iterate_forward(OpenAPI_list_t *list, + void (*operationToPerform)(OpenAPI_lnode_t*, void*), + void *additionalDataNeededForCallbackFunction); +void OpenAPI_list_iterate_backward(OpenAPI_list_t *list, + void (*operationToPerform)(OpenAPI_lnode_t*, void*), + void *additionalDataNeededForCallbackFunction); + +void OpenAPI_lnode_print(OpenAPI_lnode_t *listEntry, void *additionalData); +void OpenAPI_lnode_free(OpenAPI_lnode_t *listEntry, void *additionalData); + +#ifdef __cplusplus +} +#endif + +#endif // OGS_SBI_LIST_H diff --git a/lib/sbi/openapi/meson.build b/lib/sbi/openapi/meson.build new file mode 100644 index 000000000..9c858f9f8 --- /dev/null +++ b/lib/sbi/openapi/meson.build @@ -0,0 +1,131 @@ +# 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 . + +libsbi_openapi_sources = files(''' + src/list.c + src/apiKey.c + external/cJSON.c + model/object.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 + +'''.split()) + +libsbi_openapi_inc = include_directories('.') + +sbi_openapi_cc_flags = ['-DOGS_SBI_COMPILATION'] + +if cc.get_id() == 'gcc' or cc.get_id() == 'clang' + sbi_openapi_cc_flags += cc.get_supported_arguments([ + '-Wno-strict-prototypes', + '-Wno-missing-prototypes', + '-Wno-missing-declarations', + '-Wno-unused-variable', + '-Wno-unused-label', + '-Wno-float-equal', + ]) +endif + +libsbi_openapi = library('ogssbi-openapi', + sources : libsbi_openapi_sources, + version : libogslib_version, + c_args : sbi_openapi_cc_flags, + include_directories : [libsbi_openapi_inc, libinc], + dependencies : libcore_dep, + install : true) + +libsbi_openapi_dep = declare_dependency( + link_with : libsbi_openapi, + include_directories : [libsbi_openapi_inc, libinc], + dependencies : libcore_dep) diff --git a/lib/sbi/openapi/model/access_type.c b/lib/sbi/openapi/model/access_type.c new file mode 100644 index 000000000..a569d2fa6 --- /dev/null +++ b/lib/sbi/openapi/model/access_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "access_type.h" + +char* OpenAPI_access_type_ToString(OpenAPI_access_type_e access_type) +{ + const char *access_typeArray[] = { "NULL", "3GPP_ACCESS", "NON_3GPP_ACCESS" }; + size_t sizeofArray = sizeof(access_typeArray) / sizeof(access_typeArray[0]); + if (access_type < sizeofArray) + return (char *)access_typeArray[access_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_access_type_e OpenAPI_access_type_FromString(char* access_type) +{ + int stringToReturn = 0; + const char *access_typeArray[] = { "NULL", "3GPP_ACCESS", "NON_3GPP_ACCESS" }; + size_t sizeofArray = sizeof(access_typeArray) / sizeof(access_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(access_type, access_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/access_type.h b/lib/sbi/openapi/model/access_type.h new file mode 100644 index 000000000..5658a778e --- /dev/null +++ b/lib/sbi/openapi/model/access_type.h @@ -0,0 +1,31 @@ +/* + * access_type.h + * + * + */ + +#ifndef _OpenAPI_access_type_H_ +#define _OpenAPI_access_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_access_type_NULL = 0, OpenAPI_access_type_3GPP_ACCESS, OpenAPI_access_type_NON_3GPP_ACCESS } OpenAPI_access_type_e; + +char* OpenAPI_access_type_ToString(OpenAPI_access_type_e access_type); + +OpenAPI_access_type_e OpenAPI_access_type_FromString(char* access_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_access_type_H_ */ + diff --git a/lib/sbi/openapi/model/amf_cond.c b/lib/sbi/openapi/model/amf_cond.c new file mode 100644 index 000000000..079b8dd44 --- /dev/null +++ b/lib/sbi/openapi/model/amf_cond.c @@ -0,0 +1,91 @@ + +#include +#include +#include +#include "amf_cond.h" + +OpenAPI_amf_cond_t *OpenAPI_amf_cond_create( + char *amf_set_id, + char *amf_region_id + ) +{ + OpenAPI_amf_cond_t *amf_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_cond_t)); + if (!amf_cond_local_var) { + return NULL; + } + amf_cond_local_var->amf_set_id = amf_set_id; + amf_cond_local_var->amf_region_id = amf_region_id; + + return amf_cond_local_var; +} + +void OpenAPI_amf_cond_free(OpenAPI_amf_cond_t *amf_cond) +{ + if (NULL == amf_cond) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(amf_cond->amf_set_id); + ogs_free(amf_cond->amf_region_id); + ogs_free(amf_cond); +} + +cJSON *OpenAPI_amf_cond_convertToJSON(OpenAPI_amf_cond_t *amf_cond) +{ + cJSON *item = NULL; + + if (amf_cond == NULL) { + ogs_error("OpenAPI_amf_cond_convertToJSON() failed [AmfCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (amf_cond->amf_set_id) { + if (cJSON_AddStringToObject(item, "amfSetId", amf_cond->amf_set_id) == NULL) { + ogs_error("OpenAPI_amf_cond_convertToJSON() failed [amf_set_id]"); + goto end; + } + } + + if (amf_cond->amf_region_id) { + if (cJSON_AddStringToObject(item, "amfRegionId", amf_cond->amf_region_id) == NULL) { + ogs_error("OpenAPI_amf_cond_convertToJSON() failed [amf_region_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_amf_cond_t *OpenAPI_amf_cond_parseFromJSON(cJSON *amf_condJSON) +{ + OpenAPI_amf_cond_t *amf_cond_local_var = NULL; + cJSON *amf_set_id = cJSON_GetObjectItemCaseSensitive(amf_condJSON, "amfSetId"); + + if (amf_set_id) { + if (!cJSON_IsString(amf_set_id)) { + ogs_error("OpenAPI_amf_cond_parseFromJSON() failed [amf_set_id]"); + goto end; + } + } + + cJSON *amf_region_id = cJSON_GetObjectItemCaseSensitive(amf_condJSON, "amfRegionId"); + + if (amf_region_id) { + if (!cJSON_IsString(amf_region_id)) { + ogs_error("OpenAPI_amf_cond_parseFromJSON() failed [amf_region_id]"); + goto end; + } + } + + amf_cond_local_var = OpenAPI_amf_cond_create ( + amf_set_id ? ogs_strdup(amf_set_id->valuestring) : NULL, + amf_region_id ? ogs_strdup(amf_region_id->valuestring) : NULL + ); + + return amf_cond_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/amf_cond.h b/lib/sbi/openapi/model/amf_cond.h new file mode 100644 index 000000000..d14506dea --- /dev/null +++ b/lib/sbi/openapi/model/amf_cond.h @@ -0,0 +1,39 @@ +/* + * amf_cond.h + * + * + */ + +#ifndef _OpenAPI_amf_cond_H_ +#define _OpenAPI_amf_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_amf_cond_s OpenAPI_amf_cond_t; +typedef struct OpenAPI_amf_cond_s { + char *amf_set_id; + char *amf_region_id; +} OpenAPI_amf_cond_t; + +OpenAPI_amf_cond_t *OpenAPI_amf_cond_create( + char *amf_set_id, + char *amf_region_id + ); +void OpenAPI_amf_cond_free(OpenAPI_amf_cond_t *amf_cond); +OpenAPI_amf_cond_t *OpenAPI_amf_cond_parseFromJSON(cJSON *amf_condJSON); +cJSON *OpenAPI_amf_cond_convertToJSON(OpenAPI_amf_cond_t *amf_cond); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_cond_H_ */ + diff --git a/lib/sbi/openapi/model/amf_info.c b/lib/sbi/openapi/model/amf_info.c new file mode 100644 index 000000000..f94ea4442 --- /dev/null +++ b/lib/sbi/openapi/model/amf_info.c @@ -0,0 +1,380 @@ + +#include +#include +#include +#include "amf_info.h" + +OpenAPI_amf_info_t *OpenAPI_amf_info_create( + char *amf_set_id, + char *amf_region_id, + OpenAPI_list_t *guami_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *backup_info_amf_failure, + OpenAPI_list_t *backup_info_amf_removal, + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info + ) +{ + OpenAPI_amf_info_t *amf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_info_t)); + if (!amf_info_local_var) { + return NULL; + } + amf_info_local_var->amf_set_id = amf_set_id; + amf_info_local_var->amf_region_id = amf_region_id; + amf_info_local_var->guami_list = guami_list; + amf_info_local_var->tai_list = tai_list; + amf_info_local_var->tai_range_list = tai_range_list; + amf_info_local_var->backup_info_amf_failure = backup_info_amf_failure; + amf_info_local_var->backup_info_amf_removal = backup_info_amf_removal; + amf_info_local_var->n2_interface_amf_info = n2_interface_amf_info; + + return amf_info_local_var; +} + +void OpenAPI_amf_info_free(OpenAPI_amf_info_t *amf_info) +{ + if (NULL == amf_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(amf_info->amf_set_id); + ogs_free(amf_info->amf_region_id); + OpenAPI_list_for_each(amf_info->guami_list, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(amf_info->guami_list); + OpenAPI_list_for_each(amf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(amf_info->tai_list); + OpenAPI_list_for_each(amf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(amf_info->tai_range_list); + OpenAPI_list_for_each(amf_info->backup_info_amf_failure, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(amf_info->backup_info_amf_failure); + OpenAPI_list_for_each(amf_info->backup_info_amf_removal, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(amf_info->backup_info_amf_removal); + OpenAPI_n2_interface_amf_info_free(amf_info->n2_interface_amf_info); + ogs_free(amf_info); +} + +cJSON *OpenAPI_amf_info_convertToJSON(OpenAPI_amf_info_t *amf_info) +{ + cJSON *item = NULL; + + if (amf_info == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [AmfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!amf_info->amf_set_id) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [amf_set_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "amfSetId", amf_info->amf_set_id) == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [amf_set_id]"); + goto end; + } + + if (!amf_info->amf_region_id) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [amf_region_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "amfRegionId", amf_info->amf_region_id) == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [amf_region_id]"); + goto end; + } + + if (!amf_info->guami_list) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); + if (guami_listList == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [guami_list]"); + goto end; + } + + OpenAPI_lnode_t *guami_list_node; + if (amf_info->guami_list) { + OpenAPI_list_for_each(amf_info->guami_list, guami_list_node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(guami_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON_AddItemToArray(guami_listList, itemLocal); + } + } + + if (amf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [tai_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_list_node; + if (amf_info->tai_list) { + OpenAPI_list_for_each(amf_info->tai_list, tai_list_node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(tai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + } + + if (amf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_range_list_node; + if (amf_info->tai_range_list) { + OpenAPI_list_for_each(amf_info->tai_range_list, tai_range_list_node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(tai_range_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + } + + if (amf_info->backup_info_amf_failure) { + cJSON *backup_info_amf_failureList = cJSON_AddArrayToObject(item, "backupInfoAmfFailure"); + if (backup_info_amf_failureList == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [backup_info_amf_failure]"); + goto end; + } + + OpenAPI_lnode_t *backup_info_amf_failure_node; + if (amf_info->backup_info_amf_failure) { + OpenAPI_list_for_each(amf_info->backup_info_amf_failure, backup_info_amf_failure_node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(backup_info_amf_failure_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [backup_info_amf_failure]"); + goto end; + } + cJSON_AddItemToArray(backup_info_amf_failureList, itemLocal); + } + } + } + + if (amf_info->backup_info_amf_removal) { + cJSON *backup_info_amf_removalList = cJSON_AddArrayToObject(item, "backupInfoAmfRemoval"); + if (backup_info_amf_removalList == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [backup_info_amf_removal]"); + goto end; + } + + OpenAPI_lnode_t *backup_info_amf_removal_node; + if (amf_info->backup_info_amf_removal) { + OpenAPI_list_for_each(amf_info->backup_info_amf_removal, backup_info_amf_removal_node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(backup_info_amf_removal_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [backup_info_amf_removal]"); + goto end; + } + cJSON_AddItemToArray(backup_info_amf_removalList, itemLocal); + } + } + } + + if (amf_info->n2_interface_amf_info) { + cJSON *n2_interface_amf_info_local_JSON = OpenAPI_n2_interface_amf_info_convertToJSON(amf_info->n2_interface_amf_info); + if (n2_interface_amf_info_local_JSON == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [n2_interface_amf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InterfaceAmfInfo", n2_interface_amf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [n2_interface_amf_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_amf_info_t *OpenAPI_amf_info_parseFromJSON(cJSON *amf_infoJSON) +{ + OpenAPI_amf_info_t *amf_info_local_var = NULL; + cJSON *amf_set_id = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "amfSetId"); + if (!amf_set_id) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [amf_set_id]"); + goto end; + } + + + if (!cJSON_IsString(amf_set_id)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [amf_set_id]"); + goto end; + } + + cJSON *amf_region_id = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "amfRegionId"); + if (!amf_region_id) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [amf_region_id]"); + goto end; + } + + + if (!cJSON_IsString(amf_region_id)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [amf_region_id]"); + goto end; + } + + cJSON *guami_list = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "guamiList"); + if (!guami_list) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [guami_list]"); + goto end; + } + + OpenAPI_list_t *guami_listList; + + cJSON *guami_list_local_nonprimitive; + if (!cJSON_IsArray(guami_list)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [guami_list]"); + goto end; + } + + guami_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(guami_list_local_nonprimitive, guami_list ) { + if (!cJSON_IsObject(guami_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [guami_list]"); + goto end; + } + OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local_nonprimitive); + + OpenAPI_list_add(guami_listList, guami_listItem); + } + + cJSON *tai_list = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "taiList"); + + OpenAPI_list_t *tai_listList; + if (tai_list) { + cJSON *tai_list_local_nonprimitive; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local_nonprimitive, tai_list ) { + if (!cJSON_IsObject(tai_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local_nonprimitive); + + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + cJSON *tai_range_list = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "taiRangeList"); + + OpenAPI_list_t *tai_range_listList; + if (tai_range_list) { + cJSON *tai_range_list_local_nonprimitive; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local_nonprimitive, tai_range_list ) { + if (!cJSON_IsObject(tai_range_list_local_nonprimitive)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local_nonprimitive); + + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + cJSON *backup_info_amf_failure = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "backupInfoAmfFailure"); + + OpenAPI_list_t *backup_info_amf_failureList; + if (backup_info_amf_failure) { + cJSON *backup_info_amf_failure_local_nonprimitive; + if (!cJSON_IsArray(backup_info_amf_failure)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [backup_info_amf_failure]"); + goto end; + } + + backup_info_amf_failureList = OpenAPI_list_create(); + + cJSON_ArrayForEach(backup_info_amf_failure_local_nonprimitive, backup_info_amf_failure ) { + if (!cJSON_IsObject(backup_info_amf_failure_local_nonprimitive)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [backup_info_amf_failure]"); + goto end; + } + OpenAPI_guami_t *backup_info_amf_failureItem = OpenAPI_guami_parseFromJSON(backup_info_amf_failure_local_nonprimitive); + + OpenAPI_list_add(backup_info_amf_failureList, backup_info_amf_failureItem); + } + } + + cJSON *backup_info_amf_removal = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "backupInfoAmfRemoval"); + + OpenAPI_list_t *backup_info_amf_removalList; + if (backup_info_amf_removal) { + cJSON *backup_info_amf_removal_local_nonprimitive; + if (!cJSON_IsArray(backup_info_amf_removal)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [backup_info_amf_removal]"); + goto end; + } + + backup_info_amf_removalList = OpenAPI_list_create(); + + cJSON_ArrayForEach(backup_info_amf_removal_local_nonprimitive, backup_info_amf_removal ) { + if (!cJSON_IsObject(backup_info_amf_removal_local_nonprimitive)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [backup_info_amf_removal]"); + goto end; + } + OpenAPI_guami_t *backup_info_amf_removalItem = OpenAPI_guami_parseFromJSON(backup_info_amf_removal_local_nonprimitive); + + OpenAPI_list_add(backup_info_amf_removalList, backup_info_amf_removalItem); + } + } + + cJSON *n2_interface_amf_info = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "n2InterfaceAmfInfo"); + + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info_local_nonprim = NULL; + if (n2_interface_amf_info) { + n2_interface_amf_info_local_nonprim = OpenAPI_n2_interface_amf_info_parseFromJSON(n2_interface_amf_info); + } + + amf_info_local_var = OpenAPI_amf_info_create ( + ogs_strdup(amf_set_id->valuestring), + ogs_strdup(amf_region_id->valuestring), + guami_listList, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + backup_info_amf_failure ? backup_info_amf_failureList : NULL, + backup_info_amf_removal ? backup_info_amf_removalList : NULL, + n2_interface_amf_info ? n2_interface_amf_info_local_nonprim : NULL + ); + + return amf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/amf_info.h b/lib/sbi/openapi/model/amf_info.h new file mode 100644 index 000000000..eb500f2be --- /dev/null +++ b/lib/sbi/openapi/model/amf_info.h @@ -0,0 +1,55 @@ +/* + * amf_info.h + * + * + */ + +#ifndef _OpenAPI_amf_info_H_ +#define _OpenAPI_amf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "guami.h" +#include "n2_interface_amf_info.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_amf_info_s OpenAPI_amf_info_t; +typedef struct OpenAPI_amf_info_s { + char *amf_set_id; + char *amf_region_id; + OpenAPI_list_t *guami_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *backup_info_amf_failure; + OpenAPI_list_t *backup_info_amf_removal; + struct OpenAPI_n2_interface_amf_info_s *n2_interface_amf_info; +} OpenAPI_amf_info_t; + +OpenAPI_amf_info_t *OpenAPI_amf_info_create( + char *amf_set_id, + char *amf_region_id, + OpenAPI_list_t *guami_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *backup_info_amf_failure, + OpenAPI_list_t *backup_info_amf_removal, + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info + ); +void OpenAPI_amf_info_free(OpenAPI_amf_info_t *amf_info); +OpenAPI_amf_info_t *OpenAPI_amf_info_parseFromJSON(cJSON *amf_infoJSON); +cJSON *OpenAPI_amf_info_convertToJSON(OpenAPI_amf_info_t *amf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_amf_info_H_ */ + diff --git a/lib/sbi/openapi/model/atom.c b/lib/sbi/openapi/model/atom.c new file mode 100644 index 000000000..86e59d513 --- /dev/null +++ b/lib/sbi/openapi/model/atom.c @@ -0,0 +1,120 @@ + +#include +#include +#include +#include "atom.h" + +OpenAPI_atom_t *OpenAPI_atom_create( + char *attr, + char *value, + int negative + ) +{ + OpenAPI_atom_t *atom_local_var = OpenAPI_malloc(sizeof(OpenAPI_atom_t)); + if (!atom_local_var) { + return NULL; + } + atom_local_var->attr = attr; + atom_local_var->value = value; + atom_local_var->negative = negative; + + return atom_local_var; +} + +void OpenAPI_atom_free(OpenAPI_atom_t *atom) +{ + if (NULL == atom) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(atom->attr); + ogs_free(atom->value); + ogs_free(atom); +} + +cJSON *OpenAPI_atom_convertToJSON(OpenAPI_atom_t *atom) +{ + cJSON *item = NULL; + + if (atom == NULL) { + ogs_error("OpenAPI_atom_convertToJSON() failed [Atom]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!atom->attr) { + ogs_error("OpenAPI_atom_convertToJSON() failed [attr]"); + goto end; + } + if (cJSON_AddStringToObject(item, "attr", atom->attr) == NULL) { + ogs_error("OpenAPI_atom_convertToJSON() failed [attr]"); + goto end; + } + + if (!atom->value) { + ogs_error("OpenAPI_atom_convertToJSON() failed [value]"); + goto end; + } + if (cJSON_AddStringToObject(item, "value", atom->value) == NULL) { + ogs_error("OpenAPI_atom_convertToJSON() failed [value]"); + goto end; + } + + if (atom->negative) { + if (cJSON_AddBoolToObject(item, "negative", atom->negative) == NULL) { + ogs_error("OpenAPI_atom_convertToJSON() failed [negative]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_atom_t *OpenAPI_atom_parseFromJSON(cJSON *atomJSON) +{ + OpenAPI_atom_t *atom_local_var = NULL; + cJSON *attr = cJSON_GetObjectItemCaseSensitive(atomJSON, "attr"); + if (!attr) { + ogs_error("OpenAPI_atom_parseFromJSON() failed [attr]"); + goto end; + } + + + if (!cJSON_IsString(attr)) { + ogs_error("OpenAPI_atom_parseFromJSON() failed [attr]"); + goto end; + } + + cJSON *value = cJSON_GetObjectItemCaseSensitive(atomJSON, "value"); + if (!value) { + ogs_error("OpenAPI_atom_parseFromJSON() failed [value]"); + goto end; + } + + + if (!cJSON_IsString(value)) { + ogs_error("OpenAPI_atom_parseFromJSON() failed [value]"); + goto end; + } + + cJSON *negative = cJSON_GetObjectItemCaseSensitive(atomJSON, "negative"); + + if (negative) { + if (!cJSON_IsBool(negative)) { + ogs_error("OpenAPI_atom_parseFromJSON() failed [negative]"); + goto end; + } + } + + atom_local_var = OpenAPI_atom_create ( + ogs_strdup(attr->valuestring), + ogs_strdup(value->valuestring), + negative ? negative->valueint : 0 + ); + + return atom_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/atom.h b/lib/sbi/openapi/model/atom.h new file mode 100644 index 000000000..4f8046854 --- /dev/null +++ b/lib/sbi/openapi/model/atom.h @@ -0,0 +1,41 @@ +/* + * atom.h + * + * + */ + +#ifndef _OpenAPI_atom_H_ +#define _OpenAPI_atom_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_atom_s OpenAPI_atom_t; +typedef struct OpenAPI_atom_s { + char *attr; + char *value; + int negative; +} OpenAPI_atom_t; + +OpenAPI_atom_t *OpenAPI_atom_create( + char *attr, + char *value, + int negative + ); +void OpenAPI_atom_free(OpenAPI_atom_t *atom); +OpenAPI_atom_t *OpenAPI_atom_parseFromJSON(cJSON *atomJSON); +cJSON *OpenAPI_atom_convertToJSON(OpenAPI_atom_t *atom); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_atom_H_ */ + diff --git a/lib/sbi/openapi/model/atsss_capability.c b/lib/sbi/openapi/model/atsss_capability.c new file mode 100644 index 000000000..02acaa933 --- /dev/null +++ b/lib/sbi/openapi/model/atsss_capability.c @@ -0,0 +1,89 @@ + +#include +#include +#include +#include "atsss_capability.h" + +OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create( + int atsss_ll, + int mptcp + ) +{ + OpenAPI_atsss_capability_t *atsss_capability_local_var = OpenAPI_malloc(sizeof(OpenAPI_atsss_capability_t)); + if (!atsss_capability_local_var) { + return NULL; + } + atsss_capability_local_var->atsss_ll = atsss_ll; + atsss_capability_local_var->mptcp = mptcp; + + return atsss_capability_local_var; +} + +void OpenAPI_atsss_capability_free(OpenAPI_atsss_capability_t *atsss_capability) +{ + if (NULL == atsss_capability) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(atsss_capability); +} + +cJSON *OpenAPI_atsss_capability_convertToJSON(OpenAPI_atsss_capability_t *atsss_capability) +{ + cJSON *item = NULL; + + if (atsss_capability == NULL) { + ogs_error("OpenAPI_atsss_capability_convertToJSON() failed [AtsssCapability]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (atsss_capability->atsss_ll) { + if (cJSON_AddBoolToObject(item, "atsssLL", atsss_capability->atsss_ll) == NULL) { + ogs_error("OpenAPI_atsss_capability_convertToJSON() failed [atsss_ll]"); + goto end; + } + } + + if (atsss_capability->mptcp) { + if (cJSON_AddBoolToObject(item, "mptcp", atsss_capability->mptcp) == NULL) { + ogs_error("OpenAPI_atsss_capability_convertToJSON() failed [mptcp]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_parseFromJSON(cJSON *atsss_capabilityJSON) +{ + OpenAPI_atsss_capability_t *atsss_capability_local_var = NULL; + cJSON *atsss_ll = cJSON_GetObjectItemCaseSensitive(atsss_capabilityJSON, "atsssLL"); + + if (atsss_ll) { + if (!cJSON_IsBool(atsss_ll)) { + ogs_error("OpenAPI_atsss_capability_parseFromJSON() failed [atsss_ll]"); + goto end; + } + } + + cJSON *mptcp = cJSON_GetObjectItemCaseSensitive(atsss_capabilityJSON, "mptcp"); + + if (mptcp) { + if (!cJSON_IsBool(mptcp)) { + ogs_error("OpenAPI_atsss_capability_parseFromJSON() failed [mptcp]"); + goto end; + } + } + + atsss_capability_local_var = OpenAPI_atsss_capability_create ( + atsss_ll ? atsss_ll->valueint : 0, + mptcp ? mptcp->valueint : 0 + ); + + return atsss_capability_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/atsss_capability.h b/lib/sbi/openapi/model/atsss_capability.h new file mode 100644 index 000000000..38881b57b --- /dev/null +++ b/lib/sbi/openapi/model/atsss_capability.h @@ -0,0 +1,39 @@ +/* + * atsss_capability.h + * + * + */ + +#ifndef _OpenAPI_atsss_capability_H_ +#define _OpenAPI_atsss_capability_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_atsss_capability_s OpenAPI_atsss_capability_t; +typedef struct OpenAPI_atsss_capability_s { + int atsss_ll; + int mptcp; +} OpenAPI_atsss_capability_t; + +OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create( + int atsss_ll, + int mptcp + ); +void OpenAPI_atsss_capability_free(OpenAPI_atsss_capability_t *atsss_capability); +OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_parseFromJSON(cJSON *atsss_capabilityJSON); +cJSON *OpenAPI_atsss_capability_convertToJSON(OpenAPI_atsss_capability_t *atsss_capability); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_atsss_capability_H_ */ + diff --git a/lib/sbi/openapi/model/ausf_info.c b/lib/sbi/openapi/model/ausf_info.c new file mode 100644 index 000000000..0105f1d5a --- /dev/null +++ b/lib/sbi/openapi/model/ausf_info.c @@ -0,0 +1,164 @@ + +#include +#include +#include +#include "ausf_info.h" + +OpenAPI_ausf_info_t *OpenAPI_ausf_info_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *routing_indicators + ) +{ + OpenAPI_ausf_info_t *ausf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_ausf_info_t)); + if (!ausf_info_local_var) { + return NULL; + } + ausf_info_local_var->group_id = group_id; + ausf_info_local_var->supi_ranges = supi_ranges; + ausf_info_local_var->routing_indicators = routing_indicators; + + return ausf_info_local_var; +} + +void OpenAPI_ausf_info_free(OpenAPI_ausf_info_t *ausf_info) +{ + if (NULL == ausf_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ausf_info->group_id); + OpenAPI_list_for_each(ausf_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(ausf_info->supi_ranges); + OpenAPI_list_for_each(ausf_info->routing_indicators, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ausf_info->routing_indicators); + ogs_free(ausf_info); +} + +cJSON *OpenAPI_ausf_info_convertToJSON(OpenAPI_ausf_info_t *ausf_info) +{ + cJSON *item = NULL; + + if (ausf_info == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [AusfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ausf_info->group_id) { + if (cJSON_AddStringToObject(item, "groupId", ausf_info->group_id) == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (ausf_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *supi_ranges_node; + if (ausf_info->supi_ranges) { + OpenAPI_list_for_each(ausf_info->supi_ranges, supi_ranges_node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(supi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + } + + if (ausf_info->routing_indicators) { + cJSON *routing_indicators = cJSON_AddArrayToObject(item, "routingIndicators"); + if (routing_indicators == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [routing_indicators]"); + goto end; + } + + OpenAPI_lnode_t *routing_indicators_node; + OpenAPI_list_for_each(ausf_info->routing_indicators, routing_indicators_node) { + if (cJSON_AddStringToObject(routing_indicators, "", (char*)routing_indicators_node->data) == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [routing_indicators]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_ausf_info_t *OpenAPI_ausf_info_parseFromJSON(cJSON *ausf_infoJSON) +{ + OpenAPI_ausf_info_t *ausf_info_local_var = NULL; + cJSON *group_id = cJSON_GetObjectItemCaseSensitive(ausf_infoJSON, "groupId"); + + if (group_id) { + if (!cJSON_IsString(group_id)) { + ogs_error("OpenAPI_ausf_info_parseFromJSON() failed [group_id]"); + goto end; + } + } + + cJSON *supi_ranges = cJSON_GetObjectItemCaseSensitive(ausf_infoJSON, "supiRanges"); + + OpenAPI_list_t *supi_rangesList; + if (supi_ranges) { + cJSON *supi_ranges_local_nonprimitive; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_ausf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local_nonprimitive, supi_ranges ) { + if (!cJSON_IsObject(supi_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_ausf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local_nonprimitive); + + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + cJSON *routing_indicators = cJSON_GetObjectItemCaseSensitive(ausf_infoJSON, "routingIndicators"); + + OpenAPI_list_t *routing_indicatorsList; + if (routing_indicators) { + cJSON *routing_indicators_local; + if (!cJSON_IsArray(routing_indicators)) { + ogs_error("OpenAPI_ausf_info_parseFromJSON() failed [routing_indicators]"); + goto end; + } + routing_indicatorsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(routing_indicators_local, routing_indicators) { + if (!cJSON_IsString(routing_indicators_local)) { + ogs_error("OpenAPI_ausf_info_parseFromJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_add(routing_indicatorsList, ogs_strdup(routing_indicators_local->valuestring)); + } + } + + ausf_info_local_var = OpenAPI_ausf_info_create ( + group_id ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + routing_indicators ? routing_indicatorsList : NULL + ); + + return ausf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/ausf_info.h b/lib/sbi/openapi/model/ausf_info.h new file mode 100644 index 000000000..f06693787 --- /dev/null +++ b/lib/sbi/openapi/model/ausf_info.h @@ -0,0 +1,42 @@ +/* + * ausf_info.h + * + * + */ + +#ifndef _OpenAPI_ausf_info_H_ +#define _OpenAPI_ausf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ausf_info_s OpenAPI_ausf_info_t; +typedef struct OpenAPI_ausf_info_s { + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *routing_indicators; +} OpenAPI_ausf_info_t; + +OpenAPI_ausf_info_t *OpenAPI_ausf_info_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *routing_indicators + ); +void OpenAPI_ausf_info_free(OpenAPI_ausf_info_t *ausf_info); +OpenAPI_ausf_info_t *OpenAPI_ausf_info_parseFromJSON(cJSON *ausf_infoJSON); +cJSON *OpenAPI_ausf_info_convertToJSON(OpenAPI_ausf_info_t *ausf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ausf_info_H_ */ + diff --git a/lib/sbi/openapi/model/bsf_info.c b/lib/sbi/openapi/model/bsf_info.c new file mode 100644 index 000000000..ace4c42a8 --- /dev/null +++ b/lib/sbi/openapi/model/bsf_info.c @@ -0,0 +1,237 @@ + +#include +#include +#include +#include "bsf_info.h" + +OpenAPI_bsf_info_t *OpenAPI_bsf_info_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *ip_domain_list, + OpenAPI_list_t *ipv4_address_ranges, + OpenAPI_list_t *ipv6_prefix_ranges + ) +{ + OpenAPI_bsf_info_t *bsf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_bsf_info_t)); + if (!bsf_info_local_var) { + return NULL; + } + bsf_info_local_var->dnn_list = dnn_list; + bsf_info_local_var->ip_domain_list = ip_domain_list; + bsf_info_local_var->ipv4_address_ranges = ipv4_address_ranges; + bsf_info_local_var->ipv6_prefix_ranges = ipv6_prefix_ranges; + + return bsf_info_local_var; +} + +void OpenAPI_bsf_info_free(OpenAPI_bsf_info_t *bsf_info) +{ + if (NULL == bsf_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(bsf_info->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(bsf_info->dnn_list); + OpenAPI_list_for_each(bsf_info->ip_domain_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(bsf_info->ip_domain_list); + OpenAPI_list_for_each(bsf_info->ipv4_address_ranges, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(bsf_info->ipv4_address_ranges); + OpenAPI_list_for_each(bsf_info->ipv6_prefix_ranges, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(bsf_info->ipv6_prefix_ranges); + ogs_free(bsf_info); +} + +cJSON *OpenAPI_bsf_info_convertToJSON(OpenAPI_bsf_info_t *bsf_info) +{ + cJSON *item = NULL; + + if (bsf_info == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [BsfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (bsf_info->dnn_list) { + cJSON *dnn_list = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_list == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [dnn_list]"); + goto end; + } + + OpenAPI_lnode_t *dnn_list_node; + OpenAPI_list_for_each(bsf_info->dnn_list, dnn_list_node) { + if (cJSON_AddStringToObject(dnn_list, "", (char*)dnn_list_node->data) == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (bsf_info->ip_domain_list) { + cJSON *ip_domain_list = cJSON_AddArrayToObject(item, "ipDomainList"); + if (ip_domain_list == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [ip_domain_list]"); + goto end; + } + + OpenAPI_lnode_t *ip_domain_list_node; + OpenAPI_list_for_each(bsf_info->ip_domain_list, ip_domain_list_node) { + if (cJSON_AddStringToObject(ip_domain_list, "", (char*)ip_domain_list_node->data) == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [ip_domain_list]"); + goto end; + } + } + } + + if (bsf_info->ipv4_address_ranges) { + cJSON *ipv4_address_rangesList = cJSON_AddArrayToObject(item, "ipv4AddressRanges"); + if (ipv4_address_rangesList == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [ipv4_address_ranges]"); + goto end; + } + + OpenAPI_lnode_t *ipv4_address_ranges_node; + if (bsf_info->ipv4_address_ranges) { + OpenAPI_list_for_each(bsf_info->ipv4_address_ranges, ipv4_address_ranges_node) { + cJSON *itemLocal = OpenAPI_ipv4_address_range_convertToJSON(ipv4_address_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [ipv4_address_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv4_address_rangesList, itemLocal); + } + } + } + + if (bsf_info->ipv6_prefix_ranges) { + cJSON *ipv6_prefix_rangesList = cJSON_AddArrayToObject(item, "ipv6PrefixRanges"); + if (ipv6_prefix_rangesList == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + + OpenAPI_lnode_t *ipv6_prefix_ranges_node; + if (bsf_info->ipv6_prefix_ranges) { + OpenAPI_list_for_each(bsf_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_bsf_info_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv6_prefix_rangesList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_bsf_info_t *OpenAPI_bsf_info_parseFromJSON(cJSON *bsf_infoJSON) +{ + OpenAPI_bsf_info_t *bsf_info_local_var = NULL; + cJSON *dnn_list = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "dnnList"); + + OpenAPI_list_t *dnn_listList; + if (dnn_list) { + cJSON *dnn_list_local; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [dnn_list]"); + goto end; + } + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + cJSON *ip_domain_list = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "ipDomainList"); + + OpenAPI_list_t *ip_domain_listList; + if (ip_domain_list) { + cJSON *ip_domain_list_local; + if (!cJSON_IsArray(ip_domain_list)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [ip_domain_list]"); + goto end; + } + ip_domain_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ip_domain_list_local, ip_domain_list) { + if (!cJSON_IsString(ip_domain_list_local)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [ip_domain_list]"); + goto end; + } + OpenAPI_list_add(ip_domain_listList, ogs_strdup(ip_domain_list_local->valuestring)); + } + } + + cJSON *ipv4_address_ranges = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "ipv4AddressRanges"); + + OpenAPI_list_t *ipv4_address_rangesList; + if (ipv4_address_ranges) { + cJSON *ipv4_address_ranges_local_nonprimitive; + if (!cJSON_IsArray(ipv4_address_ranges)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [ipv4_address_ranges]"); + goto end; + } + + ipv4_address_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_address_ranges_local_nonprimitive, ipv4_address_ranges ) { + if (!cJSON_IsObject(ipv4_address_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [ipv4_address_ranges]"); + goto end; + } + OpenAPI_ipv4_address_range_t *ipv4_address_rangesItem = OpenAPI_ipv4_address_range_parseFromJSON(ipv4_address_ranges_local_nonprimitive); + + OpenAPI_list_add(ipv4_address_rangesList, ipv4_address_rangesItem); + } + } + + cJSON *ipv6_prefix_ranges = cJSON_GetObjectItemCaseSensitive(bsf_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_bsf_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_bsf_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); + } + } + + bsf_info_local_var = OpenAPI_bsf_info_create ( + dnn_list ? dnn_listList : NULL, + ip_domain_list ? ip_domain_listList : NULL, + ipv4_address_ranges ? ipv4_address_rangesList : NULL, + ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL + ); + + return bsf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/bsf_info.h b/lib/sbi/openapi/model/bsf_info.h new file mode 100644 index 000000000..516d2bdfd --- /dev/null +++ b/lib/sbi/openapi/model/bsf_info.h @@ -0,0 +1,45 @@ +/* + * bsf_info.h + * + * + */ + +#ifndef _OpenAPI_bsf_info_H_ +#define _OpenAPI_bsf_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" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_bsf_info_s OpenAPI_bsf_info_t; +typedef struct OpenAPI_bsf_info_s { + OpenAPI_list_t *dnn_list; + OpenAPI_list_t *ip_domain_list; + OpenAPI_list_t *ipv4_address_ranges; + OpenAPI_list_t *ipv6_prefix_ranges; +} OpenAPI_bsf_info_t; + +OpenAPI_bsf_info_t *OpenAPI_bsf_info_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *ip_domain_list, + OpenAPI_list_t *ipv4_address_ranges, + OpenAPI_list_t *ipv6_prefix_ranges + ); +void OpenAPI_bsf_info_free(OpenAPI_bsf_info_t *bsf_info); +OpenAPI_bsf_info_t *OpenAPI_bsf_info_parseFromJSON(cJSON *bsf_infoJSON); +cJSON *OpenAPI_bsf_info_convertToJSON(OpenAPI_bsf_info_t *bsf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_bsf_info_H_ */ + diff --git a/lib/sbi/openapi/model/change_item.c b/lib/sbi/openapi/model/change_item.c new file mode 100644 index 000000000..e306a893c --- /dev/null +++ b/lib/sbi/openapi/model/change_item.c @@ -0,0 +1,162 @@ + +#include +#include +#include +#include "change_item.h" + +OpenAPI_change_item_t *OpenAPI_change_item_create( + OpenAPI_change_type_e op, + char *path, + char *from, + char *orig_value, + char *new_value + ) +{ + OpenAPI_change_item_t *change_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_change_item_t)); + if (!change_item_local_var) { + return NULL; + } + change_item_local_var->op = op; + change_item_local_var->path = path; + change_item_local_var->from = from; + change_item_local_var->orig_value = orig_value; + change_item_local_var->new_value = new_value; + + return change_item_local_var; +} + +void OpenAPI_change_item_free(OpenAPI_change_item_t *change_item) +{ + if (NULL == change_item) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(change_item->path); + ogs_free(change_item->from); + ogs_free(change_item->orig_value); + ogs_free(change_item->new_value); + ogs_free(change_item); +} + +cJSON *OpenAPI_change_item_convertToJSON(OpenAPI_change_item_t *change_item) +{ + cJSON *item = NULL; + + if (change_item == NULL) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [ChangeItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!change_item->op) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [op]"); + goto end; + } + if (cJSON_AddStringToObject(item, "op", OpenAPI_change_type_ToString(change_item->op)) == NULL) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [op]"); + goto end; + } + + if (!change_item->path) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [path]"); + goto end; + } + if (cJSON_AddStringToObject(item, "path", change_item->path) == NULL) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [path]"); + goto end; + } + + if (change_item->from) { + if (cJSON_AddStringToObject(item, "from", change_item->from) == NULL) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [from]"); + goto end; + } + } + + if (change_item->orig_value) { + if (cJSON_AddStringToObject(item, "origValue", change_item->orig_value) == NULL) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [orig_value]"); + goto end; + } + } + + if (change_item->new_value) { + if (cJSON_AddStringToObject(item, "newValue", change_item->new_value) == NULL) { + ogs_error("OpenAPI_change_item_convertToJSON() failed [new_value]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_change_item_t *OpenAPI_change_item_parseFromJSON(cJSON *change_itemJSON) +{ + OpenAPI_change_item_t *change_item_local_var = NULL; + cJSON *op = cJSON_GetObjectItemCaseSensitive(change_itemJSON, "op"); + if (!op) { + ogs_error("OpenAPI_change_item_parseFromJSON() failed [op]"); + goto end; + } + + OpenAPI_change_type_e opVariable; + + if (!cJSON_IsString(op)) { + ogs_error("OpenAPI_change_item_parseFromJSON() failed [op]"); + goto end; + } + opVariable = OpenAPI_change_type_FromString(op->valuestring); + + cJSON *path = cJSON_GetObjectItemCaseSensitive(change_itemJSON, "path"); + if (!path) { + ogs_error("OpenAPI_change_item_parseFromJSON() failed [path]"); + goto end; + } + + + if (!cJSON_IsString(path)) { + ogs_error("OpenAPI_change_item_parseFromJSON() failed [path]"); + goto end; + } + + cJSON *from = cJSON_GetObjectItemCaseSensitive(change_itemJSON, "from"); + + if (from) { + if (!cJSON_IsString(from)) { + ogs_error("OpenAPI_change_item_parseFromJSON() failed [from]"); + goto end; + } + } + + cJSON *orig_value = cJSON_GetObjectItemCaseSensitive(change_itemJSON, "origValue"); + + if (orig_value) { + if (!cJSON_IsString(orig_value)) { + ogs_error("OpenAPI_change_item_parseFromJSON() failed [orig_value]"); + goto end; + } + } + + cJSON *new_value = cJSON_GetObjectItemCaseSensitive(change_itemJSON, "newValue"); + + if (new_value) { + if (!cJSON_IsString(new_value)) { + ogs_error("OpenAPI_change_item_parseFromJSON() failed [new_value]"); + goto end; + } + } + + change_item_local_var = OpenAPI_change_item_create ( + opVariable, + ogs_strdup(path->valuestring), + from ? ogs_strdup(from->valuestring) : NULL, + orig_value ? ogs_strdup(orig_value->valuestring) : NULL, + new_value ? ogs_strdup(new_value->valuestring) : NULL + ); + + return change_item_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/change_item.h b/lib/sbi/openapi/model/change_item.h new file mode 100644 index 000000000..fd99a856d --- /dev/null +++ b/lib/sbi/openapi/model/change_item.h @@ -0,0 +1,46 @@ +/* + * change_item.h + * + * + */ + +#ifndef _OpenAPI_change_item_H_ +#define _OpenAPI_change_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "change_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_change_item_s OpenAPI_change_item_t; +typedef struct OpenAPI_change_item_s { + OpenAPI_change_type_e op; + char *path; + char *from; + char *orig_value; + char *new_value; +} OpenAPI_change_item_t; + +OpenAPI_change_item_t *OpenAPI_change_item_create( + OpenAPI_change_type_e op, + char *path, + char *from, + char *orig_value, + char *new_value + ); +void OpenAPI_change_item_free(OpenAPI_change_item_t *change_item); +OpenAPI_change_item_t *OpenAPI_change_item_parseFromJSON(cJSON *change_itemJSON); +cJSON *OpenAPI_change_item_convertToJSON(OpenAPI_change_item_t *change_item); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_change_item_H_ */ + diff --git a/lib/sbi/openapi/model/change_type.c b/lib/sbi/openapi/model/change_type.c new file mode 100644 index 000000000..96fc9a99e --- /dev/null +++ b/lib/sbi/openapi/model/change_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "change_type.h" + +char* OpenAPI_change_type_ToString(OpenAPI_change_type_e change_type) +{ + const char *change_typeArray[] = { "NULL", "ADD", "MOVE", "_REMOVE", "REPLACE" }; + size_t sizeofArray = sizeof(change_typeArray) / sizeof(change_typeArray[0]); + if (change_type < sizeofArray) + return (char *)change_typeArray[change_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_change_type_e OpenAPI_change_type_FromString(char* change_type) +{ + int stringToReturn = 0; + const char *change_typeArray[] = { "NULL", "ADD", "MOVE", "_REMOVE", "REPLACE" }; + size_t sizeofArray = sizeof(change_typeArray) / sizeof(change_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(change_type, change_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/change_type.h b/lib/sbi/openapi/model/change_type.h new file mode 100644 index 000000000..b5d8656bf --- /dev/null +++ b/lib/sbi/openapi/model/change_type.h @@ -0,0 +1,31 @@ +/* + * change_type.h + * + * + */ + +#ifndef _OpenAPI_change_type_H_ +#define _OpenAPI_change_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_change_type_NULL = 0, OpenAPI_change_type_ADD, OpenAPI_change_type_MOVE, OpenAPI_change_type__REMOVE, OpenAPI_change_type_REPLACE } OpenAPI_change_type_e; + +char* OpenAPI_change_type_ToString(OpenAPI_change_type_e change_type); + +OpenAPI_change_type_e OpenAPI_change_type_FromString(char* change_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_change_type_H_ */ + diff --git a/lib/sbi/openapi/model/chf_info.c b/lib/sbi/openapi/model/chf_info.c new file mode 100644 index 000000000..920f592df --- /dev/null +++ b/lib/sbi/openapi/model/chf_info.c @@ -0,0 +1,201 @@ + +#include +#include +#include +#include "chf_info.h" + +OpenAPI_chf_info_t *OpenAPI_chf_info_create( + OpenAPI_list_t *supi_range_list, + OpenAPI_list_t *gpsi_range_list, + OpenAPI_list_t *plmn_range_list + ) +{ + OpenAPI_chf_info_t *chf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_chf_info_t)); + if (!chf_info_local_var) { + return NULL; + } + chf_info_local_var->supi_range_list = supi_range_list; + chf_info_local_var->gpsi_range_list = gpsi_range_list; + chf_info_local_var->plmn_range_list = plmn_range_list; + + return chf_info_local_var; +} + +void OpenAPI_chf_info_free(OpenAPI_chf_info_t *chf_info) +{ + if (NULL == chf_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(chf_info->supi_range_list, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(chf_info->supi_range_list); + OpenAPI_list_for_each(chf_info->gpsi_range_list, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(chf_info->gpsi_range_list); + OpenAPI_list_for_each(chf_info->plmn_range_list, node) { + OpenAPI_plmn_range_free(node->data); + } + OpenAPI_list_free(chf_info->plmn_range_list); + ogs_free(chf_info); +} + +cJSON *OpenAPI_chf_info_convertToJSON(OpenAPI_chf_info_t *chf_info) +{ + cJSON *item = NULL; + + if (chf_info == NULL) { + ogs_error("OpenAPI_chf_info_convertToJSON() failed [ChfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (chf_info->supi_range_list) { + cJSON *supi_range_listList = cJSON_AddArrayToObject(item, "supiRangeList"); + if (supi_range_listList == NULL) { + ogs_error("OpenAPI_chf_info_convertToJSON() failed [supi_range_list]"); + goto end; + } + + OpenAPI_lnode_t *supi_range_list_node; + if (chf_info->supi_range_list) { + OpenAPI_list_for_each(chf_info->supi_range_list, supi_range_list_node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(supi_range_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_chf_info_convertToJSON() failed [supi_range_list]"); + goto end; + } + cJSON_AddItemToArray(supi_range_listList, itemLocal); + } + } + } + + if (chf_info->gpsi_range_list) { + cJSON *gpsi_range_listList = cJSON_AddArrayToObject(item, "gpsiRangeList"); + if (gpsi_range_listList == NULL) { + ogs_error("OpenAPI_chf_info_convertToJSON() failed [gpsi_range_list]"); + goto end; + } + + OpenAPI_lnode_t *gpsi_range_list_node; + if (chf_info->gpsi_range_list) { + OpenAPI_list_for_each(chf_info->gpsi_range_list, gpsi_range_list_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(gpsi_range_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_chf_info_convertToJSON() failed [gpsi_range_list]"); + goto end; + } + cJSON_AddItemToArray(gpsi_range_listList, itemLocal); + } + } + } + + if (chf_info->plmn_range_list) { + cJSON *plmn_range_listList = cJSON_AddArrayToObject(item, "plmnRangeList"); + if (plmn_range_listList == NULL) { + ogs_error("OpenAPI_chf_info_convertToJSON() failed [plmn_range_list]"); + goto end; + } + + OpenAPI_lnode_t *plmn_range_list_node; + if (chf_info->plmn_range_list) { + OpenAPI_list_for_each(chf_info->plmn_range_list, plmn_range_list_node) { + cJSON *itemLocal = OpenAPI_plmn_range_convertToJSON(plmn_range_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_chf_info_convertToJSON() failed [plmn_range_list]"); + goto end; + } + cJSON_AddItemToArray(plmn_range_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_chf_info_t *OpenAPI_chf_info_parseFromJSON(cJSON *chf_infoJSON) +{ + OpenAPI_chf_info_t *chf_info_local_var = NULL; + cJSON *supi_range_list = cJSON_GetObjectItemCaseSensitive(chf_infoJSON, "supiRangeList"); + + OpenAPI_list_t *supi_range_listList; + if (supi_range_list) { + cJSON *supi_range_list_local_nonprimitive; + if (!cJSON_IsArray(supi_range_list)) { + ogs_error("OpenAPI_chf_info_parseFromJSON() failed [supi_range_list]"); + goto end; + } + + supi_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_range_list_local_nonprimitive, supi_range_list ) { + if (!cJSON_IsObject(supi_range_list_local_nonprimitive)) { + ogs_error("OpenAPI_chf_info_parseFromJSON() failed [supi_range_list]"); + goto end; + } + OpenAPI_supi_range_t *supi_range_listItem = OpenAPI_supi_range_parseFromJSON(supi_range_list_local_nonprimitive); + + OpenAPI_list_add(supi_range_listList, supi_range_listItem); + } + } + + cJSON *gpsi_range_list = cJSON_GetObjectItemCaseSensitive(chf_infoJSON, "gpsiRangeList"); + + OpenAPI_list_t *gpsi_range_listList; + if (gpsi_range_list) { + cJSON *gpsi_range_list_local_nonprimitive; + if (!cJSON_IsArray(gpsi_range_list)) { + ogs_error("OpenAPI_chf_info_parseFromJSON() failed [gpsi_range_list]"); + goto end; + } + + gpsi_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_range_list_local_nonprimitive, gpsi_range_list ) { + if (!cJSON_IsObject(gpsi_range_list_local_nonprimitive)) { + ogs_error("OpenAPI_chf_info_parseFromJSON() failed [gpsi_range_list]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_range_listItem = OpenAPI_identity_range_parseFromJSON(gpsi_range_list_local_nonprimitive); + + OpenAPI_list_add(gpsi_range_listList, gpsi_range_listItem); + } + } + + cJSON *plmn_range_list = cJSON_GetObjectItemCaseSensitive(chf_infoJSON, "plmnRangeList"); + + OpenAPI_list_t *plmn_range_listList; + if (plmn_range_list) { + cJSON *plmn_range_list_local_nonprimitive; + if (!cJSON_IsArray(plmn_range_list)) { + ogs_error("OpenAPI_chf_info_parseFromJSON() failed [plmn_range_list]"); + goto end; + } + + plmn_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(plmn_range_list_local_nonprimitive, plmn_range_list ) { + if (!cJSON_IsObject(plmn_range_list_local_nonprimitive)) { + ogs_error("OpenAPI_chf_info_parseFromJSON() failed [plmn_range_list]"); + goto end; + } + OpenAPI_plmn_range_t *plmn_range_listItem = OpenAPI_plmn_range_parseFromJSON(plmn_range_list_local_nonprimitive); + + OpenAPI_list_add(plmn_range_listList, plmn_range_listItem); + } + } + + chf_info_local_var = OpenAPI_chf_info_create ( + supi_range_list ? supi_range_listList : NULL, + gpsi_range_list ? gpsi_range_listList : NULL, + plmn_range_list ? plmn_range_listList : NULL + ); + + return chf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/chf_info.h b/lib/sbi/openapi/model/chf_info.h new file mode 100644 index 000000000..257017137 --- /dev/null +++ b/lib/sbi/openapi/model/chf_info.h @@ -0,0 +1,44 @@ +/* + * chf_info.h + * + * + */ + +#ifndef _OpenAPI_chf_info_H_ +#define _OpenAPI_chf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "plmn_range.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_chf_info_s OpenAPI_chf_info_t; +typedef struct OpenAPI_chf_info_s { + OpenAPI_list_t *supi_range_list; + OpenAPI_list_t *gpsi_range_list; + OpenAPI_list_t *plmn_range_list; +} OpenAPI_chf_info_t; + +OpenAPI_chf_info_t *OpenAPI_chf_info_create( + OpenAPI_list_t *supi_range_list, + OpenAPI_list_t *gpsi_range_list, + OpenAPI_list_t *plmn_range_list + ); +void OpenAPI_chf_info_free(OpenAPI_chf_info_t *chf_info); +OpenAPI_chf_info_t *OpenAPI_chf_info_parseFromJSON(cJSON *chf_infoJSON); +cJSON *OpenAPI_chf_info_convertToJSON(OpenAPI_chf_info_t *chf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_chf_info_H_ */ + diff --git a/lib/sbi/openapi/model/chf_service_info.c b/lib/sbi/openapi/model/chf_service_info.c new file mode 100644 index 000000000..e9610b519 --- /dev/null +++ b/lib/sbi/openapi/model/chf_service_info.c @@ -0,0 +1,91 @@ + +#include +#include +#include +#include "chf_service_info.h" + +OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_create( + char *primary_chf_service_instance, + char *secondary_chf_service_instance + ) +{ + OpenAPI_chf_service_info_t *chf_service_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_chf_service_info_t)); + if (!chf_service_info_local_var) { + return NULL; + } + chf_service_info_local_var->primary_chf_service_instance = primary_chf_service_instance; + chf_service_info_local_var->secondary_chf_service_instance = secondary_chf_service_instance; + + return chf_service_info_local_var; +} + +void OpenAPI_chf_service_info_free(OpenAPI_chf_service_info_t *chf_service_info) +{ + if (NULL == chf_service_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(chf_service_info->primary_chf_service_instance); + ogs_free(chf_service_info->secondary_chf_service_instance); + ogs_free(chf_service_info); +} + +cJSON *OpenAPI_chf_service_info_convertToJSON(OpenAPI_chf_service_info_t *chf_service_info) +{ + cJSON *item = NULL; + + if (chf_service_info == NULL) { + ogs_error("OpenAPI_chf_service_info_convertToJSON() failed [ChfServiceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (chf_service_info->primary_chf_service_instance) { + if (cJSON_AddStringToObject(item, "primaryChfServiceInstance", chf_service_info->primary_chf_service_instance) == NULL) { + ogs_error("OpenAPI_chf_service_info_convertToJSON() failed [primary_chf_service_instance]"); + goto end; + } + } + + if (chf_service_info->secondary_chf_service_instance) { + if (cJSON_AddStringToObject(item, "secondaryChfServiceInstance", chf_service_info->secondary_chf_service_instance) == NULL) { + ogs_error("OpenAPI_chf_service_info_convertToJSON() failed [secondary_chf_service_instance]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_parseFromJSON(cJSON *chf_service_infoJSON) +{ + OpenAPI_chf_service_info_t *chf_service_info_local_var = NULL; + cJSON *primary_chf_service_instance = cJSON_GetObjectItemCaseSensitive(chf_service_infoJSON, "primaryChfServiceInstance"); + + if (primary_chf_service_instance) { + if (!cJSON_IsString(primary_chf_service_instance)) { + ogs_error("OpenAPI_chf_service_info_parseFromJSON() failed [primary_chf_service_instance]"); + goto end; + } + } + + cJSON *secondary_chf_service_instance = cJSON_GetObjectItemCaseSensitive(chf_service_infoJSON, "secondaryChfServiceInstance"); + + if (secondary_chf_service_instance) { + if (!cJSON_IsString(secondary_chf_service_instance)) { + ogs_error("OpenAPI_chf_service_info_parseFromJSON() failed [secondary_chf_service_instance]"); + goto end; + } + } + + chf_service_info_local_var = OpenAPI_chf_service_info_create ( + primary_chf_service_instance ? ogs_strdup(primary_chf_service_instance->valuestring) : NULL, + secondary_chf_service_instance ? ogs_strdup(secondary_chf_service_instance->valuestring) : NULL + ); + + return chf_service_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/chf_service_info.h b/lib/sbi/openapi/model/chf_service_info.h new file mode 100644 index 000000000..af8558b71 --- /dev/null +++ b/lib/sbi/openapi/model/chf_service_info.h @@ -0,0 +1,39 @@ +/* + * chf_service_info.h + * + * + */ + +#ifndef _OpenAPI_chf_service_info_H_ +#define _OpenAPI_chf_service_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_chf_service_info_s OpenAPI_chf_service_info_t; +typedef struct OpenAPI_chf_service_info_s { + char *primary_chf_service_instance; + char *secondary_chf_service_instance; +} OpenAPI_chf_service_info_t; + +OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_create( + char *primary_chf_service_instance, + char *secondary_chf_service_instance + ); +void OpenAPI_chf_service_info_free(OpenAPI_chf_service_info_t *chf_service_info); +OpenAPI_chf_service_info_t *OpenAPI_chf_service_info_parseFromJSON(cJSON *chf_service_infoJSON); +cJSON *OpenAPI_chf_service_info_convertToJSON(OpenAPI_chf_service_info_t *chf_service_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_chf_service_info_H_ */ + diff --git a/lib/sbi/openapi/model/cnf.c b/lib/sbi/openapi/model/cnf.c new file mode 100644 index 000000000..00b6b8107 --- /dev/null +++ b/lib/sbi/openapi/model/cnf.c @@ -0,0 +1,106 @@ + +#include +#include +#include +#include "cnf.h" + +OpenAPI_cnf_t *OpenAPI_cnf_create( + OpenAPI_list_t *cnf_units + ) +{ + OpenAPI_cnf_t *cnf_local_var = OpenAPI_malloc(sizeof(OpenAPI_cnf_t)); + if (!cnf_local_var) { + return NULL; + } + cnf_local_var->cnf_units = cnf_units; + + return cnf_local_var; +} + +void OpenAPI_cnf_free(OpenAPI_cnf_t *cnf) +{ + if (NULL == cnf) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(cnf->cnf_units, node) { + OpenAPI_cnf_unit_free(node->data); + } + OpenAPI_list_free(cnf->cnf_units); + ogs_free(cnf); +} + +cJSON *OpenAPI_cnf_convertToJSON(OpenAPI_cnf_t *cnf) +{ + cJSON *item = NULL; + + if (cnf == NULL) { + ogs_error("OpenAPI_cnf_convertToJSON() failed [Cnf]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!cnf->cnf_units) { + ogs_error("OpenAPI_cnf_convertToJSON() failed [cnf_units]"); + goto end; + } + cJSON *cnf_unitsList = cJSON_AddArrayToObject(item, "cnfUnits"); + if (cnf_unitsList == NULL) { + ogs_error("OpenAPI_cnf_convertToJSON() failed [cnf_units]"); + goto end; + } + + OpenAPI_lnode_t *cnf_units_node; + if (cnf->cnf_units) { + OpenAPI_list_for_each(cnf->cnf_units, cnf_units_node) { + cJSON *itemLocal = OpenAPI_cnf_unit_convertToJSON(cnf_units_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_cnf_convertToJSON() failed [cnf_units]"); + goto end; + } + cJSON_AddItemToArray(cnf_unitsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_cnf_t *OpenAPI_cnf_parseFromJSON(cJSON *cnfJSON) +{ + OpenAPI_cnf_t *cnf_local_var = NULL; + cJSON *cnf_units = cJSON_GetObjectItemCaseSensitive(cnfJSON, "cnfUnits"); + if (!cnf_units) { + ogs_error("OpenAPI_cnf_parseFromJSON() failed [cnf_units]"); + goto end; + } + + OpenAPI_list_t *cnf_unitsList; + + cJSON *cnf_units_local_nonprimitive; + if (!cJSON_IsArray(cnf_units)) { + ogs_error("OpenAPI_cnf_parseFromJSON() failed [cnf_units]"); + goto end; + } + + cnf_unitsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cnf_units_local_nonprimitive, cnf_units ) { + if (!cJSON_IsObject(cnf_units_local_nonprimitive)) { + ogs_error("OpenAPI_cnf_parseFromJSON() failed [cnf_units]"); + goto end; + } + OpenAPI_cnf_unit_t *cnf_unitsItem = OpenAPI_cnf_unit_parseFromJSON(cnf_units_local_nonprimitive); + + OpenAPI_list_add(cnf_unitsList, cnf_unitsItem); + } + + cnf_local_var = OpenAPI_cnf_create ( + cnf_unitsList + ); + + return cnf_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/cnf.h b/lib/sbi/openapi/model/cnf.h new file mode 100644 index 000000000..63b25213c --- /dev/null +++ b/lib/sbi/openapi/model/cnf.h @@ -0,0 +1,38 @@ +/* + * cnf.h + * + * + */ + +#ifndef _OpenAPI_cnf_H_ +#define _OpenAPI_cnf_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cnf_unit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_cnf_s OpenAPI_cnf_t; +typedef struct OpenAPI_cnf_s { + OpenAPI_list_t *cnf_units; +} OpenAPI_cnf_t; + +OpenAPI_cnf_t *OpenAPI_cnf_create( + OpenAPI_list_t *cnf_units + ); +void OpenAPI_cnf_free(OpenAPI_cnf_t *cnf); +OpenAPI_cnf_t *OpenAPI_cnf_parseFromJSON(cJSON *cnfJSON); +cJSON *OpenAPI_cnf_convertToJSON(OpenAPI_cnf_t *cnf); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_cnf_H_ */ + diff --git a/lib/sbi/openapi/model/cnf_unit.c b/lib/sbi/openapi/model/cnf_unit.c new file mode 100644 index 000000000..c4ef1de33 --- /dev/null +++ b/lib/sbi/openapi/model/cnf_unit.c @@ -0,0 +1,106 @@ + +#include +#include +#include +#include "cnf_unit.h" + +OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_create( + OpenAPI_list_t *cnf_unit + ) +{ + OpenAPI_cnf_unit_t *cnf_unit_local_var = OpenAPI_malloc(sizeof(OpenAPI_cnf_unit_t)); + if (!cnf_unit_local_var) { + return NULL; + } + cnf_unit_local_var->cnf_unit = cnf_unit; + + return cnf_unit_local_var; +} + +void OpenAPI_cnf_unit_free(OpenAPI_cnf_unit_t *cnf_unit) +{ + if (NULL == cnf_unit) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(cnf_unit->cnf_unit, node) { + OpenAPI_atom_free(node->data); + } + OpenAPI_list_free(cnf_unit->cnf_unit); + ogs_free(cnf_unit); +} + +cJSON *OpenAPI_cnf_unit_convertToJSON(OpenAPI_cnf_unit_t *cnf_unit) +{ + cJSON *item = NULL; + + if (cnf_unit == NULL) { + ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [CnfUnit]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!cnf_unit->cnf_unit) { + ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [cnf_unit]"); + goto end; + } + cJSON *cnf_unitList = cJSON_AddArrayToObject(item, "cnfUnit"); + if (cnf_unitList == NULL) { + ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [cnf_unit]"); + goto end; + } + + OpenAPI_lnode_t *cnf_unit_node; + if (cnf_unit->cnf_unit) { + OpenAPI_list_for_each(cnf_unit->cnf_unit, cnf_unit_node) { + cJSON *itemLocal = OpenAPI_atom_convertToJSON(cnf_unit_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [cnf_unit]"); + goto end; + } + cJSON_AddItemToArray(cnf_unitList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_parseFromJSON(cJSON *cnf_unitJSON) +{ + OpenAPI_cnf_unit_t *cnf_unit_local_var = NULL; + cJSON *cnf_unit = cJSON_GetObjectItemCaseSensitive(cnf_unitJSON, "cnfUnit"); + if (!cnf_unit) { + ogs_error("OpenAPI_cnf_unit_parseFromJSON() failed [cnf_unit]"); + goto end; + } + + OpenAPI_list_t *cnf_unitList; + + cJSON *cnf_unit_local_nonprimitive; + if (!cJSON_IsArray(cnf_unit)) { + ogs_error("OpenAPI_cnf_unit_parseFromJSON() failed [cnf_unit]"); + goto end; + } + + cnf_unitList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cnf_unit_local_nonprimitive, cnf_unit ) { + if (!cJSON_IsObject(cnf_unit_local_nonprimitive)) { + ogs_error("OpenAPI_cnf_unit_parseFromJSON() failed [cnf_unit]"); + goto end; + } + OpenAPI_atom_t *cnf_unitItem = OpenAPI_atom_parseFromJSON(cnf_unit_local_nonprimitive); + + OpenAPI_list_add(cnf_unitList, cnf_unitItem); + } + + cnf_unit_local_var = OpenAPI_cnf_unit_create ( + cnf_unitList + ); + + return cnf_unit_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/cnf_unit.h b/lib/sbi/openapi/model/cnf_unit.h new file mode 100644 index 000000000..2fbb608ce --- /dev/null +++ b/lib/sbi/openapi/model/cnf_unit.h @@ -0,0 +1,38 @@ +/* + * cnf_unit.h + * + * + */ + +#ifndef _OpenAPI_cnf_unit_H_ +#define _OpenAPI_cnf_unit_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "atom.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_cnf_unit_s OpenAPI_cnf_unit_t; +typedef struct OpenAPI_cnf_unit_s { + OpenAPI_list_t *cnf_unit; +} OpenAPI_cnf_unit_t; + +OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_create( + OpenAPI_list_t *cnf_unit + ); +void OpenAPI_cnf_unit_free(OpenAPI_cnf_unit_t *cnf_unit); +OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_parseFromJSON(cJSON *cnf_unitJSON); +cJSON *OpenAPI_cnf_unit_convertToJSON(OpenAPI_cnf_unit_t *cnf_unit); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_cnf_unit_H_ */ + diff --git a/lib/sbi/openapi/model/complex_query.c b/lib/sbi/openapi/model/complex_query.c new file mode 100644 index 000000000..e065a1a53 --- /dev/null +++ b/lib/sbi/openapi/model/complex_query.c @@ -0,0 +1,161 @@ + +#include +#include +#include +#include "complex_query.h" + +OpenAPI_complex_query_t *OpenAPI_complex_query_create( + OpenAPI_list_t *cnf_units, + OpenAPI_list_t *dnf_units + ) +{ + OpenAPI_complex_query_t *complex_query_local_var = OpenAPI_malloc(sizeof(OpenAPI_complex_query_t)); + if (!complex_query_local_var) { + return NULL; + } + complex_query_local_var->cnf_units = cnf_units; + complex_query_local_var->dnf_units = dnf_units; + + return complex_query_local_var; +} + +void OpenAPI_complex_query_free(OpenAPI_complex_query_t *complex_query) +{ + if (NULL == complex_query) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(complex_query->cnf_units, node) { + OpenAPI_cnf_unit_free(node->data); + } + OpenAPI_list_free(complex_query->cnf_units); + OpenAPI_list_for_each(complex_query->dnf_units, node) { + OpenAPI_dnf_unit_free(node->data); + } + OpenAPI_list_free(complex_query->dnf_units); + ogs_free(complex_query); +} + +cJSON *OpenAPI_complex_query_convertToJSON(OpenAPI_complex_query_t *complex_query) +{ + cJSON *item = NULL; + + if (complex_query == NULL) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed [ComplexQuery]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!complex_query->cnf_units) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed [cnf_units]"); + goto end; + } + cJSON *cnf_unitsList = cJSON_AddArrayToObject(item, "cnfUnits"); + if (cnf_unitsList == NULL) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed [cnf_units]"); + goto end; + } + + OpenAPI_lnode_t *cnf_units_node; + if (complex_query->cnf_units) { + OpenAPI_list_for_each(complex_query->cnf_units, cnf_units_node) { + cJSON *itemLocal = OpenAPI_cnf_unit_convertToJSON(cnf_units_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed [cnf_units]"); + goto end; + } + cJSON_AddItemToArray(cnf_unitsList, itemLocal); + } + } + + if (!complex_query->dnf_units) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed [dnf_units]"); + goto end; + } + cJSON *dnf_unitsList = cJSON_AddArrayToObject(item, "dnfUnits"); + if (dnf_unitsList == NULL) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed [dnf_units]"); + goto end; + } + + OpenAPI_lnode_t *dnf_units_node; + if (complex_query->dnf_units) { + OpenAPI_list_for_each(complex_query->dnf_units, dnf_units_node) { + cJSON *itemLocal = OpenAPI_dnf_unit_convertToJSON(dnf_units_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_complex_query_convertToJSON() failed [dnf_units]"); + goto end; + } + cJSON_AddItemToArray(dnf_unitsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_complex_query_t *OpenAPI_complex_query_parseFromJSON(cJSON *complex_queryJSON) +{ + OpenAPI_complex_query_t *complex_query_local_var = NULL; + cJSON *cnf_units = cJSON_GetObjectItemCaseSensitive(complex_queryJSON, "cnfUnits"); + if (!cnf_units) { + ogs_error("OpenAPI_complex_query_parseFromJSON() failed [cnf_units]"); + goto end; + } + + OpenAPI_list_t *cnf_unitsList; + + cJSON *cnf_units_local_nonprimitive; + if (!cJSON_IsArray(cnf_units)) { + ogs_error("OpenAPI_complex_query_parseFromJSON() failed [cnf_units]"); + goto end; + } + + cnf_unitsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cnf_units_local_nonprimitive, cnf_units ) { + if (!cJSON_IsObject(cnf_units_local_nonprimitive)) { + ogs_error("OpenAPI_complex_query_parseFromJSON() failed [cnf_units]"); + goto end; + } + OpenAPI_cnf_unit_t *cnf_unitsItem = OpenAPI_cnf_unit_parseFromJSON(cnf_units_local_nonprimitive); + + OpenAPI_list_add(cnf_unitsList, cnf_unitsItem); + } + + cJSON *dnf_units = cJSON_GetObjectItemCaseSensitive(complex_queryJSON, "dnfUnits"); + if (!dnf_units) { + ogs_error("OpenAPI_complex_query_parseFromJSON() failed [dnf_units]"); + goto end; + } + + OpenAPI_list_t *dnf_unitsList; + + cJSON *dnf_units_local_nonprimitive; + if (!cJSON_IsArray(dnf_units)) { + ogs_error("OpenAPI_complex_query_parseFromJSON() failed [dnf_units]"); + goto end; + } + + dnf_unitsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnf_units_local_nonprimitive, dnf_units ) { + if (!cJSON_IsObject(dnf_units_local_nonprimitive)) { + ogs_error("OpenAPI_complex_query_parseFromJSON() failed [dnf_units]"); + goto end; + } + OpenAPI_dnf_unit_t *dnf_unitsItem = OpenAPI_dnf_unit_parseFromJSON(dnf_units_local_nonprimitive); + + OpenAPI_list_add(dnf_unitsList, dnf_unitsItem); + } + + complex_query_local_var = OpenAPI_complex_query_create ( + cnf_unitsList, + dnf_unitsList + ); + + return complex_query_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/complex_query.h b/lib/sbi/openapi/model/complex_query.h new file mode 100644 index 000000000..a620ecdc0 --- /dev/null +++ b/lib/sbi/openapi/model/complex_query.h @@ -0,0 +1,43 @@ +/* + * complex_query.h + * + * + */ + +#ifndef _OpenAPI_complex_query_H_ +#define _OpenAPI_complex_query_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cnf.h" +#include "cnf_unit.h" +#include "dnf.h" +#include "dnf_unit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_complex_query_s OpenAPI_complex_query_t; +typedef struct OpenAPI_complex_query_s { + OpenAPI_list_t *cnf_units; + OpenAPI_list_t *dnf_units; +} OpenAPI_complex_query_t; + +OpenAPI_complex_query_t *OpenAPI_complex_query_create( + OpenAPI_list_t *cnf_units, + OpenAPI_list_t *dnf_units + ); +void OpenAPI_complex_query_free(OpenAPI_complex_query_t *complex_query); +OpenAPI_complex_query_t *OpenAPI_complex_query_parseFromJSON(cJSON *complex_queryJSON); +cJSON *OpenAPI_complex_query_convertToJSON(OpenAPI_complex_query_t *complex_query); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_complex_query_H_ */ + diff --git a/lib/sbi/openapi/model/data_set_id.c b/lib/sbi/openapi/model/data_set_id.c new file mode 100644 index 000000000..a2d9eec60 --- /dev/null +++ b/lib/sbi/openapi/model/data_set_id.c @@ -0,0 +1,51 @@ + +#include +#include +#include +#include "data_set_id.h" + +OpenAPI_data_set_id_t *OpenAPI_data_set_id_create( + ) +{ + OpenAPI_data_set_id_t *data_set_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_data_set_id_t)); + if (!data_set_id_local_var) { + return NULL; + } + + return data_set_id_local_var; +} + +void OpenAPI_data_set_id_free(OpenAPI_data_set_id_t *data_set_id) +{ + if (NULL == data_set_id) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(data_set_id); +} + +cJSON *OpenAPI_data_set_id_convertToJSON(OpenAPI_data_set_id_t *data_set_id) +{ + cJSON *item = NULL; + + if (data_set_id == NULL) { + ogs_error("OpenAPI_data_set_id_convertToJSON() failed [DataSetId]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_data_set_id_t *OpenAPI_data_set_id_parseFromJSON(cJSON *data_set_idJSON) +{ + OpenAPI_data_set_id_t *data_set_id_local_var = NULL; + data_set_id_local_var = OpenAPI_data_set_id_create ( + ); + + return data_set_id_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/data_set_id.h b/lib/sbi/openapi/model/data_set_id.h new file mode 100644 index 000000000..b96d46169 --- /dev/null +++ b/lib/sbi/openapi/model/data_set_id.h @@ -0,0 +1,35 @@ +/* + * data_set_id.h + * + * + */ + +#ifndef _OpenAPI_data_set_id_H_ +#define _OpenAPI_data_set_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_data_set_id_s OpenAPI_data_set_id_t; +typedef struct OpenAPI_data_set_id_s { +} OpenAPI_data_set_id_t; + +OpenAPI_data_set_id_t *OpenAPI_data_set_id_create( + ); +void OpenAPI_data_set_id_free(OpenAPI_data_set_id_t *data_set_id); +OpenAPI_data_set_id_t *OpenAPI_data_set_id_parseFromJSON(cJSON *data_set_idJSON); +cJSON *OpenAPI_data_set_id_convertToJSON(OpenAPI_data_set_id_t *data_set_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_data_set_id_H_ */ + diff --git a/lib/sbi/openapi/model/default_notification_subscription.c b/lib/sbi/openapi/model/default_notification_subscription.c new file mode 100644 index 000000000..e0b105be7 --- /dev/null +++ b/lib/sbi/openapi/model/default_notification_subscription.c @@ -0,0 +1,147 @@ + +#include +#include +#include +#include "default_notification_subscription.h" + +OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_create( + OpenAPI_notification_type_e notification_type, + char *callback_uri, + OpenAPI_n1_message_class_e n1_message_class, + OpenAPI_n2_information_class_t *n2_information_class + ) +{ + OpenAPI_default_notification_subscription_t *default_notification_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_default_notification_subscription_t)); + if (!default_notification_subscription_local_var) { + return NULL; + } + default_notification_subscription_local_var->notification_type = notification_type; + default_notification_subscription_local_var->callback_uri = callback_uri; + default_notification_subscription_local_var->n1_message_class = n1_message_class; + default_notification_subscription_local_var->n2_information_class = n2_information_class; + + return default_notification_subscription_local_var; +} + +void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification_subscription_t *default_notification_subscription) +{ + if (NULL == default_notification_subscription) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(default_notification_subscription->callback_uri); + OpenAPI_n2_information_class_free(default_notification_subscription->n2_information_class); + ogs_free(default_notification_subscription); +} + +cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_notification_subscription_t *default_notification_subscription) +{ + cJSON *item = NULL; + + if (default_notification_subscription == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [DefaultNotificationSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!default_notification_subscription->notification_type) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [notification_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "notificationType", OpenAPI_notification_type_ToString(default_notification_subscription->notification_type)) == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [notification_type]"); + goto end; + } + + if (!default_notification_subscription->callback_uri) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [callback_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "callbackUri", default_notification_subscription->callback_uri) == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [callback_uri]"); + goto end; + } + + if (default_notification_subscription->n1_message_class) { + if (cJSON_AddStringToObject(item, "n1MessageClass", OpenAPI_n1_message_class_ToString(default_notification_subscription->n1_message_class)) == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [n1_message_class]"); + goto end; + } + } + + if (default_notification_subscription->n2_information_class) { + cJSON *n2_information_class_local_JSON = OpenAPI_n2_information_class_convertToJSON(default_notification_subscription->n2_information_class); + if (n2_information_class_local_JSON == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [n2_information_class]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InformationClass", n2_information_class_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [n2_information_class]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_parseFromJSON(cJSON *default_notification_subscriptionJSON) +{ + OpenAPI_default_notification_subscription_t *default_notification_subscription_local_var = NULL; + cJSON *notification_type = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "notificationType"); + if (!notification_type) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [notification_type]"); + goto end; + } + + OpenAPI_notification_type_e notification_typeVariable; + + if (!cJSON_IsString(notification_type)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [notification_type]"); + goto end; + } + notification_typeVariable = OpenAPI_notification_type_FromString(notification_type->valuestring); + + cJSON *callback_uri = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "callbackUri"); + if (!callback_uri) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [callback_uri]"); + goto end; + } + + + if (!cJSON_IsString(callback_uri)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [callback_uri]"); + goto end; + } + + cJSON *n1_message_class = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "n1MessageClass"); + + OpenAPI_n1_message_class_e n1_message_classVariable; + if (n1_message_class) { + if (!cJSON_IsString(n1_message_class)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [n1_message_class]"); + goto end; + } + n1_message_classVariable = OpenAPI_n1_message_class_FromString(n1_message_class->valuestring); + } + + cJSON *n2_information_class = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "n2InformationClass"); + + OpenAPI_n2_information_class_t *n2_information_class_local_nonprim = NULL; + if (n2_information_class) { + n2_information_class_local_nonprim = OpenAPI_n2_information_class_parseFromJSON(n2_information_class); + } + + 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_class_local_nonprim : NULL + ); + + return default_notification_subscription_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/default_notification_subscription.h b/lib/sbi/openapi/model/default_notification_subscription.h new file mode 100644 index 000000000..12e460c1e --- /dev/null +++ b/lib/sbi/openapi/model/default_notification_subscription.h @@ -0,0 +1,46 @@ +/* + * default_notification_subscription.h + * + * + */ + +#ifndef _OpenAPI_default_notification_subscription_H_ +#define _OpenAPI_default_notification_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n1_message_class.h" +#include "n2_information_class.h" +#include "notification_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_default_notification_subscription_s OpenAPI_default_notification_subscription_t; +typedef struct OpenAPI_default_notification_subscription_s { + OpenAPI_notification_type_e notification_type; + char *callback_uri; + OpenAPI_n1_message_class_e n1_message_class; + struct OpenAPI_n2_information_class_s *n2_information_class; +} OpenAPI_default_notification_subscription_t; + +OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_create( + OpenAPI_notification_type_e notification_type, + char *callback_uri, + OpenAPI_n1_message_class_e n1_message_class, + OpenAPI_n2_information_class_t *n2_information_class + ); +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); +cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_notification_subscription_t *default_notification_subscription); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_default_notification_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/dnf.c b/lib/sbi/openapi/model/dnf.c new file mode 100644 index 000000000..6ce3df829 --- /dev/null +++ b/lib/sbi/openapi/model/dnf.c @@ -0,0 +1,106 @@ + +#include +#include +#include +#include "dnf.h" + +OpenAPI_dnf_t *OpenAPI_dnf_create( + OpenAPI_list_t *dnf_units + ) +{ + OpenAPI_dnf_t *dnf_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnf_t)); + if (!dnf_local_var) { + return NULL; + } + dnf_local_var->dnf_units = dnf_units; + + return dnf_local_var; +} + +void OpenAPI_dnf_free(OpenAPI_dnf_t *dnf) +{ + if (NULL == dnf) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(dnf->dnf_units, node) { + OpenAPI_dnf_unit_free(node->data); + } + OpenAPI_list_free(dnf->dnf_units); + ogs_free(dnf); +} + +cJSON *OpenAPI_dnf_convertToJSON(OpenAPI_dnf_t *dnf) +{ + cJSON *item = NULL; + + if (dnf == NULL) { + ogs_error("OpenAPI_dnf_convertToJSON() failed [Dnf]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnf->dnf_units) { + ogs_error("OpenAPI_dnf_convertToJSON() failed [dnf_units]"); + goto end; + } + cJSON *dnf_unitsList = cJSON_AddArrayToObject(item, "dnfUnits"); + if (dnf_unitsList == NULL) { + ogs_error("OpenAPI_dnf_convertToJSON() failed [dnf_units]"); + goto end; + } + + OpenAPI_lnode_t *dnf_units_node; + if (dnf->dnf_units) { + OpenAPI_list_for_each(dnf->dnf_units, dnf_units_node) { + cJSON *itemLocal = OpenAPI_dnf_unit_convertToJSON(dnf_units_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnf_convertToJSON() failed [dnf_units]"); + goto end; + } + cJSON_AddItemToArray(dnf_unitsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_dnf_t *OpenAPI_dnf_parseFromJSON(cJSON *dnfJSON) +{ + OpenAPI_dnf_t *dnf_local_var = NULL; + cJSON *dnf_units = cJSON_GetObjectItemCaseSensitive(dnfJSON, "dnfUnits"); + if (!dnf_units) { + ogs_error("OpenAPI_dnf_parseFromJSON() failed [dnf_units]"); + goto end; + } + + OpenAPI_list_t *dnf_unitsList; + + cJSON *dnf_units_local_nonprimitive; + if (!cJSON_IsArray(dnf_units)) { + ogs_error("OpenAPI_dnf_parseFromJSON() failed [dnf_units]"); + goto end; + } + + dnf_unitsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnf_units_local_nonprimitive, dnf_units ) { + if (!cJSON_IsObject(dnf_units_local_nonprimitive)) { + ogs_error("OpenAPI_dnf_parseFromJSON() failed [dnf_units]"); + goto end; + } + OpenAPI_dnf_unit_t *dnf_unitsItem = OpenAPI_dnf_unit_parseFromJSON(dnf_units_local_nonprimitive); + + OpenAPI_list_add(dnf_unitsList, dnf_unitsItem); + } + + dnf_local_var = OpenAPI_dnf_create ( + dnf_unitsList + ); + + return dnf_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/dnf.h b/lib/sbi/openapi/model/dnf.h new file mode 100644 index 000000000..a603152fd --- /dev/null +++ b/lib/sbi/openapi/model/dnf.h @@ -0,0 +1,38 @@ +/* + * dnf.h + * + * + */ + +#ifndef _OpenAPI_dnf_H_ +#define _OpenAPI_dnf_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnf_unit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnf_s OpenAPI_dnf_t; +typedef struct OpenAPI_dnf_s { + OpenAPI_list_t *dnf_units; +} OpenAPI_dnf_t; + +OpenAPI_dnf_t *OpenAPI_dnf_create( + OpenAPI_list_t *dnf_units + ); +void OpenAPI_dnf_free(OpenAPI_dnf_t *dnf); +OpenAPI_dnf_t *OpenAPI_dnf_parseFromJSON(cJSON *dnfJSON); +cJSON *OpenAPI_dnf_convertToJSON(OpenAPI_dnf_t *dnf); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnf_H_ */ + diff --git a/lib/sbi/openapi/model/dnf_unit.c b/lib/sbi/openapi/model/dnf_unit.c new file mode 100644 index 000000000..2f399af47 --- /dev/null +++ b/lib/sbi/openapi/model/dnf_unit.c @@ -0,0 +1,106 @@ + +#include +#include +#include +#include "dnf_unit.h" + +OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_create( + OpenAPI_list_t *dnf_unit + ) +{ + OpenAPI_dnf_unit_t *dnf_unit_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnf_unit_t)); + if (!dnf_unit_local_var) { + return NULL; + } + dnf_unit_local_var->dnf_unit = dnf_unit; + + return dnf_unit_local_var; +} + +void OpenAPI_dnf_unit_free(OpenAPI_dnf_unit_t *dnf_unit) +{ + if (NULL == dnf_unit) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(dnf_unit->dnf_unit, node) { + OpenAPI_atom_free(node->data); + } + OpenAPI_list_free(dnf_unit->dnf_unit); + ogs_free(dnf_unit); +} + +cJSON *OpenAPI_dnf_unit_convertToJSON(OpenAPI_dnf_unit_t *dnf_unit) +{ + cJSON *item = NULL; + + if (dnf_unit == NULL) { + ogs_error("OpenAPI_dnf_unit_convertToJSON() failed [DnfUnit]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnf_unit->dnf_unit) { + ogs_error("OpenAPI_dnf_unit_convertToJSON() failed [dnf_unit]"); + goto end; + } + cJSON *dnf_unitList = cJSON_AddArrayToObject(item, "dnfUnit"); + if (dnf_unitList == NULL) { + ogs_error("OpenAPI_dnf_unit_convertToJSON() failed [dnf_unit]"); + goto end; + } + + OpenAPI_lnode_t *dnf_unit_node; + if (dnf_unit->dnf_unit) { + OpenAPI_list_for_each(dnf_unit->dnf_unit, dnf_unit_node) { + cJSON *itemLocal = OpenAPI_atom_convertToJSON(dnf_unit_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnf_unit_convertToJSON() failed [dnf_unit]"); + goto end; + } + cJSON_AddItemToArray(dnf_unitList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_parseFromJSON(cJSON *dnf_unitJSON) +{ + OpenAPI_dnf_unit_t *dnf_unit_local_var = NULL; + cJSON *dnf_unit = cJSON_GetObjectItemCaseSensitive(dnf_unitJSON, "dnfUnit"); + if (!dnf_unit) { + ogs_error("OpenAPI_dnf_unit_parseFromJSON() failed [dnf_unit]"); + goto end; + } + + OpenAPI_list_t *dnf_unitList; + + cJSON *dnf_unit_local_nonprimitive; + if (!cJSON_IsArray(dnf_unit)) { + ogs_error("OpenAPI_dnf_unit_parseFromJSON() failed [dnf_unit]"); + goto end; + } + + dnf_unitList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnf_unit_local_nonprimitive, dnf_unit ) { + if (!cJSON_IsObject(dnf_unit_local_nonprimitive)) { + ogs_error("OpenAPI_dnf_unit_parseFromJSON() failed [dnf_unit]"); + goto end; + } + OpenAPI_atom_t *dnf_unitItem = OpenAPI_atom_parseFromJSON(dnf_unit_local_nonprimitive); + + OpenAPI_list_add(dnf_unitList, dnf_unitItem); + } + + dnf_unit_local_var = OpenAPI_dnf_unit_create ( + dnf_unitList + ); + + return dnf_unit_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/dnf_unit.h b/lib/sbi/openapi/model/dnf_unit.h new file mode 100644 index 000000000..42f84a74e --- /dev/null +++ b/lib/sbi/openapi/model/dnf_unit.h @@ -0,0 +1,38 @@ +/* + * dnf_unit.h + * + * + */ + +#ifndef _OpenAPI_dnf_unit_H_ +#define _OpenAPI_dnf_unit_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "atom.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnf_unit_s OpenAPI_dnf_unit_t; +typedef struct OpenAPI_dnf_unit_s { + OpenAPI_list_t *dnf_unit; +} OpenAPI_dnf_unit_t; + +OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_create( + OpenAPI_list_t *dnf_unit + ); +void OpenAPI_dnf_unit_free(OpenAPI_dnf_unit_t *dnf_unit); +OpenAPI_dnf_unit_t *OpenAPI_dnf_unit_parseFromJSON(cJSON *dnf_unitJSON); +cJSON *OpenAPI_dnf_unit_convertToJSON(OpenAPI_dnf_unit_t *dnf_unit); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnf_unit_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_smf_info_item.c b/lib/sbi/openapi/model/dnn_smf_info_item.c new file mode 100644 index 000000000..2dfdaecfa --- /dev/null +++ b/lib/sbi/openapi/model/dnn_smf_info_item.c @@ -0,0 +1,76 @@ + +#include +#include +#include +#include "dnn_smf_info_item.h" + +OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_create( + char *dnn + ) +{ + OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnn_smf_info_item_t)); + if (!dnn_smf_info_item_local_var) { + return NULL; + } + dnn_smf_info_item_local_var->dnn = dnn; + + return dnn_smf_info_item_local_var; +} + +void OpenAPI_dnn_smf_info_item_free(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item) +{ + if (NULL == dnn_smf_info_item) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(dnn_smf_info_item->dnn); + ogs_free(dnn_smf_info_item); +} + +cJSON *OpenAPI_dnn_smf_info_item_convertToJSON(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item) +{ + cJSON *item = NULL; + + if (dnn_smf_info_item == NULL) { + ogs_error("OpenAPI_dnn_smf_info_item_convertToJSON() failed [DnnSmfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnn_smf_info_item->dnn) { + ogs_error("OpenAPI_dnn_smf_info_item_convertToJSON() failed [dnn]"); + goto end; + } + if (cJSON_AddStringToObject(item, "dnn", dnn_smf_info_item->dnn) == NULL) { + ogs_error("OpenAPI_dnn_smf_info_item_convertToJSON() failed [dnn]"); + goto end; + } + +end: + return item; +} + +OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_parseFromJSON(cJSON *dnn_smf_info_itemJSON) +{ + OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item_local_var = NULL; + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(dnn_smf_info_itemJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_dnn_smf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_dnn_smf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + dnn_smf_info_item_local_var = OpenAPI_dnn_smf_info_item_create ( + ogs_strdup(dnn->valuestring) + ); + + return dnn_smf_info_item_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/dnn_smf_info_item.h b/lib/sbi/openapi/model/dnn_smf_info_item.h new file mode 100644 index 000000000..9c36b7859 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_smf_info_item.h @@ -0,0 +1,37 @@ +/* + * dnn_smf_info_item.h + * + * + */ + +#ifndef _OpenAPI_dnn_smf_info_item_H_ +#define _OpenAPI_dnn_smf_info_item_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_dnn_smf_info_item_s OpenAPI_dnn_smf_info_item_t; +typedef struct OpenAPI_dnn_smf_info_item_s { + char *dnn; +} OpenAPI_dnn_smf_info_item_t; + +OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_create( + char *dnn + ); +void OpenAPI_dnn_smf_info_item_free(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item); +OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_parseFromJSON(cJSON *dnn_smf_info_itemJSON); +cJSON *OpenAPI_dnn_smf_info_item_convertToJSON(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_smf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_upf_info_item.c b/lib/sbi/openapi/model/dnn_upf_info_item.c new file mode 100644 index 000000000..c31b62bd3 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_upf_info_item.c @@ -0,0 +1,169 @@ + +#include +#include +#include +#include "dnn_upf_info_item.h" + +OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_create( + char *dnn, + OpenAPI_list_t *dnai_list, + OpenAPI_list_t *pdu_session_types + ) +{ + OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnn_upf_info_item_t)); + if (!dnn_upf_info_item_local_var) { + return NULL; + } + dnn_upf_info_item_local_var->dnn = dnn; + dnn_upf_info_item_local_var->dnai_list = dnai_list; + dnn_upf_info_item_local_var->pdu_session_types = pdu_session_types; + + return dnn_upf_info_item_local_var; +} + +void OpenAPI_dnn_upf_info_item_free(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item) +{ + if (NULL == dnn_upf_info_item) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(dnn_upf_info_item->dnn); + OpenAPI_list_for_each(dnn_upf_info_item->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_upf_info_item->dnai_list); + OpenAPI_list_for_each(dnn_upf_info_item->pdu_session_types, node) { + OpenAPI_pdu_session_type_free(node->data); + } + OpenAPI_list_free(dnn_upf_info_item->pdu_session_types); + ogs_free(dnn_upf_info_item); +} + +cJSON *OpenAPI_dnn_upf_info_item_convertToJSON(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item) +{ + cJSON *item = NULL; + + if (dnn_upf_info_item == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [DnnUpfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnn_upf_info_item->dnn) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [dnn]"); + goto end; + } + if (cJSON_AddStringToObject(item, "dnn", dnn_upf_info_item->dnn) == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [dnn]"); + goto end; + } + + if (dnn_upf_info_item->dnai_list) { + cJSON *dnai_list = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_list == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [dnai_list]"); + goto end; + } + + OpenAPI_lnode_t *dnai_list_node; + OpenAPI_list_for_each(dnn_upf_info_item->dnai_list, dnai_list_node) { + if (cJSON_AddStringToObject(dnai_list, "", (char*)dnai_list_node->data) == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (dnn_upf_info_item->pdu_session_types) { + cJSON *pdu_session_typesList = cJSON_AddArrayToObject(item, "pduSessionTypes"); + if (pdu_session_typesList == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [pdu_session_types]"); + goto end; + } + + OpenAPI_lnode_t *pdu_session_types_node; + if (dnn_upf_info_item->pdu_session_types) { + OpenAPI_list_for_each(dnn_upf_info_item->pdu_session_types, pdu_session_types_node) { + cJSON *itemLocal = OpenAPI_pdu_session_type_convertToJSON(pdu_session_types_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [pdu_session_types]"); + goto end; + } + cJSON_AddItemToArray(pdu_session_typesList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_parseFromJSON(cJSON *dnn_upf_info_itemJSON) +{ + OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item_local_var = NULL; + cJSON *dnn = cJSON_GetObjectItemCaseSensitive(dnn_upf_info_itemJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + cJSON *dnai_list = cJSON_GetObjectItemCaseSensitive(dnn_upf_info_itemJSON, "dnaiList"); + + OpenAPI_list_t *dnai_listList; + if (dnai_list) { + cJSON *dnai_list_local; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [dnai_list]"); + goto end; + } + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + cJSON *pdu_session_types = cJSON_GetObjectItemCaseSensitive(dnn_upf_info_itemJSON, "pduSessionTypes"); + + OpenAPI_list_t *pdu_session_typesList; + if (pdu_session_types) { + cJSON *pdu_session_types_local_nonprimitive; + if (!cJSON_IsArray(pdu_session_types)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [pdu_session_types]"); + goto end; + } + + pdu_session_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_session_types_local_nonprimitive, pdu_session_types ) { + if (!cJSON_IsObject(pdu_session_types_local_nonprimitive)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [pdu_session_types]"); + goto end; + } + OpenAPI_pdu_session_type_t *pdu_session_typesItem = OpenAPI_pdu_session_type_parseFromJSON(pdu_session_types_local_nonprimitive); + + OpenAPI_list_add(pdu_session_typesList, pdu_session_typesItem); + } + } + + dnn_upf_info_item_local_var = OpenAPI_dnn_upf_info_item_create ( + ogs_strdup(dnn->valuestring), + dnai_list ? dnai_listList : NULL, + pdu_session_types ? pdu_session_typesList : NULL + ); + + return dnn_upf_info_item_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/dnn_upf_info_item.h b/lib/sbi/openapi/model/dnn_upf_info_item.h new file mode 100644 index 000000000..f09e1fa34 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_upf_info_item.h @@ -0,0 +1,42 @@ +/* + * dnn_upf_info_item.h + * + * + */ + +#ifndef _OpenAPI_dnn_upf_info_item_H_ +#define _OpenAPI_dnn_upf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "pdu_session_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_upf_info_item_s OpenAPI_dnn_upf_info_item_t; +typedef struct OpenAPI_dnn_upf_info_item_s { + char *dnn; + OpenAPI_list_t *dnai_list; + OpenAPI_list_t *pdu_session_types; +} OpenAPI_dnn_upf_info_item_t; + +OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_create( + char *dnn, + OpenAPI_list_t *dnai_list, + OpenAPI_list_t *pdu_session_types + ); +void OpenAPI_dnn_upf_info_item_free(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item); +OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_parseFromJSON(cJSON *dnn_upf_info_itemJSON); +cJSON *OpenAPI_dnn_upf_info_item_convertToJSON(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_upf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/event_id.c b/lib/sbi/openapi/model/event_id.c new file mode 100644 index 000000000..4fed99423 --- /dev/null +++ b/lib/sbi/openapi/model/event_id.c @@ -0,0 +1,51 @@ + +#include +#include +#include +#include "event_id.h" + +OpenAPI_event_id_t *OpenAPI_event_id_create( + ) +{ + OpenAPI_event_id_t *event_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_event_id_t)); + if (!event_id_local_var) { + return NULL; + } + + return event_id_local_var; +} + +void OpenAPI_event_id_free(OpenAPI_event_id_t *event_id) +{ + if (NULL == event_id) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(event_id); +} + +cJSON *OpenAPI_event_id_convertToJSON(OpenAPI_event_id_t *event_id) +{ + cJSON *item = NULL; + + if (event_id == NULL) { + ogs_error("OpenAPI_event_id_convertToJSON() failed [EventId]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_event_id_t *OpenAPI_event_id_parseFromJSON(cJSON *event_idJSON) +{ + OpenAPI_event_id_t *event_id_local_var = NULL; + event_id_local_var = OpenAPI_event_id_create ( + ); + + return event_id_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/event_id.h b/lib/sbi/openapi/model/event_id.h new file mode 100644 index 000000000..f137fd6d3 --- /dev/null +++ b/lib/sbi/openapi/model/event_id.h @@ -0,0 +1,35 @@ +/* + * event_id.h + * + * Possible values are - LOAD_LEVEL_INFORMATION: Represent the analytics of load level information of corresponding network slice instance. - NETWORK_PERFORMANCE: Represent the analytics of network performance information. - NF_LOAD: Indicates that the event subscribed is NF Load. - SERVICE_EXPERIENCE: Represent the analytics of service experience information of the specific applications. - UE_MOBILITY: Represent the analytics of UE mobility. - UE_COMMUNICATION: Represent the analytics of UE communication. - QOS_SUSTAINABILITY: Represent the analytics of QoS sustainability information in the certain area. - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour information. - USER_DATA_CONGESTION: Represent the analytics of the user data congestion in the certain area. + */ + +#ifndef _OpenAPI_event_id_H_ +#define _OpenAPI_event_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_event_id_s OpenAPI_event_id_t; +typedef struct OpenAPI_event_id_s { +} OpenAPI_event_id_t; + +OpenAPI_event_id_t *OpenAPI_event_id_create( + ); +void OpenAPI_event_id_free(OpenAPI_event_id_t *event_id); +OpenAPI_event_id_t *OpenAPI_event_id_parseFromJSON(cJSON *event_idJSON); +cJSON *OpenAPI_event_id_convertToJSON(OpenAPI_event_id_t *event_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_event_id_H_ */ + diff --git a/lib/sbi/openapi/model/guami.c b/lib/sbi/openapi/model/guami.c new file mode 100644 index 000000000..1420d1f2c --- /dev/null +++ b/lib/sbi/openapi/model/guami.c @@ -0,0 +1,105 @@ + +#include +#include +#include +#include "guami.h" + +OpenAPI_guami_t *OpenAPI_guami_create( + OpenAPI_plmn_id_t *plmn_id, + char *amf_id + ) +{ + OpenAPI_guami_t *guami_local_var = OpenAPI_malloc(sizeof(OpenAPI_guami_t)); + if (!guami_local_var) { + return NULL; + } + guami_local_var->plmn_id = plmn_id; + guami_local_var->amf_id = amf_id; + + return guami_local_var; +} + +void OpenAPI_guami_free(OpenAPI_guami_t *guami) +{ + if (NULL == guami) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_plmn_id_free(guami->plmn_id); + ogs_free(guami->amf_id); + ogs_free(guami); +} + +cJSON *OpenAPI_guami_convertToJSON(OpenAPI_guami_t *guami) +{ + cJSON *item = NULL; + + if (guami == NULL) { + ogs_error("OpenAPI_guami_convertToJSON() failed [Guami]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!guami->plmn_id) { + ogs_error("OpenAPI_guami_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(guami->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_guami_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_guami_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!guami->amf_id) { + ogs_error("OpenAPI_guami_convertToJSON() failed [amf_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "amfId", guami->amf_id) == NULL) { + ogs_error("OpenAPI_guami_convertToJSON() failed [amf_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_guami_t *OpenAPI_guami_parseFromJSON(cJSON *guamiJSON) +{ + OpenAPI_guami_t *guami_local_var = NULL; + cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(guamiJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_guami_parseFromJSON() failed [plmn_id]"); + goto end; + } + + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + cJSON *amf_id = cJSON_GetObjectItemCaseSensitive(guamiJSON, "amfId"); + if (!amf_id) { + ogs_error("OpenAPI_guami_parseFromJSON() failed [amf_id]"); + goto end; + } + + + if (!cJSON_IsString(amf_id)) { + ogs_error("OpenAPI_guami_parseFromJSON() failed [amf_id]"); + goto end; + } + + guami_local_var = OpenAPI_guami_create ( + plmn_id_local_nonprim, + ogs_strdup(amf_id->valuestring) + ); + + return guami_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/guami.h b/lib/sbi/openapi/model/guami.h new file mode 100644 index 000000000..98e80a7a2 --- /dev/null +++ b/lib/sbi/openapi/model/guami.h @@ -0,0 +1,40 @@ +/* + * guami.h + * + * + */ + +#ifndef _OpenAPI_guami_H_ +#define _OpenAPI_guami_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_guami_s OpenAPI_guami_t; +typedef struct OpenAPI_guami_s { + struct OpenAPI_plmn_id_s *plmn_id; + char *amf_id; +} OpenAPI_guami_t; + +OpenAPI_guami_t *OpenAPI_guami_create( + OpenAPI_plmn_id_t *plmn_id, + char *amf_id + ); +void OpenAPI_guami_free(OpenAPI_guami_t *guami); +OpenAPI_guami_t *OpenAPI_guami_parseFromJSON(cJSON *guamiJSON); +cJSON *OpenAPI_guami_convertToJSON(OpenAPI_guami_t *guami); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_guami_H_ */ + diff --git a/lib/sbi/openapi/model/guami_list_cond.c b/lib/sbi/openapi/model/guami_list_cond.c new file mode 100644 index 000000000..39f09f601 --- /dev/null +++ b/lib/sbi/openapi/model/guami_list_cond.c @@ -0,0 +1,106 @@ + +#include +#include +#include +#include "guami_list_cond.h" + +OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_create( + OpenAPI_list_t *guami_list + ) +{ + OpenAPI_guami_list_cond_t *guami_list_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_guami_list_cond_t)); + if (!guami_list_cond_local_var) { + return NULL; + } + guami_list_cond_local_var->guami_list = guami_list; + + return guami_list_cond_local_var; +} + +void OpenAPI_guami_list_cond_free(OpenAPI_guami_list_cond_t *guami_list_cond) +{ + if (NULL == guami_list_cond) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(guami_list_cond->guami_list, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(guami_list_cond->guami_list); + ogs_free(guami_list_cond); +} + +cJSON *OpenAPI_guami_list_cond_convertToJSON(OpenAPI_guami_list_cond_t *guami_list_cond) +{ + cJSON *item = NULL; + + if (guami_list_cond == NULL) { + ogs_error("OpenAPI_guami_list_cond_convertToJSON() failed [GuamiListCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!guami_list_cond->guami_list) { + ogs_error("OpenAPI_guami_list_cond_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); + if (guami_listList == NULL) { + ogs_error("OpenAPI_guami_list_cond_convertToJSON() failed [guami_list]"); + goto end; + } + + OpenAPI_lnode_t *guami_list_node; + if (guami_list_cond->guami_list) { + OpenAPI_list_for_each(guami_list_cond->guami_list, guami_list_node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(guami_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_guami_list_cond_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON_AddItemToArray(guami_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_parseFromJSON(cJSON *guami_list_condJSON) +{ + OpenAPI_guami_list_cond_t *guami_list_cond_local_var = NULL; + cJSON *guami_list = cJSON_GetObjectItemCaseSensitive(guami_list_condJSON, "guamiList"); + if (!guami_list) { + ogs_error("OpenAPI_guami_list_cond_parseFromJSON() failed [guami_list]"); + goto end; + } + + OpenAPI_list_t *guami_listList; + + cJSON *guami_list_local_nonprimitive; + if (!cJSON_IsArray(guami_list)) { + ogs_error("OpenAPI_guami_list_cond_parseFromJSON() failed [guami_list]"); + goto end; + } + + guami_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(guami_list_local_nonprimitive, guami_list ) { + if (!cJSON_IsObject(guami_list_local_nonprimitive)) { + ogs_error("OpenAPI_guami_list_cond_parseFromJSON() failed [guami_list]"); + goto end; + } + OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local_nonprimitive); + + OpenAPI_list_add(guami_listList, guami_listItem); + } + + guami_list_cond_local_var = OpenAPI_guami_list_cond_create ( + guami_listList + ); + + return guami_list_cond_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/guami_list_cond.h b/lib/sbi/openapi/model/guami_list_cond.h new file mode 100644 index 000000000..75f9946e1 --- /dev/null +++ b/lib/sbi/openapi/model/guami_list_cond.h @@ -0,0 +1,38 @@ +/* + * guami_list_cond.h + * + * + */ + +#ifndef _OpenAPI_guami_list_cond_H_ +#define _OpenAPI_guami_list_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "guami.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_guami_list_cond_s OpenAPI_guami_list_cond_t; +typedef struct OpenAPI_guami_list_cond_s { + OpenAPI_list_t *guami_list; +} OpenAPI_guami_list_cond_t; + +OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_create( + OpenAPI_list_t *guami_list + ); +void OpenAPI_guami_list_cond_free(OpenAPI_guami_list_cond_t *guami_list_cond); +OpenAPI_guami_list_cond_t *OpenAPI_guami_list_cond_parseFromJSON(cJSON *guami_list_condJSON); +cJSON *OpenAPI_guami_list_cond_convertToJSON(OpenAPI_guami_list_cond_t *guami_list_cond); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_guami_list_cond_H_ */ + diff --git a/lib/sbi/openapi/model/identity_range.c b/lib/sbi/openapi/model/identity_range.c new file mode 100644 index 000000000..99f5bdae2 --- /dev/null +++ b/lib/sbi/openapi/model/identity_range.c @@ -0,0 +1,111 @@ + +#include +#include +#include +#include "identity_range.h" + +OpenAPI_identity_range_t *OpenAPI_identity_range_create( + char *start, + char *end, + char *pattern + ) +{ + OpenAPI_identity_range_t *identity_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_identity_range_t)); + if (!identity_range_local_var) { + return NULL; + } + identity_range_local_var->start = start; + identity_range_local_var->end = end; + identity_range_local_var->pattern = pattern; + + return identity_range_local_var; +} + +void OpenAPI_identity_range_free(OpenAPI_identity_range_t *identity_range) +{ + if (NULL == identity_range) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(identity_range->start); + ogs_free(identity_range->end); + ogs_free(identity_range->pattern); + ogs_free(identity_range); +} + +cJSON *OpenAPI_identity_range_convertToJSON(OpenAPI_identity_range_t *identity_range) +{ + cJSON *item = NULL; + + if (identity_range == NULL) { + ogs_error("OpenAPI_identity_range_convertToJSON() failed [IdentityRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (identity_range->start) { + if (cJSON_AddStringToObject(item, "start", identity_range->start) == NULL) { + ogs_error("OpenAPI_identity_range_convertToJSON() failed [start]"); + goto end; + } + } + + if (identity_range->end) { + if (cJSON_AddStringToObject(item, "end", identity_range->end) == NULL) { + ogs_error("OpenAPI_identity_range_convertToJSON() failed [end]"); + goto end; + } + } + + if (identity_range->pattern) { + if (cJSON_AddStringToObject(item, "pattern", identity_range->pattern) == NULL) { + ogs_error("OpenAPI_identity_range_convertToJSON() failed [pattern]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_identity_range_t *OpenAPI_identity_range_parseFromJSON(cJSON *identity_rangeJSON) +{ + OpenAPI_identity_range_t *identity_range_local_var = NULL; + cJSON *start = cJSON_GetObjectItemCaseSensitive(identity_rangeJSON, "start"); + + if (start) { + if (!cJSON_IsString(start)) { + ogs_error("OpenAPI_identity_range_parseFromJSON() failed [start]"); + goto end; + } + } + + cJSON *end = cJSON_GetObjectItemCaseSensitive(identity_rangeJSON, "end"); + + if (end) { + if (!cJSON_IsString(end)) { + ogs_error("OpenAPI_identity_range_parseFromJSON() failed [end]"); + goto end; + } + } + + cJSON *pattern = cJSON_GetObjectItemCaseSensitive(identity_rangeJSON, "pattern"); + + if (pattern) { + if (!cJSON_IsString(pattern)) { + ogs_error("OpenAPI_identity_range_parseFromJSON() failed [pattern]"); + goto end; + } + } + + identity_range_local_var = OpenAPI_identity_range_create ( + start ? ogs_strdup(start->valuestring) : NULL, + end ? ogs_strdup(end->valuestring) : NULL, + pattern ? ogs_strdup(pattern->valuestring) : NULL + ); + + return identity_range_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/identity_range.h b/lib/sbi/openapi/model/identity_range.h new file mode 100644 index 000000000..07e445a9e --- /dev/null +++ b/lib/sbi/openapi/model/identity_range.h @@ -0,0 +1,41 @@ +/* + * identity_range.h + * + * + */ + +#ifndef _OpenAPI_identity_range_H_ +#define _OpenAPI_identity_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_identity_range_s OpenAPI_identity_range_t; +typedef struct OpenAPI_identity_range_s { + char *start; + char *end; + char *pattern; +} OpenAPI_identity_range_t; + +OpenAPI_identity_range_t *OpenAPI_identity_range_create( + char *start, + char *end, + char *pattern + ); +void OpenAPI_identity_range_free(OpenAPI_identity_range_t *identity_range); +OpenAPI_identity_range_t *OpenAPI_identity_range_parseFromJSON(cJSON *identity_rangeJSON); +cJSON *OpenAPI_identity_range_convertToJSON(OpenAPI_identity_range_t *identity_range); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_identity_range_H_ */ + diff --git a/lib/sbi/openapi/model/inline_response_200.c b/lib/sbi/openapi/model/inline_response_200.c new file mode 100644 index 000000000..8a6427497 --- /dev/null +++ b/lib/sbi/openapi/model/inline_response_200.c @@ -0,0 +1,104 @@ + +#include +#include +#include +#include "inline_response_200.h" + +OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_create( + OpenAPI_list_t* _links + ) +{ + OpenAPI_inline_response_200_t *inline_response_200_local_var = OpenAPI_malloc(sizeof(OpenAPI_inline_response_200_t)); + if (!inline_response_200_local_var) { + return NULL; + } + inline_response_200_local_var->_links = _links; + + return inline_response_200_local_var; +} + +void OpenAPI_inline_response_200_free(OpenAPI_inline_response_200_t *inline_response_200) +{ + if (NULL == inline_response_200) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(inline_response_200->_links, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_links_value_schema_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(inline_response_200->_links); + ogs_free(inline_response_200); +} + +cJSON *OpenAPI_inline_response_200_convertToJSON(OpenAPI_inline_response_200_t *inline_response_200) +{ + cJSON *item = NULL; + + if (inline_response_200 == NULL) { + ogs_error("OpenAPI_inline_response_200_convertToJSON() failed [inline_response_200]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (inline_response_200->_links) { + cJSON *_links = cJSON_AddObjectToObject(item, "_links"); + if (_links == NULL) { + ogs_error("OpenAPI_inline_response_200_convertToJSON() failed [_links]"); + goto end; + } + cJSON *localMapObject = _links; + OpenAPI_lnode_t *_links_node; + if (inline_response_200->_links) { + OpenAPI_list_for_each(inline_response_200->_links, _links_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)_links_node->data; + cJSON *itemLocal = OpenAPI_links_value_schema_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_inline_response_200_convertToJSON() failed [_links]"); + goto end; + } + cJSON_AddItemToObject(_links, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_parseFromJSON(cJSON *inline_response_200JSON) +{ + OpenAPI_inline_response_200_t *inline_response_200_local_var = NULL; + cJSON *_links = cJSON_GetObjectItemCaseSensitive(inline_response_200JSON, "_links"); + + OpenAPI_list_t *_linksList; + if (_links) { + cJSON *_links_local_map; + if (!cJSON_IsObject(_links)) { + ogs_error("OpenAPI_inline_response_200_parseFromJSON() failed [_links]"); + goto end; + } + _linksList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(_links_local_map, _links) { + cJSON *localMapObject = _links_local_map; + if (!cJSON_IsObject(_links_local_map)) { + ogs_error("OpenAPI_inline_response_200_parseFromJSON() failed [_links]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_links_value_schema_parseFromJSON(localMapObject)); + OpenAPI_list_add(_linksList, localMapKeyPair); + } + } + + inline_response_200_local_var = OpenAPI_inline_response_200_create ( + _links ? _linksList : NULL + ); + + return inline_response_200_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/inline_response_200.h b/lib/sbi/openapi/model/inline_response_200.h new file mode 100644 index 000000000..d42eb902a --- /dev/null +++ b/lib/sbi/openapi/model/inline_response_200.h @@ -0,0 +1,38 @@ +/* + * inline_response_200.h + * + * + */ + +#ifndef _OpenAPI_inline_response_200_H_ +#define _OpenAPI_inline_response_200_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "links_value_schema.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_inline_response_200_s OpenAPI_inline_response_200_t; +typedef struct OpenAPI_inline_response_200_s { + OpenAPI_list_t* _links; +} OpenAPI_inline_response_200_t; + +OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_create( + OpenAPI_list_t* _links + ); +void OpenAPI_inline_response_200_free(OpenAPI_inline_response_200_t *inline_response_200); +OpenAPI_inline_response_200_t *OpenAPI_inline_response_200_parseFromJSON(cJSON *inline_response_200JSON); +cJSON *OpenAPI_inline_response_200_convertToJSON(OpenAPI_inline_response_200_t *inline_response_200); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_inline_response_200_H_ */ + diff --git a/lib/sbi/openapi/model/interface_upf_info_item.c b/lib/sbi/openapi/model/interface_upf_info_item.c new file mode 100644 index 000000000..dba1c16c5 --- /dev/null +++ b/lib/sbi/openapi/model/interface_upf_info_item.c @@ -0,0 +1,206 @@ + +#include +#include +#include +#include "interface_upf_info_item.h" + +OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_create( + OpenAPI_up_interface_type_t *interface_type, + OpenAPI_list_t *ipv4_endpoint_addresses, + OpenAPI_list_t *ipv6_endpoint_addresses, + char *endpoint_fqdn, + char *network_instance + ) +{ + OpenAPI_interface_upf_info_item_t *interface_upf_info_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_interface_upf_info_item_t)); + if (!interface_upf_info_item_local_var) { + return NULL; + } + interface_upf_info_item_local_var->interface_type = interface_type; + interface_upf_info_item_local_var->ipv4_endpoint_addresses = ipv4_endpoint_addresses; + interface_upf_info_item_local_var->ipv6_endpoint_addresses = ipv6_endpoint_addresses; + interface_upf_info_item_local_var->endpoint_fqdn = endpoint_fqdn; + interface_upf_info_item_local_var->network_instance = network_instance; + + return interface_upf_info_item_local_var; +} + +void OpenAPI_interface_upf_info_item_free(OpenAPI_interface_upf_info_item_t *interface_upf_info_item) +{ + if (NULL == interface_upf_info_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_up_interface_type_free(interface_upf_info_item->interface_type); + OpenAPI_list_for_each(interface_upf_info_item->ipv4_endpoint_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(interface_upf_info_item->ipv4_endpoint_addresses); + OpenAPI_list_for_each(interface_upf_info_item->ipv6_endpoint_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(interface_upf_info_item->ipv6_endpoint_addresses); + ogs_free(interface_upf_info_item->endpoint_fqdn); + ogs_free(interface_upf_info_item->network_instance); + ogs_free(interface_upf_info_item); +} + +cJSON *OpenAPI_interface_upf_info_item_convertToJSON(OpenAPI_interface_upf_info_item_t *interface_upf_info_item) +{ + cJSON *item = NULL; + + if (interface_upf_info_item == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [InterfaceUpfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!interface_upf_info_item->interface_type) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [interface_type]"); + goto end; + } + cJSON *interface_type_local_JSON = OpenAPI_up_interface_type_convertToJSON(interface_upf_info_item->interface_type); + if (interface_type_local_JSON == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [interface_type]"); + goto end; + } + cJSON_AddItemToObject(item, "interfaceType", interface_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [interface_type]"); + goto end; + } + + if (interface_upf_info_item->ipv4_endpoint_addresses) { + cJSON *ipv4_endpoint_addresses = cJSON_AddArrayToObject(item, "ipv4EndpointAddresses"); + if (ipv4_endpoint_addresses == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [ipv4_endpoint_addresses]"); + goto end; + } + + OpenAPI_lnode_t *ipv4_endpoint_addresses_node; + OpenAPI_list_for_each(interface_upf_info_item->ipv4_endpoint_addresses, ipv4_endpoint_addresses_node) { + if (cJSON_AddStringToObject(ipv4_endpoint_addresses, "", (char*)ipv4_endpoint_addresses_node->data) == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [ipv4_endpoint_addresses]"); + goto end; + } + } + } + + if (interface_upf_info_item->ipv6_endpoint_addresses) { + cJSON *ipv6_endpoint_addresses = cJSON_AddArrayToObject(item, "ipv6EndpointAddresses"); + if (ipv6_endpoint_addresses == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [ipv6_endpoint_addresses]"); + goto end; + } + + OpenAPI_lnode_t *ipv6_endpoint_addresses_node; + OpenAPI_list_for_each(interface_upf_info_item->ipv6_endpoint_addresses, ipv6_endpoint_addresses_node) { + if (cJSON_AddStringToObject(ipv6_endpoint_addresses, "", (char*)ipv6_endpoint_addresses_node->data) == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [ipv6_endpoint_addresses]"); + goto end; + } + } + } + + if (interface_upf_info_item->endpoint_fqdn) { + if (cJSON_AddStringToObject(item, "endpointFqdn", interface_upf_info_item->endpoint_fqdn) == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [endpoint_fqdn]"); + goto end; + } + } + + if (interface_upf_info_item->network_instance) { + if (cJSON_AddStringToObject(item, "networkInstance", interface_upf_info_item->network_instance) == NULL) { + ogs_error("OpenAPI_interface_upf_info_item_convertToJSON() failed [network_instance]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_parseFromJSON(cJSON *interface_upf_info_itemJSON) +{ + OpenAPI_interface_upf_info_item_t *interface_upf_info_item_local_var = NULL; + cJSON *interface_type = cJSON_GetObjectItemCaseSensitive(interface_upf_info_itemJSON, "interfaceType"); + if (!interface_type) { + ogs_error("OpenAPI_interface_upf_info_item_parseFromJSON() failed [interface_type]"); + goto end; + } + + OpenAPI_up_interface_type_t *interface_type_local_nonprim = NULL; + + interface_type_local_nonprim = OpenAPI_up_interface_type_parseFromJSON(interface_type); + + cJSON *ipv4_endpoint_addresses = cJSON_GetObjectItemCaseSensitive(interface_upf_info_itemJSON, "ipv4EndpointAddresses"); + + OpenAPI_list_t *ipv4_endpoint_addressesList; + if (ipv4_endpoint_addresses) { + cJSON *ipv4_endpoint_addresses_local; + if (!cJSON_IsArray(ipv4_endpoint_addresses)) { + ogs_error("OpenAPI_interface_upf_info_item_parseFromJSON() failed [ipv4_endpoint_addresses]"); + goto end; + } + ipv4_endpoint_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_endpoint_addresses_local, ipv4_endpoint_addresses) { + if (!cJSON_IsString(ipv4_endpoint_addresses_local)) { + ogs_error("OpenAPI_interface_upf_info_item_parseFromJSON() failed [ipv4_endpoint_addresses]"); + goto end; + } + OpenAPI_list_add(ipv4_endpoint_addressesList, ogs_strdup(ipv4_endpoint_addresses_local->valuestring)); + } + } + + cJSON *ipv6_endpoint_addresses = cJSON_GetObjectItemCaseSensitive(interface_upf_info_itemJSON, "ipv6EndpointAddresses"); + + OpenAPI_list_t *ipv6_endpoint_addressesList; + if (ipv6_endpoint_addresses) { + cJSON *ipv6_endpoint_addresses_local; + if (!cJSON_IsArray(ipv6_endpoint_addresses)) { + ogs_error("OpenAPI_interface_upf_info_item_parseFromJSON() failed [ipv6_endpoint_addresses]"); + goto end; + } + ipv6_endpoint_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_endpoint_addresses_local, ipv6_endpoint_addresses) { + if (!cJSON_IsString(ipv6_endpoint_addresses_local)) { + ogs_error("OpenAPI_interface_upf_info_item_parseFromJSON() failed [ipv6_endpoint_addresses]"); + goto end; + } + OpenAPI_list_add(ipv6_endpoint_addressesList, ogs_strdup(ipv6_endpoint_addresses_local->valuestring)); + } + } + + cJSON *endpoint_fqdn = cJSON_GetObjectItemCaseSensitive(interface_upf_info_itemJSON, "endpointFqdn"); + + if (endpoint_fqdn) { + if (!cJSON_IsString(endpoint_fqdn)) { + ogs_error("OpenAPI_interface_upf_info_item_parseFromJSON() failed [endpoint_fqdn]"); + goto end; + } + } + + cJSON *network_instance = cJSON_GetObjectItemCaseSensitive(interface_upf_info_itemJSON, "networkInstance"); + + if (network_instance) { + if (!cJSON_IsString(network_instance)) { + ogs_error("OpenAPI_interface_upf_info_item_parseFromJSON() failed [network_instance]"); + goto end; + } + } + + interface_upf_info_item_local_var = OpenAPI_interface_upf_info_item_create ( + interface_type_local_nonprim, + ipv4_endpoint_addresses ? ipv4_endpoint_addressesList : NULL, + ipv6_endpoint_addresses ? ipv6_endpoint_addressesList : NULL, + endpoint_fqdn ? ogs_strdup(endpoint_fqdn->valuestring) : NULL, + network_instance ? ogs_strdup(network_instance->valuestring) : NULL + ); + + return interface_upf_info_item_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/interface_upf_info_item.h b/lib/sbi/openapi/model/interface_upf_info_item.h new file mode 100644 index 000000000..0d5d3d72b --- /dev/null +++ b/lib/sbi/openapi/model/interface_upf_info_item.h @@ -0,0 +1,46 @@ +/* + * interface_upf_info_item.h + * + * + */ + +#ifndef _OpenAPI_interface_upf_info_item_H_ +#define _OpenAPI_interface_upf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "up_interface_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_interface_upf_info_item_s OpenAPI_interface_upf_info_item_t; +typedef struct OpenAPI_interface_upf_info_item_s { + struct OpenAPI_up_interface_type_s *interface_type; + OpenAPI_list_t *ipv4_endpoint_addresses; + OpenAPI_list_t *ipv6_endpoint_addresses; + char *endpoint_fqdn; + char *network_instance; +} OpenAPI_interface_upf_info_item_t; + +OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_create( + OpenAPI_up_interface_type_t *interface_type, + OpenAPI_list_t *ipv4_endpoint_addresses, + OpenAPI_list_t *ipv6_endpoint_addresses, + char *endpoint_fqdn, + char *network_instance + ); +void OpenAPI_interface_upf_info_item_free(OpenAPI_interface_upf_info_item_t *interface_upf_info_item); +OpenAPI_interface_upf_info_item_t *OpenAPI_interface_upf_info_item_parseFromJSON(cJSON *interface_upf_info_itemJSON); +cJSON *OpenAPI_interface_upf_info_item_convertToJSON(OpenAPI_interface_upf_info_item_t *interface_upf_info_item); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_interface_upf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/invalid_param.c b/lib/sbi/openapi/model/invalid_param.c new file mode 100644 index 000000000..8b0b37d5d --- /dev/null +++ b/lib/sbi/openapi/model/invalid_param.c @@ -0,0 +1,96 @@ + +#include +#include +#include +#include "invalid_param.h" + +OpenAPI_invalid_param_t *OpenAPI_invalid_param_create( + char *param, + char *reason + ) +{ + OpenAPI_invalid_param_t *invalid_param_local_var = OpenAPI_malloc(sizeof(OpenAPI_invalid_param_t)); + if (!invalid_param_local_var) { + return NULL; + } + invalid_param_local_var->param = param; + invalid_param_local_var->reason = reason; + + return invalid_param_local_var; +} + +void OpenAPI_invalid_param_free(OpenAPI_invalid_param_t *invalid_param) +{ + if (NULL == invalid_param) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(invalid_param->param); + ogs_free(invalid_param->reason); + ogs_free(invalid_param); +} + +cJSON *OpenAPI_invalid_param_convertToJSON(OpenAPI_invalid_param_t *invalid_param) +{ + cJSON *item = NULL; + + if (invalid_param == NULL) { + ogs_error("OpenAPI_invalid_param_convertToJSON() failed [InvalidParam]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!invalid_param->param) { + ogs_error("OpenAPI_invalid_param_convertToJSON() failed [param]"); + goto end; + } + if (cJSON_AddStringToObject(item, "param", invalid_param->param) == NULL) { + ogs_error("OpenAPI_invalid_param_convertToJSON() failed [param]"); + goto end; + } + + if (invalid_param->reason) { + if (cJSON_AddStringToObject(item, "reason", invalid_param->reason) == NULL) { + ogs_error("OpenAPI_invalid_param_convertToJSON() failed [reason]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_invalid_param_t *OpenAPI_invalid_param_parseFromJSON(cJSON *invalid_paramJSON) +{ + OpenAPI_invalid_param_t *invalid_param_local_var = NULL; + cJSON *param = cJSON_GetObjectItemCaseSensitive(invalid_paramJSON, "param"); + if (!param) { + ogs_error("OpenAPI_invalid_param_parseFromJSON() failed [param]"); + goto end; + } + + + if (!cJSON_IsString(param)) { + ogs_error("OpenAPI_invalid_param_parseFromJSON() failed [param]"); + goto end; + } + + cJSON *reason = cJSON_GetObjectItemCaseSensitive(invalid_paramJSON, "reason"); + + if (reason) { + if (!cJSON_IsString(reason)) { + ogs_error("OpenAPI_invalid_param_parseFromJSON() failed [reason]"); + goto end; + } + } + + invalid_param_local_var = OpenAPI_invalid_param_create ( + ogs_strdup(param->valuestring), + reason ? ogs_strdup(reason->valuestring) : NULL + ); + + return invalid_param_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/invalid_param.h b/lib/sbi/openapi/model/invalid_param.h new file mode 100644 index 000000000..74c94e0c4 --- /dev/null +++ b/lib/sbi/openapi/model/invalid_param.h @@ -0,0 +1,39 @@ +/* + * invalid_param.h + * + * + */ + +#ifndef _OpenAPI_invalid_param_H_ +#define _OpenAPI_invalid_param_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_invalid_param_s OpenAPI_invalid_param_t; +typedef struct OpenAPI_invalid_param_s { + char *param; + char *reason; +} OpenAPI_invalid_param_t; + +OpenAPI_invalid_param_t *OpenAPI_invalid_param_create( + char *param, + char *reason + ); +void OpenAPI_invalid_param_free(OpenAPI_invalid_param_t *invalid_param); +OpenAPI_invalid_param_t *OpenAPI_invalid_param_parseFromJSON(cJSON *invalid_paramJSON); +cJSON *OpenAPI_invalid_param_convertToJSON(OpenAPI_invalid_param_t *invalid_param); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_invalid_param_H_ */ + diff --git a/lib/sbi/openapi/model/ip_end_point.c b/lib/sbi/openapi/model/ip_end_point.c new file mode 100644 index 000000000..1feb470e3 --- /dev/null +++ b/lib/sbi/openapi/model/ip_end_point.c @@ -0,0 +1,131 @@ + +#include +#include +#include +#include "ip_end_point.h" + +OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_create( + char *ipv4_address, + char *ipv6_address, + OpenAPI_transport_protocol_e transport, + int port + ) +{ + OpenAPI_ip_end_point_t *ip_end_point_local_var = OpenAPI_malloc(sizeof(OpenAPI_ip_end_point_t)); + if (!ip_end_point_local_var) { + return NULL; + } + ip_end_point_local_var->ipv4_address = ipv4_address; + ip_end_point_local_var->ipv6_address = ipv6_address; + ip_end_point_local_var->transport = transport; + ip_end_point_local_var->port = port; + + return ip_end_point_local_var; +} + +void OpenAPI_ip_end_point_free(OpenAPI_ip_end_point_t *ip_end_point) +{ + if (NULL == ip_end_point) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ip_end_point->ipv4_address); + ogs_free(ip_end_point->ipv6_address); + ogs_free(ip_end_point); +} + +cJSON *OpenAPI_ip_end_point_convertToJSON(OpenAPI_ip_end_point_t *ip_end_point) +{ + cJSON *item = NULL; + + if (ip_end_point == NULL) { + ogs_error("OpenAPI_ip_end_point_convertToJSON() failed [IpEndPoint]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ip_end_point->ipv4_address) { + if (cJSON_AddStringToObject(item, "ipv4Address", ip_end_point->ipv4_address) == NULL) { + ogs_error("OpenAPI_ip_end_point_convertToJSON() failed [ipv4_address]"); + goto end; + } + } + + if (ip_end_point->ipv6_address) { + if (cJSON_AddStringToObject(item, "ipv6Address", ip_end_point->ipv6_address) == NULL) { + ogs_error("OpenAPI_ip_end_point_convertToJSON() failed [ipv6_address]"); + goto end; + } + } + + if (ip_end_point->transport) { + 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; + } + } + + if (ip_end_point->port) { + if (cJSON_AddNumberToObject(item, "port", ip_end_point->port) == NULL) { + ogs_error("OpenAPI_ip_end_point_convertToJSON() failed [port]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_parseFromJSON(cJSON *ip_end_pointJSON) +{ + OpenAPI_ip_end_point_t *ip_end_point_local_var = NULL; + cJSON *ipv4_address = cJSON_GetObjectItemCaseSensitive(ip_end_pointJSON, "ipv4Address"); + + if (ipv4_address) { + if (!cJSON_IsString(ipv4_address)) { + ogs_error("OpenAPI_ip_end_point_parseFromJSON() failed [ipv4_address]"); + goto end; + } + } + + cJSON *ipv6_address = cJSON_GetObjectItemCaseSensitive(ip_end_pointJSON, "ipv6Address"); + + if (ipv6_address) { + if (!cJSON_IsString(ipv6_address)) { + ogs_error("OpenAPI_ip_end_point_parseFromJSON() failed [ipv6_address]"); + goto end; + } + } + + cJSON *transport = cJSON_GetObjectItemCaseSensitive(ip_end_pointJSON, "transport"); + + OpenAPI_transport_protocol_e transportVariable; + if (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"); + + if (port) { + if (!cJSON_IsNumber(port)) { + ogs_error("OpenAPI_ip_end_point_parseFromJSON() failed [port]"); + goto end; + } + } + + 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 ? transportVariable : 0, + port ? port->valuedouble : 0 + ); + + return ip_end_point_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/ip_end_point.h b/lib/sbi/openapi/model/ip_end_point.h new file mode 100644 index 000000000..f6773e65d --- /dev/null +++ b/lib/sbi/openapi/model/ip_end_point.h @@ -0,0 +1,44 @@ +/* + * ip_end_point.h + * + * + */ + +#ifndef _OpenAPI_ip_end_point_H_ +#define _OpenAPI_ip_end_point_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "transport_protocol.h" + +#ifdef __cplusplus +extern "C" { +#endif + +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; + 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_e transport, + int port + ); +void OpenAPI_ip_end_point_free(OpenAPI_ip_end_point_t *ip_end_point); +OpenAPI_ip_end_point_t *OpenAPI_ip_end_point_parseFromJSON(cJSON *ip_end_pointJSON); +cJSON *OpenAPI_ip_end_point_convertToJSON(OpenAPI_ip_end_point_t *ip_end_point); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_end_point_H_ */ + diff --git a/lib/sbi/openapi/model/ipv4_address_range.c b/lib/sbi/openapi/model/ipv4_address_range.c new file mode 100644 index 000000000..7a953003e --- /dev/null +++ b/lib/sbi/openapi/model/ipv4_address_range.c @@ -0,0 +1,91 @@ + +#include +#include +#include +#include "ipv4_address_range.h" + +OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_create( + char *start, + char *end + ) +{ + OpenAPI_ipv4_address_range_t *ipv4_address_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_ipv4_address_range_t)); + if (!ipv4_address_range_local_var) { + return NULL; + } + ipv4_address_range_local_var->start = start; + ipv4_address_range_local_var->end = end; + + return ipv4_address_range_local_var; +} + +void OpenAPI_ipv4_address_range_free(OpenAPI_ipv4_address_range_t *ipv4_address_range) +{ + if (NULL == ipv4_address_range) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ipv4_address_range->start); + ogs_free(ipv4_address_range->end); + ogs_free(ipv4_address_range); +} + +cJSON *OpenAPI_ipv4_address_range_convertToJSON(OpenAPI_ipv4_address_range_t *ipv4_address_range) +{ + cJSON *item = NULL; + + if (ipv4_address_range == NULL) { + ogs_error("OpenAPI_ipv4_address_range_convertToJSON() failed [Ipv4AddressRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ipv4_address_range->start) { + if (cJSON_AddStringToObject(item, "start", ipv4_address_range->start) == NULL) { + ogs_error("OpenAPI_ipv4_address_range_convertToJSON() failed [start]"); + goto end; + } + } + + if (ipv4_address_range->end) { + if (cJSON_AddStringToObject(item, "end", ipv4_address_range->end) == NULL) { + ogs_error("OpenAPI_ipv4_address_range_convertToJSON() failed [end]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_parseFromJSON(cJSON *ipv4_address_rangeJSON) +{ + OpenAPI_ipv4_address_range_t *ipv4_address_range_local_var = NULL; + cJSON *start = cJSON_GetObjectItemCaseSensitive(ipv4_address_rangeJSON, "start"); + + if (start) { + if (!cJSON_IsString(start)) { + ogs_error("OpenAPI_ipv4_address_range_parseFromJSON() failed [start]"); + goto end; + } + } + + cJSON *end = cJSON_GetObjectItemCaseSensitive(ipv4_address_rangeJSON, "end"); + + if (end) { + if (!cJSON_IsString(end)) { + ogs_error("OpenAPI_ipv4_address_range_parseFromJSON() failed [end]"); + goto end; + } + } + + ipv4_address_range_local_var = OpenAPI_ipv4_address_range_create ( + start ? ogs_strdup(start->valuestring) : NULL, + end ? ogs_strdup(end->valuestring) : NULL + ); + + return ipv4_address_range_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/ipv4_address_range.h b/lib/sbi/openapi/model/ipv4_address_range.h new file mode 100644 index 000000000..c3cf991db --- /dev/null +++ b/lib/sbi/openapi/model/ipv4_address_range.h @@ -0,0 +1,39 @@ +/* + * ipv4_address_range.h + * + * + */ + +#ifndef _OpenAPI_ipv4_address_range_H_ +#define _OpenAPI_ipv4_address_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_ipv4_address_range_s OpenAPI_ipv4_address_range_t; +typedef struct OpenAPI_ipv4_address_range_s { + char *start; + char *end; +} OpenAPI_ipv4_address_range_t; + +OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_create( + char *start, + char *end + ); +void OpenAPI_ipv4_address_range_free(OpenAPI_ipv4_address_range_t *ipv4_address_range); +OpenAPI_ipv4_address_range_t *OpenAPI_ipv4_address_range_parseFromJSON(cJSON *ipv4_address_rangeJSON); +cJSON *OpenAPI_ipv4_address_range_convertToJSON(OpenAPI_ipv4_address_range_t *ipv4_address_range); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ipv4_address_range_H_ */ + diff --git a/lib/sbi/openapi/model/ipv6_prefix_range.c b/lib/sbi/openapi/model/ipv6_prefix_range.c new file mode 100644 index 000000000..ef0a8fe65 --- /dev/null +++ b/lib/sbi/openapi/model/ipv6_prefix_range.c @@ -0,0 +1,91 @@ + +#include +#include +#include +#include "ipv6_prefix_range.h" + +OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_create( + char *start, + char *end + ) +{ + OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_ipv6_prefix_range_t)); + if (!ipv6_prefix_range_local_var) { + return NULL; + } + ipv6_prefix_range_local_var->start = start; + ipv6_prefix_range_local_var->end = end; + + return ipv6_prefix_range_local_var; +} + +void OpenAPI_ipv6_prefix_range_free(OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range) +{ + if (NULL == ipv6_prefix_range) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(ipv6_prefix_range->start); + ogs_free(ipv6_prefix_range->end); + ogs_free(ipv6_prefix_range); +} + +cJSON *OpenAPI_ipv6_prefix_range_convertToJSON(OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range) +{ + cJSON *item = NULL; + + if (ipv6_prefix_range == NULL) { + ogs_error("OpenAPI_ipv6_prefix_range_convertToJSON() failed [Ipv6PrefixRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ipv6_prefix_range->start) { + if (cJSON_AddStringToObject(item, "start", ipv6_prefix_range->start) == NULL) { + ogs_error("OpenAPI_ipv6_prefix_range_convertToJSON() failed [start]"); + goto end; + } + } + + if (ipv6_prefix_range->end) { + if (cJSON_AddStringToObject(item, "end", ipv6_prefix_range->end) == NULL) { + ogs_error("OpenAPI_ipv6_prefix_range_convertToJSON() failed [end]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_parseFromJSON(cJSON *ipv6_prefix_rangeJSON) +{ + OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range_local_var = NULL; + cJSON *start = cJSON_GetObjectItemCaseSensitive(ipv6_prefix_rangeJSON, "start"); + + if (start) { + if (!cJSON_IsString(start)) { + ogs_error("OpenAPI_ipv6_prefix_range_parseFromJSON() failed [start]"); + goto end; + } + } + + cJSON *end = cJSON_GetObjectItemCaseSensitive(ipv6_prefix_rangeJSON, "end"); + + if (end) { + if (!cJSON_IsString(end)) { + ogs_error("OpenAPI_ipv6_prefix_range_parseFromJSON() failed [end]"); + goto end; + } + } + + ipv6_prefix_range_local_var = OpenAPI_ipv6_prefix_range_create ( + start ? ogs_strdup(start->valuestring) : NULL, + end ? ogs_strdup(end->valuestring) : NULL + ); + + return ipv6_prefix_range_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/ipv6_prefix_range.h b/lib/sbi/openapi/model/ipv6_prefix_range.h new file mode 100644 index 000000000..7366cdbd6 --- /dev/null +++ b/lib/sbi/openapi/model/ipv6_prefix_range.h @@ -0,0 +1,39 @@ +/* + * ipv6_prefix_range.h + * + * + */ + +#ifndef _OpenAPI_ipv6_prefix_range_H_ +#define _OpenAPI_ipv6_prefix_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_ipv6_prefix_range_s OpenAPI_ipv6_prefix_range_t; +typedef struct OpenAPI_ipv6_prefix_range_s { + char *start; + char *end; +} OpenAPI_ipv6_prefix_range_t; + +OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_create( + char *start, + char *end + ); +void OpenAPI_ipv6_prefix_range_free(OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range); +OpenAPI_ipv6_prefix_range_t *OpenAPI_ipv6_prefix_range_parseFromJSON(cJSON *ipv6_prefix_rangeJSON); +cJSON *OpenAPI_ipv6_prefix_range_convertToJSON(OpenAPI_ipv6_prefix_range_t *ipv6_prefix_range); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ipv6_prefix_range_H_ */ + diff --git a/lib/sbi/openapi/model/link.c b/lib/sbi/openapi/model/link.c new file mode 100644 index 000000000..c60ad9813 --- /dev/null +++ b/lib/sbi/openapi/model/link.c @@ -0,0 +1,71 @@ + +#include +#include +#include +#include "link.h" + +OpenAPI_link_t *OpenAPI_link_create( + char *href + ) +{ + OpenAPI_link_t *link_local_var = OpenAPI_malloc(sizeof(OpenAPI_link_t)); + if (!link_local_var) { + return NULL; + } + link_local_var->href = href; + + return link_local_var; +} + +void OpenAPI_link_free(OpenAPI_link_t *link) +{ + if (NULL == link) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(link->href); + ogs_free(link); +} + +cJSON *OpenAPI_link_convertToJSON(OpenAPI_link_t *link) +{ + cJSON *item = NULL; + + if (link == NULL) { + ogs_error("OpenAPI_link_convertToJSON() failed [Link]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (link->href) { + if (cJSON_AddStringToObject(item, "href", link->href) == NULL) { + ogs_error("OpenAPI_link_convertToJSON() failed [href]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_link_t *OpenAPI_link_parseFromJSON(cJSON *linkJSON) +{ + OpenAPI_link_t *link_local_var = NULL; + cJSON *href = cJSON_GetObjectItemCaseSensitive(linkJSON, "href"); + + if (href) { + if (!cJSON_IsString(href)) { + ogs_error("OpenAPI_link_parseFromJSON() failed [href]"); + goto end; + } + } + + link_local_var = OpenAPI_link_create ( + href ? ogs_strdup(href->valuestring) : NULL + ); + + return link_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/link.h b/lib/sbi/openapi/model/link.h new file mode 100644 index 000000000..a7e59b37b --- /dev/null +++ b/lib/sbi/openapi/model/link.h @@ -0,0 +1,37 @@ +/* + * link.h + * + * + */ + +#ifndef _OpenAPI_link_H_ +#define _OpenAPI_link_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_link_s OpenAPI_link_t; +typedef struct OpenAPI_link_s { + char *href; +} OpenAPI_link_t; + +OpenAPI_link_t *OpenAPI_link_create( + char *href + ); +void OpenAPI_link_free(OpenAPI_link_t *link); +OpenAPI_link_t *OpenAPI_link_parseFromJSON(cJSON *linkJSON); +cJSON *OpenAPI_link_convertToJSON(OpenAPI_link_t *link); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_link_H_ */ + diff --git a/lib/sbi/openapi/model/links_value_schema.c b/lib/sbi/openapi/model/links_value_schema.c new file mode 100644 index 000000000..926433476 --- /dev/null +++ b/lib/sbi/openapi/model/links_value_schema.c @@ -0,0 +1,71 @@ + +#include +#include +#include +#include "links_value_schema.h" + +OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_create( + char *href + ) +{ + OpenAPI_links_value_schema_t *links_value_schema_local_var = OpenAPI_malloc(sizeof(OpenAPI_links_value_schema_t)); + if (!links_value_schema_local_var) { + return NULL; + } + links_value_schema_local_var->href = href; + + return links_value_schema_local_var; +} + +void OpenAPI_links_value_schema_free(OpenAPI_links_value_schema_t *links_value_schema) +{ + if (NULL == links_value_schema) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(links_value_schema->href); + ogs_free(links_value_schema); +} + +cJSON *OpenAPI_links_value_schema_convertToJSON(OpenAPI_links_value_schema_t *links_value_schema) +{ + cJSON *item = NULL; + + if (links_value_schema == NULL) { + ogs_error("OpenAPI_links_value_schema_convertToJSON() failed [LinksValueSchema]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (links_value_schema->href) { + if (cJSON_AddStringToObject(item, "href", links_value_schema->href) == NULL) { + ogs_error("OpenAPI_links_value_schema_convertToJSON() failed [href]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_parseFromJSON(cJSON *links_value_schemaJSON) +{ + OpenAPI_links_value_schema_t *links_value_schema_local_var = NULL; + cJSON *href = cJSON_GetObjectItemCaseSensitive(links_value_schemaJSON, "href"); + + if (href) { + if (!cJSON_IsString(href)) { + ogs_error("OpenAPI_links_value_schema_parseFromJSON() failed [href]"); + goto end; + } + } + + links_value_schema_local_var = OpenAPI_links_value_schema_create ( + href ? ogs_strdup(href->valuestring) : NULL + ); + + return links_value_schema_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/links_value_schema.h b/lib/sbi/openapi/model/links_value_schema.h new file mode 100644 index 000000000..522fec49b --- /dev/null +++ b/lib/sbi/openapi/model/links_value_schema.h @@ -0,0 +1,38 @@ +/* + * links_value_schema.h + * + * + */ + +#ifndef _OpenAPI_links_value_schema_H_ +#define _OpenAPI_links_value_schema_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "link.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_links_value_schema_s OpenAPI_links_value_schema_t; +typedef struct OpenAPI_links_value_schema_s { + char *href; +} OpenAPI_links_value_schema_t; + +OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_create( + char *href + ); +void OpenAPI_links_value_schema_free(OpenAPI_links_value_schema_t *links_value_schema); +OpenAPI_links_value_schema_t *OpenAPI_links_value_schema_parseFromJSON(cJSON *links_value_schemaJSON); +cJSON *OpenAPI_links_value_schema_convertToJSON(OpenAPI_links_value_schema_t *links_value_schema); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_links_value_schema_H_ */ + diff --git a/lib/sbi/openapi/model/n1_message_class.c b/lib/sbi/openapi/model/n1_message_class.c new file mode 100644 index 000000000..33c453346 --- /dev/null +++ b/lib/sbi/openapi/model/n1_message_class.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n1_message_class.h" + +char* OpenAPI_n1_message_class_ToString(OpenAPI_n1_message_class_e n1_message_class) +{ + const char *n1_message_classArray[] = { "NULL", "5GMM", "SM", "LPP", "SMS", "UPDP" }; + size_t sizeofArray = sizeof(n1_message_classArray) / sizeof(n1_message_classArray[0]); + if (n1_message_class < sizeofArray) + return (char *)n1_message_classArray[n1_message_class]; + else + return (char *)"Unknown"; +} + +OpenAPI_n1_message_class_e OpenAPI_n1_message_class_FromString(char* n1_message_class) +{ + int stringToReturn = 0; + const char *n1_message_classArray[] = { "NULL", "5GMM", "SM", "LPP", "SMS", "UPDP" }; + size_t sizeofArray = sizeof(n1_message_classArray) / sizeof(n1_message_classArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n1_message_class, n1_message_classArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n1_message_class.h b/lib/sbi/openapi/model/n1_message_class.h new file mode 100644 index 000000000..2c2cd1112 --- /dev/null +++ b/lib/sbi/openapi/model/n1_message_class.h @@ -0,0 +1,31 @@ +/* + * n1_message_class.h + * + * + */ + +#ifndef _OpenAPI_n1_message_class_H_ +#define _OpenAPI_n1_message_class_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_n1_message_class_NULL = 0, OpenAPI_n1_message_class_5GMM, OpenAPI_n1_message_class_SM, OpenAPI_n1_message_class_LPP, OpenAPI_n1_message_class_SMS, OpenAPI_n1_message_class_UPDP } OpenAPI_n1_message_class_e; + +char* OpenAPI_n1_message_class_ToString(OpenAPI_n1_message_class_e n1_message_class); + +OpenAPI_n1_message_class_e OpenAPI_n1_message_class_FromString(char* n1_message_class); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n1_message_class_H_ */ + diff --git a/lib/sbi/openapi/model/n2_information_class.c b/lib/sbi/openapi/model/n2_information_class.c new file mode 100644 index 000000000..6a03f7170 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_class.c @@ -0,0 +1,51 @@ + +#include +#include +#include +#include "n2_information_class.h" + +OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_create( + ) +{ + OpenAPI_n2_information_class_t *n2_information_class_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_information_class_t)); + if (!n2_information_class_local_var) { + return NULL; + } + + return n2_information_class_local_var; +} + +void OpenAPI_n2_information_class_free(OpenAPI_n2_information_class_t *n2_information_class) +{ + if (NULL == n2_information_class) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(n2_information_class); +} + +cJSON *OpenAPI_n2_information_class_convertToJSON(OpenAPI_n2_information_class_t *n2_information_class) +{ + cJSON *item = NULL; + + if (n2_information_class == NULL) { + ogs_error("OpenAPI_n2_information_class_convertToJSON() failed [N2InformationClass]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_parseFromJSON(cJSON *n2_information_classJSON) +{ + OpenAPI_n2_information_class_t *n2_information_class_local_var = NULL; + n2_information_class_local_var = OpenAPI_n2_information_class_create ( + ); + + return n2_information_class_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/n2_information_class.h b/lib/sbi/openapi/model/n2_information_class.h new file mode 100644 index 000000000..716e6fba9 --- /dev/null +++ b/lib/sbi/openapi/model/n2_information_class.h @@ -0,0 +1,35 @@ +/* + * n2_information_class.h + * + * + */ + +#ifndef _OpenAPI_n2_information_class_H_ +#define _OpenAPI_n2_information_class_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_n2_information_class_s OpenAPI_n2_information_class_t; +typedef struct OpenAPI_n2_information_class_s { +} OpenAPI_n2_information_class_t; + +OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_create( + ); +void OpenAPI_n2_information_class_free(OpenAPI_n2_information_class_t *n2_information_class); +OpenAPI_n2_information_class_t *OpenAPI_n2_information_class_parseFromJSON(cJSON *n2_information_classJSON); +cJSON *OpenAPI_n2_information_class_convertToJSON(OpenAPI_n2_information_class_t *n2_information_class); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_information_class_H_ */ + diff --git a/lib/sbi/openapi/model/n2_interface_amf_info.c b/lib/sbi/openapi/model/n2_interface_amf_info.c new file mode 100644 index 000000000..845d9108e --- /dev/null +++ b/lib/sbi/openapi/model/n2_interface_amf_info.c @@ -0,0 +1,157 @@ + +#include +#include +#include +#include "n2_interface_amf_info.h" + +OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_create( + OpenAPI_list_t *ipv4_endpoint_address, + OpenAPI_list_t *ipv6_endpoint_address, + char *amf_name + ) +{ + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_n2_interface_amf_info_t)); + if (!n2_interface_amf_info_local_var) { + return NULL; + } + n2_interface_amf_info_local_var->ipv4_endpoint_address = ipv4_endpoint_address; + n2_interface_amf_info_local_var->ipv6_endpoint_address = ipv6_endpoint_address; + n2_interface_amf_info_local_var->amf_name = amf_name; + + return n2_interface_amf_info_local_var; +} + +void OpenAPI_n2_interface_amf_info_free(OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info) +{ + if (NULL == n2_interface_amf_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(n2_interface_amf_info->ipv4_endpoint_address, node) { + ogs_free(node->data); + } + OpenAPI_list_free(n2_interface_amf_info->ipv4_endpoint_address); + OpenAPI_list_for_each(n2_interface_amf_info->ipv6_endpoint_address, node) { + ogs_free(node->data); + } + OpenAPI_list_free(n2_interface_amf_info->ipv6_endpoint_address); + ogs_free(n2_interface_amf_info->amf_name); + ogs_free(n2_interface_amf_info); +} + +cJSON *OpenAPI_n2_interface_amf_info_convertToJSON(OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info) +{ + cJSON *item = NULL; + + if (n2_interface_amf_info == NULL) { + ogs_error("OpenAPI_n2_interface_amf_info_convertToJSON() failed [N2InterfaceAmfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n2_interface_amf_info->ipv4_endpoint_address) { + cJSON *ipv4_endpoint_address = cJSON_AddArrayToObject(item, "ipv4EndpointAddress"); + if (ipv4_endpoint_address == NULL) { + ogs_error("OpenAPI_n2_interface_amf_info_convertToJSON() failed [ipv4_endpoint_address]"); + goto end; + } + + OpenAPI_lnode_t *ipv4_endpoint_address_node; + OpenAPI_list_for_each(n2_interface_amf_info->ipv4_endpoint_address, ipv4_endpoint_address_node) { + if (cJSON_AddStringToObject(ipv4_endpoint_address, "", (char*)ipv4_endpoint_address_node->data) == NULL) { + ogs_error("OpenAPI_n2_interface_amf_info_convertToJSON() failed [ipv4_endpoint_address]"); + goto end; + } + } + } + + if (n2_interface_amf_info->ipv6_endpoint_address) { + cJSON *ipv6_endpoint_address = cJSON_AddArrayToObject(item, "ipv6EndpointAddress"); + if (ipv6_endpoint_address == NULL) { + ogs_error("OpenAPI_n2_interface_amf_info_convertToJSON() failed [ipv6_endpoint_address]"); + goto end; + } + + OpenAPI_lnode_t *ipv6_endpoint_address_node; + OpenAPI_list_for_each(n2_interface_amf_info->ipv6_endpoint_address, ipv6_endpoint_address_node) { + if (cJSON_AddStringToObject(ipv6_endpoint_address, "", (char*)ipv6_endpoint_address_node->data) == NULL) { + ogs_error("OpenAPI_n2_interface_amf_info_convertToJSON() failed [ipv6_endpoint_address]"); + goto end; + } + } + } + + if (n2_interface_amf_info->amf_name) { + if (cJSON_AddStringToObject(item, "amfName", n2_interface_amf_info->amf_name) == NULL) { + ogs_error("OpenAPI_n2_interface_amf_info_convertToJSON() failed [amf_name]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_parseFromJSON(cJSON *n2_interface_amf_infoJSON) +{ + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info_local_var = NULL; + cJSON *ipv4_endpoint_address = cJSON_GetObjectItemCaseSensitive(n2_interface_amf_infoJSON, "ipv4EndpointAddress"); + + OpenAPI_list_t *ipv4_endpoint_addressList; + if (ipv4_endpoint_address) { + cJSON *ipv4_endpoint_address_local; + if (!cJSON_IsArray(ipv4_endpoint_address)) { + ogs_error("OpenAPI_n2_interface_amf_info_parseFromJSON() failed [ipv4_endpoint_address]"); + goto end; + } + ipv4_endpoint_addressList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_endpoint_address_local, ipv4_endpoint_address) { + if (!cJSON_IsString(ipv4_endpoint_address_local)) { + ogs_error("OpenAPI_n2_interface_amf_info_parseFromJSON() failed [ipv4_endpoint_address]"); + goto end; + } + OpenAPI_list_add(ipv4_endpoint_addressList, ogs_strdup(ipv4_endpoint_address_local->valuestring)); + } + } + + cJSON *ipv6_endpoint_address = cJSON_GetObjectItemCaseSensitive(n2_interface_amf_infoJSON, "ipv6EndpointAddress"); + + OpenAPI_list_t *ipv6_endpoint_addressList; + if (ipv6_endpoint_address) { + cJSON *ipv6_endpoint_address_local; + if (!cJSON_IsArray(ipv6_endpoint_address)) { + ogs_error("OpenAPI_n2_interface_amf_info_parseFromJSON() failed [ipv6_endpoint_address]"); + goto end; + } + ipv6_endpoint_addressList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_endpoint_address_local, ipv6_endpoint_address) { + if (!cJSON_IsString(ipv6_endpoint_address_local)) { + ogs_error("OpenAPI_n2_interface_amf_info_parseFromJSON() failed [ipv6_endpoint_address]"); + goto end; + } + OpenAPI_list_add(ipv6_endpoint_addressList, ogs_strdup(ipv6_endpoint_address_local->valuestring)); + } + } + + cJSON *amf_name = cJSON_GetObjectItemCaseSensitive(n2_interface_amf_infoJSON, "amfName"); + + if (amf_name) { + if (!cJSON_IsString(amf_name)) { + ogs_error("OpenAPI_n2_interface_amf_info_parseFromJSON() failed [amf_name]"); + goto end; + } + } + + n2_interface_amf_info_local_var = OpenAPI_n2_interface_amf_info_create ( + ipv4_endpoint_address ? ipv4_endpoint_addressList : NULL, + ipv6_endpoint_address ? ipv6_endpoint_addressList : NULL, + amf_name ? ogs_strdup(amf_name->valuestring) : NULL + ); + + return n2_interface_amf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/n2_interface_amf_info.h b/lib/sbi/openapi/model/n2_interface_amf_info.h new file mode 100644 index 000000000..87807c60d --- /dev/null +++ b/lib/sbi/openapi/model/n2_interface_amf_info.h @@ -0,0 +1,41 @@ +/* + * n2_interface_amf_info.h + * + * + */ + +#ifndef _OpenAPI_n2_interface_amf_info_H_ +#define _OpenAPI_n2_interface_amf_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_n2_interface_amf_info_s OpenAPI_n2_interface_amf_info_t; +typedef struct OpenAPI_n2_interface_amf_info_s { + OpenAPI_list_t *ipv4_endpoint_address; + OpenAPI_list_t *ipv6_endpoint_address; + char *amf_name; +} OpenAPI_n2_interface_amf_info_t; + +OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_create( + OpenAPI_list_t *ipv4_endpoint_address, + OpenAPI_list_t *ipv6_endpoint_address, + char *amf_name + ); +void OpenAPI_n2_interface_amf_info_free(OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info); +OpenAPI_n2_interface_amf_info_t *OpenAPI_n2_interface_amf_info_parseFromJSON(cJSON *n2_interface_amf_infoJSON); +cJSON *OpenAPI_n2_interface_amf_info_convertToJSON(OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_interface_amf_info_H_ */ + diff --git a/lib/sbi/openapi/model/network_slice_cond.c b/lib/sbi/openapi/model/network_slice_cond.c new file mode 100644 index 000000000..2d9c65bee --- /dev/null +++ b/lib/sbi/openapi/model/network_slice_cond.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "network_slice_cond.h" + +OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_create( + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *nsi_list + ) +{ + OpenAPI_network_slice_cond_t *network_slice_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_network_slice_cond_t)); + if (!network_slice_cond_local_var) { + return NULL; + } + network_slice_cond_local_var->snssai_list = snssai_list; + network_slice_cond_local_var->nsi_list = nsi_list; + + return network_slice_cond_local_var; +} + +void OpenAPI_network_slice_cond_free(OpenAPI_network_slice_cond_t *network_slice_cond) +{ + if (NULL == network_slice_cond) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(network_slice_cond->snssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(network_slice_cond->snssai_list); + OpenAPI_list_for_each(network_slice_cond->nsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(network_slice_cond->nsi_list); + ogs_free(network_slice_cond); +} + +cJSON *OpenAPI_network_slice_cond_convertToJSON(OpenAPI_network_slice_cond_t *network_slice_cond) +{ + cJSON *item = NULL; + + if (network_slice_cond == NULL) { + ogs_error("OpenAPI_network_slice_cond_convertToJSON() failed [NetworkSliceCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!network_slice_cond->snssai_list) { + ogs_error("OpenAPI_network_slice_cond_convertToJSON() failed [snssai_list]"); + goto end; + } + cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); + if (snssai_listList == NULL) { + ogs_error("OpenAPI_network_slice_cond_convertToJSON() failed [snssai_list]"); + goto end; + } + + OpenAPI_lnode_t *snssai_list_node; + if (network_slice_cond->snssai_list) { + OpenAPI_list_for_each(network_slice_cond->snssai_list, snssai_list_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(snssai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_network_slice_cond_convertToJSON() failed [snssai_list]"); + goto end; + } + cJSON_AddItemToArray(snssai_listList, itemLocal); + } + } + + if (network_slice_cond->nsi_list) { + cJSON *nsi_list = cJSON_AddArrayToObject(item, "nsiList"); + if (nsi_list == NULL) { + ogs_error("OpenAPI_network_slice_cond_convertToJSON() failed [nsi_list]"); + goto end; + } + + OpenAPI_lnode_t *nsi_list_node; + OpenAPI_list_for_each(network_slice_cond->nsi_list, nsi_list_node) { + if (cJSON_AddStringToObject(nsi_list, "", (char*)nsi_list_node->data) == NULL) { + ogs_error("OpenAPI_network_slice_cond_convertToJSON() failed [nsi_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_parseFromJSON(cJSON *network_slice_condJSON) +{ + OpenAPI_network_slice_cond_t *network_slice_cond_local_var = NULL; + cJSON *snssai_list = cJSON_GetObjectItemCaseSensitive(network_slice_condJSON, "snssaiList"); + if (!snssai_list) { + ogs_error("OpenAPI_network_slice_cond_parseFromJSON() failed [snssai_list]"); + goto end; + } + + OpenAPI_list_t *snssai_listList; + + cJSON *snssai_list_local_nonprimitive; + if (!cJSON_IsArray(snssai_list)) { + ogs_error("OpenAPI_network_slice_cond_parseFromJSON() failed [snssai_list]"); + goto end; + } + + snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssai_list_local_nonprimitive, snssai_list ) { + if (!cJSON_IsObject(snssai_list_local_nonprimitive)) { + ogs_error("OpenAPI_network_slice_cond_parseFromJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local_nonprimitive); + + OpenAPI_list_add(snssai_listList, snssai_listItem); + } + + cJSON *nsi_list = cJSON_GetObjectItemCaseSensitive(network_slice_condJSON, "nsiList"); + + OpenAPI_list_t *nsi_listList; + if (nsi_list) { + cJSON *nsi_list_local; + if (!cJSON_IsArray(nsi_list)) { + ogs_error("OpenAPI_network_slice_cond_parseFromJSON() failed [nsi_list]"); + goto end; + } + nsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_list_local, nsi_list) { + if (!cJSON_IsString(nsi_list_local)) { + ogs_error("OpenAPI_network_slice_cond_parseFromJSON() failed [nsi_list]"); + goto end; + } + OpenAPI_list_add(nsi_listList, ogs_strdup(nsi_list_local->valuestring)); + } + } + + network_slice_cond_local_var = OpenAPI_network_slice_cond_create ( + snssai_listList, + nsi_list ? nsi_listList : NULL + ); + + return network_slice_cond_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/network_slice_cond.h b/lib/sbi/openapi/model/network_slice_cond.h new file mode 100644 index 000000000..2152c8c0e --- /dev/null +++ b/lib/sbi/openapi/model/network_slice_cond.h @@ -0,0 +1,40 @@ +/* + * network_slice_cond.h + * + * + */ + +#ifndef _OpenAPI_network_slice_cond_H_ +#define _OpenAPI_network_slice_cond_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_network_slice_cond_s OpenAPI_network_slice_cond_t; +typedef struct OpenAPI_network_slice_cond_s { + OpenAPI_list_t *snssai_list; + OpenAPI_list_t *nsi_list; +} OpenAPI_network_slice_cond_t; + +OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_create( + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *nsi_list + ); +void OpenAPI_network_slice_cond_free(OpenAPI_network_slice_cond_t *network_slice_cond); +OpenAPI_network_slice_cond_t *OpenAPI_network_slice_cond_parseFromJSON(cJSON *network_slice_condJSON); +cJSON *OpenAPI_network_slice_cond_convertToJSON(OpenAPI_network_slice_cond_t *network_slice_cond); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_network_slice_cond_H_ */ + diff --git a/lib/sbi/openapi/model/nf_group_cond.c b/lib/sbi/openapi/model/nf_group_cond.c new file mode 100644 index 000000000..01eb3628d --- /dev/null +++ b/lib/sbi/openapi/model/nf_group_cond.c @@ -0,0 +1,125 @@ + +#include +#include +#include +#include "nf_group_cond.h" + +char *OpenAPI_nf_typenf_group_cond_ToString(OpenAPI_nf_group_cond_nf_type_e nf_type) +{ + const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF" }; + size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); + if (nf_type < sizeofArray) + return (char *)nf_typeArray[nf_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_nf_group_cond_nf_type_e OpenAPI_nf_typenf_group_cond_FromString(char* nf_type) +{ + int stringToReturn = 0; + const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF" }; + size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(nf_type, nf_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} +OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_create( + OpenAPI_nf_group_cond_nf_type_e nf_type, + char *nf_group_id + ) +{ + OpenAPI_nf_group_cond_t *nf_group_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_group_cond_t)); + if (!nf_group_cond_local_var) { + return NULL; + } + nf_group_cond_local_var->nf_type = nf_type; + nf_group_cond_local_var->nf_group_id = nf_group_id; + + return nf_group_cond_local_var; +} + +void OpenAPI_nf_group_cond_free(OpenAPI_nf_group_cond_t *nf_group_cond) +{ + if (NULL == nf_group_cond) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nf_group_cond->nf_group_id); + ogs_free(nf_group_cond); +} + +cJSON *OpenAPI_nf_group_cond_convertToJSON(OpenAPI_nf_group_cond_t *nf_group_cond) +{ + cJSON *item = NULL; + + if (nf_group_cond == NULL) { + ogs_error("OpenAPI_nf_group_cond_convertToJSON() failed [NfGroupCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nf_group_cond->nf_type) { + ogs_error("OpenAPI_nf_group_cond_convertToJSON() failed [nf_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_typenf_group_cond_ToString(nf_group_cond->nf_type)) == NULL) { + ogs_error("OpenAPI_nf_group_cond_convertToJSON() failed [nf_type]"); + goto end; + } + + if (!nf_group_cond->nf_group_id) { + ogs_error("OpenAPI_nf_group_cond_convertToJSON() failed [nf_group_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfGroupId", nf_group_cond->nf_group_id) == NULL) { + ogs_error("OpenAPI_nf_group_cond_convertToJSON() failed [nf_group_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_parseFromJSON(cJSON *nf_group_condJSON) +{ + OpenAPI_nf_group_cond_t *nf_group_cond_local_var = NULL; + cJSON *nf_type = cJSON_GetObjectItemCaseSensitive(nf_group_condJSON, "nfType"); + if (!nf_type) { + ogs_error("OpenAPI_nf_group_cond_parseFromJSON() failed [nf_type]"); + goto end; + } + + OpenAPI_nf_group_cond_nf_type_e nf_typeVariable; + + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_nf_group_cond_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_nf_typenf_group_cond_FromString(nf_type->valuestring); + + cJSON *nf_group_id = cJSON_GetObjectItemCaseSensitive(nf_group_condJSON, "nfGroupId"); + if (!nf_group_id) { + ogs_error("OpenAPI_nf_group_cond_parseFromJSON() failed [nf_group_id]"); + goto end; + } + + + if (!cJSON_IsString(nf_group_id)) { + ogs_error("OpenAPI_nf_group_cond_parseFromJSON() failed [nf_group_id]"); + goto end; + } + + nf_group_cond_local_var = OpenAPI_nf_group_cond_create ( + nf_typeVariable, + ogs_strdup(nf_group_id->valuestring) + ); + + return nf_group_cond_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nf_group_cond.h b/lib/sbi/openapi/model/nf_group_cond.h new file mode 100644 index 000000000..5184c61a1 --- /dev/null +++ b/lib/sbi/openapi/model/nf_group_cond.h @@ -0,0 +1,44 @@ +/* + * nf_group_cond.h + * + * + */ + +#ifndef _OpenAPI_nf_group_cond_H_ +#define _OpenAPI_nf_group_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_group_cond_s OpenAPI_nf_group_cond_t; +typedef enum { OpenAPI_nf_group_cond_NFTYPE_NULL = 0, OpenAPI_nf_group_cond_NFTYPE_UDM, OpenAPI_nf_group_cond_NFTYPE_AUSF, OpenAPI_nf_group_cond_NFTYPE_UDR, OpenAPI_nf_group_cond_NFTYPE_PCF } OpenAPI_nf_group_cond_nf_type_e; + +char* OpenAPI_nf_group_cond_nf_type_ToString(OpenAPI_nf_group_cond_nf_type_e nf_type); + +OpenAPI_nf_group_cond_nf_type_e OpenAPI_nf_group_cond_nf_type_FromString(char* nf_type); +typedef struct OpenAPI_nf_group_cond_s { + OpenAPI_nf_group_cond_nf_type_e nf_type; + char *nf_group_id; +} OpenAPI_nf_group_cond_t; + +OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_create( + OpenAPI_nf_group_cond_nf_type_e nf_type, + char *nf_group_id + ); +void OpenAPI_nf_group_cond_free(OpenAPI_nf_group_cond_t *nf_group_cond); +OpenAPI_nf_group_cond_t *OpenAPI_nf_group_cond_parseFromJSON(cJSON *nf_group_condJSON); +cJSON *OpenAPI_nf_group_cond_convertToJSON(OpenAPI_nf_group_cond_t *nf_group_cond); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_group_cond_H_ */ + diff --git a/lib/sbi/openapi/model/nf_instance_id_cond.c b/lib/sbi/openapi/model/nf_instance_id_cond.c new file mode 100644 index 000000000..f6a9ccc15 --- /dev/null +++ b/lib/sbi/openapi/model/nf_instance_id_cond.c @@ -0,0 +1,76 @@ + +#include +#include +#include +#include "nf_instance_id_cond.h" + +OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_create( + char *nf_instance_id + ) +{ + OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_instance_id_cond_t)); + if (!nf_instance_id_cond_local_var) { + return NULL; + } + nf_instance_id_cond_local_var->nf_instance_id = nf_instance_id; + + return nf_instance_id_cond_local_var; +} + +void OpenAPI_nf_instance_id_cond_free(OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond) +{ + if (NULL == nf_instance_id_cond) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nf_instance_id_cond->nf_instance_id); + ogs_free(nf_instance_id_cond); +} + +cJSON *OpenAPI_nf_instance_id_cond_convertToJSON(OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond) +{ + cJSON *item = NULL; + + if (nf_instance_id_cond == NULL) { + ogs_error("OpenAPI_nf_instance_id_cond_convertToJSON() failed [NfInstanceIdCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nf_instance_id_cond->nf_instance_id) { + ogs_error("OpenAPI_nf_instance_id_cond_convertToJSON() failed [nf_instance_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfInstanceId", nf_instance_id_cond->nf_instance_id) == NULL) { + ogs_error("OpenAPI_nf_instance_id_cond_convertToJSON() failed [nf_instance_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_parseFromJSON(cJSON *nf_instance_id_condJSON) +{ + OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond_local_var = NULL; + cJSON *nf_instance_id = cJSON_GetObjectItemCaseSensitive(nf_instance_id_condJSON, "nfInstanceId"); + if (!nf_instance_id) { + ogs_error("OpenAPI_nf_instance_id_cond_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + + + if (!cJSON_IsString(nf_instance_id)) { + ogs_error("OpenAPI_nf_instance_id_cond_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + + nf_instance_id_cond_local_var = OpenAPI_nf_instance_id_cond_create ( + ogs_strdup(nf_instance_id->valuestring) + ); + + return nf_instance_id_cond_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nf_instance_id_cond.h b/lib/sbi/openapi/model/nf_instance_id_cond.h new file mode 100644 index 000000000..961f0fc11 --- /dev/null +++ b/lib/sbi/openapi/model/nf_instance_id_cond.h @@ -0,0 +1,37 @@ +/* + * nf_instance_id_cond.h + * + * + */ + +#ifndef _OpenAPI_nf_instance_id_cond_H_ +#define _OpenAPI_nf_instance_id_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_cond_s OpenAPI_nf_instance_id_cond_t; +typedef struct OpenAPI_nf_instance_id_cond_s { + char *nf_instance_id; +} OpenAPI_nf_instance_id_cond_t; + +OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_create( + char *nf_instance_id + ); +void OpenAPI_nf_instance_id_cond_free(OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond); +OpenAPI_nf_instance_id_cond_t *OpenAPI_nf_instance_id_cond_parseFromJSON(cJSON *nf_instance_id_condJSON); +cJSON *OpenAPI_nf_instance_id_cond_convertToJSON(OpenAPI_nf_instance_id_cond_t *nf_instance_id_cond); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_instance_id_cond_H_ */ + diff --git a/lib/sbi/openapi/model/nf_profile.c b/lib/sbi/openapi/model/nf_profile.c new file mode 100644 index 000000000..e1d80f6c4 --- /dev/null +++ b/lib/sbi/openapi/model/nf_profile.c @@ -0,0 +1,1662 @@ + +#include +#include +#include +#include "nf_profile.h" + +OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( + char *nf_instance_id, + char *nf_instance_name, + OpenAPI_nf_type_e nf_type, + OpenAPI_nf_status_e nf_status, + int heart_beat_timer, + OpenAPI_list_t *plmn_list, + OpenAPI_list_t *s_nssais, + OpenAPI_list_t *per_plmn_snssai_list, + OpenAPI_list_t *nsi_list, + char *fqdn, + char *inter_plmn_fqdn, + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_addresses, + OpenAPI_list_t *allowed_plmns, + OpenAPI_list_t *allowed_nf_types, + OpenAPI_list_t *allowed_nf_domains, + OpenAPI_list_t *allowed_nssais, + int priority, + int capacity, + int load, + char *locality, + OpenAPI_udr_info_t *udr_info, + OpenAPI_list_t *udr_info_ext, + OpenAPI_udm_info_t *udm_info, + OpenAPI_list_t *udm_info_ext, + OpenAPI_ausf_info_t *ausf_info, + OpenAPI_list_t *ausf_info_ext, + OpenAPI_amf_info_t *amf_info, + OpenAPI_list_t *amf_info_ext, + OpenAPI_smf_info_t *smf_info, + OpenAPI_list_t *smf_info_ext, + OpenAPI_upf_info_t *upf_info, + OpenAPI_list_t *upf_info_ext, + OpenAPI_pcf_info_t *pcf_info, + OpenAPI_list_t *pcf_info_ext, + OpenAPI_bsf_info_t *bsf_info, + OpenAPI_list_t *bsf_info_ext, + OpenAPI_chf_info_t *chf_info, + OpenAPI_list_t *chf_info_ext, + OpenAPI_nrf_info_t *nrf_info, + OpenAPI_nwdaf_info_t *nwdaf_info, + OpenAPI_object_t *custom_info, + char *recovery_time, + int nf_service_persistence, + OpenAPI_list_t *nf_services, + int nf_profile_changes_support_ind, + int nf_profile_changes_ind, + OpenAPI_list_t *default_notification_subscriptions + ) +{ + OpenAPI_nf_profile_t *nf_profile_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_profile_t)); + if (!nf_profile_local_var) { + return NULL; + } + nf_profile_local_var->nf_instance_id = nf_instance_id; + nf_profile_local_var->nf_instance_name = nf_instance_name; + nf_profile_local_var->nf_type = nf_type; + nf_profile_local_var->nf_status = nf_status; + nf_profile_local_var->heart_beat_timer = heart_beat_timer; + nf_profile_local_var->plmn_list = plmn_list; + nf_profile_local_var->s_nssais = s_nssais; + nf_profile_local_var->per_plmn_snssai_list = per_plmn_snssai_list; + nf_profile_local_var->nsi_list = nsi_list; + nf_profile_local_var->fqdn = fqdn; + nf_profile_local_var->inter_plmn_fqdn = inter_plmn_fqdn; + nf_profile_local_var->ipv4_addresses = ipv4_addresses; + nf_profile_local_var->ipv6_addresses = ipv6_addresses; + nf_profile_local_var->allowed_plmns = allowed_plmns; + nf_profile_local_var->allowed_nf_types = allowed_nf_types; + nf_profile_local_var->allowed_nf_domains = allowed_nf_domains; + nf_profile_local_var->allowed_nssais = allowed_nssais; + nf_profile_local_var->priority = priority; + nf_profile_local_var->capacity = capacity; + nf_profile_local_var->load = load; + 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->udm_info = udm_info; + nf_profile_local_var->udm_info_ext = udm_info_ext; + nf_profile_local_var->ausf_info = ausf_info; + nf_profile_local_var->ausf_info_ext = ausf_info_ext; + nf_profile_local_var->amf_info = amf_info; + nf_profile_local_var->amf_info_ext = amf_info_ext; + nf_profile_local_var->smf_info = smf_info; + nf_profile_local_var->smf_info_ext = smf_info_ext; + nf_profile_local_var->upf_info = upf_info; + nf_profile_local_var->upf_info_ext = upf_info_ext; + nf_profile_local_var->pcf_info = pcf_info; + nf_profile_local_var->pcf_info_ext = pcf_info_ext; + nf_profile_local_var->bsf_info = bsf_info; + nf_profile_local_var->bsf_info_ext = bsf_info_ext; + nf_profile_local_var->chf_info = chf_info; + nf_profile_local_var->chf_info_ext = chf_info_ext; + nf_profile_local_var->nrf_info = nrf_info; + nf_profile_local_var->nwdaf_info = nwdaf_info; + 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_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; + + return nf_profile_local_var; +} + +void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile) +{ + if (NULL == nf_profile) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nf_profile->nf_instance_id); + ogs_free(nf_profile->nf_instance_name); + OpenAPI_list_for_each(nf_profile->plmn_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(nf_profile->plmn_list); + OpenAPI_list_for_each(nf_profile->s_nssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(nf_profile->s_nssais); + OpenAPI_list_for_each(nf_profile->per_plmn_snssai_list, node) { + OpenAPI_plmn_snssai_free(node->data); + } + OpenAPI_list_free(nf_profile->per_plmn_snssai_list); + OpenAPI_list_for_each(nf_profile->nsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_profile->nsi_list); + ogs_free(nf_profile->fqdn); + ogs_free(nf_profile->inter_plmn_fqdn); + OpenAPI_list_for_each(nf_profile->ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_profile->ipv4_addresses); + OpenAPI_list_for_each(nf_profile->ipv6_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_profile->ipv6_addresses); + OpenAPI_list_for_each(nf_profile->allowed_plmns, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(nf_profile->allowed_plmns); + OpenAPI_list_free(nf_profile->allowed_nf_types); + OpenAPI_list_for_each(nf_profile->allowed_nf_domains, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_profile->allowed_nf_domains); + OpenAPI_list_for_each(nf_profile->allowed_nssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(nf_profile->allowed_nssais); + 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_free(nf_profile->udr_info_ext); + 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_free(nf_profile->udm_info_ext); + 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_free(nf_profile->ausf_info_ext); + 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_free(nf_profile->amf_info_ext); + 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_free(nf_profile->smf_info_ext); + 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_free(nf_profile->upf_info_ext); + 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_free(nf_profile->pcf_info_ext); + 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_free(nf_profile->bsf_info_ext); + 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_free(nf_profile->chf_info_ext); + OpenAPI_nrf_info_free(nf_profile->nrf_info); + OpenAPI_nwdaf_info_free(nf_profile->nwdaf_info); + 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->default_notification_subscriptions, node) { + OpenAPI_default_notification_subscription_free(node->data); + } + OpenAPI_list_free(nf_profile->default_notification_subscriptions); + ogs_free(nf_profile); +} + +cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) +{ + cJSON *item = NULL; + + if (nf_profile == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [NFProfile]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nf_profile->nf_instance_id) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_instance_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfInstanceId", nf_profile->nf_instance_id) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_instance_id]"); + goto end; + } + + if (nf_profile->nf_instance_name) { + if (cJSON_AddStringToObject(item, "nfInstanceName", nf_profile->nf_instance_name) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_instance_name]"); + goto end; + } + } + + if (!nf_profile->nf_type) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_type_ToString(nf_profile->nf_type)) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_type]"); + goto end; + } + + if (!nf_profile->nf_status) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_status]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfStatus", OpenAPI_nf_status_ToString(nf_profile->nf_status)) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_status]"); + goto end; + } + + if (nf_profile->heart_beat_timer) { + if (cJSON_AddNumberToObject(item, "heartBeatTimer", nf_profile->heart_beat_timer) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [heart_beat_timer]"); + goto end; + } + } + + if (nf_profile->plmn_list) { + cJSON *plmn_listList = cJSON_AddArrayToObject(item, "plmnList"); + if (plmn_listList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [plmn_list]"); + goto end; + } + + OpenAPI_lnode_t *plmn_list_node; + if (nf_profile->plmn_list) { + OpenAPI_list_for_each(nf_profile->plmn_list, plmn_list_node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(plmn_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [plmn_list]"); + goto end; + } + cJSON_AddItemToArray(plmn_listList, itemLocal); + } + } + } + + if (nf_profile->s_nssais) { + cJSON *s_nssaisList = cJSON_AddArrayToObject(item, "sNssais"); + if (s_nssaisList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [s_nssais]"); + goto end; + } + + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [s_nssais]"); + goto end; + } + cJSON_AddItemToArray(s_nssaisList, itemLocal); + } + } + } + + if (nf_profile->per_plmn_snssai_list) { + cJSON *per_plmn_snssai_listList = cJSON_AddArrayToObject(item, "perPlmnSnssaiList"); + if (per_plmn_snssai_listList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [per_plmn_snssai_list]"); + goto end; + } + + OpenAPI_lnode_t *per_plmn_snssai_list_node; + if (nf_profile->per_plmn_snssai_list) { + OpenAPI_list_for_each(nf_profile->per_plmn_snssai_list, per_plmn_snssai_list_node) { + cJSON *itemLocal = OpenAPI_plmn_snssai_convertToJSON(per_plmn_snssai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [per_plmn_snssai_list]"); + goto end; + } + cJSON_AddItemToArray(per_plmn_snssai_listList, itemLocal); + } + } + } + + if (nf_profile->nsi_list) { + cJSON *nsi_list = cJSON_AddArrayToObject(item, "nsiList"); + if (nsi_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nsi_list]"); + goto end; + } + + OpenAPI_lnode_t *nsi_list_node; + OpenAPI_list_for_each(nf_profile->nsi_list, nsi_list_node) { + if (cJSON_AddStringToObject(nsi_list, "", (char*)nsi_list_node->data) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nsi_list]"); + goto end; + } + } + } + + if (nf_profile->fqdn) { + if (cJSON_AddStringToObject(item, "fqdn", nf_profile->fqdn) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [fqdn]"); + goto end; + } + } + + if (nf_profile->inter_plmn_fqdn) { + if (cJSON_AddStringToObject(item, "interPlmnFqdn", nf_profile->inter_plmn_fqdn) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inter_plmn_fqdn]"); + goto end; + } + } + + if (nf_profile->ipv4_addresses) { + cJSON *ipv4_addresses = cJSON_AddArrayToObject(item, "ipv4Addresses"); + if (ipv4_addresses == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + + OpenAPI_lnode_t *ipv4_addresses_node; + OpenAPI_list_for_each(nf_profile->ipv4_addresses, ipv4_addresses_node) { + if (cJSON_AddStringToObject(ipv4_addresses, "", (char*)ipv4_addresses_node->data) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + } + } + + if (nf_profile->ipv6_addresses) { + cJSON *ipv6_addresses = cJSON_AddArrayToObject(item, "ipv6Addresses"); + if (ipv6_addresses == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ipv6_addresses]"); + goto end; + } + + OpenAPI_lnode_t *ipv6_addresses_node; + OpenAPI_list_for_each(nf_profile->ipv6_addresses, ipv6_addresses_node) { + if (cJSON_AddStringToObject(ipv6_addresses, "", (char*)ipv6_addresses_node->data) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ipv6_addresses]"); + goto end; + } + } + } + + if (nf_profile->allowed_plmns) { + cJSON *allowed_plmnsList = cJSON_AddArrayToObject(item, "allowedPlmns"); + if (allowed_plmnsList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_plmns]"); + goto end; + } + + OpenAPI_lnode_t *allowed_plmns_node; + if (nf_profile->allowed_plmns) { + OpenAPI_list_for_each(nf_profile->allowed_plmns, allowed_plmns_node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(allowed_plmns_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_plmns]"); + goto end; + } + cJSON_AddItemToArray(allowed_plmnsList, itemLocal); + } + } + } + + if (nf_profile->allowed_nf_types) { + cJSON *allowed_nf_types = cJSON_AddArrayToObject(item, "allowedNfTypes"); + if (allowed_nf_types == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_nf_types]"); + goto end; + } + OpenAPI_lnode_t *allowed_nf_types_node; + OpenAPI_list_for_each(nf_profile->allowed_nf_types, allowed_nf_types_node) { + if (cJSON_AddStringToObject(allowed_nf_types, "", OpenAPI_nf_type_ToString((OpenAPI_nf_type_e)allowed_nf_types_node->data)) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_nf_types]"); + goto end; + } + } + } + + if (nf_profile->allowed_nf_domains) { + cJSON *allowed_nf_domains = cJSON_AddArrayToObject(item, "allowedNfDomains"); + if (allowed_nf_domains == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_nf_domains]"); + goto end; + } + + OpenAPI_lnode_t *allowed_nf_domains_node; + OpenAPI_list_for_each(nf_profile->allowed_nf_domains, allowed_nf_domains_node) { + if (cJSON_AddStringToObject(allowed_nf_domains, "", (char*)allowed_nf_domains_node->data) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_nf_domains]"); + goto end; + } + } + } + + if (nf_profile->allowed_nssais) { + cJSON *allowed_nssaisList = cJSON_AddArrayToObject(item, "allowedNssais"); + if (allowed_nssaisList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_nssais]"); + goto end; + } + + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [allowed_nssais]"); + goto end; + } + cJSON_AddItemToArray(allowed_nssaisList, itemLocal); + } + } + } + + if (nf_profile->priority) { + if (cJSON_AddNumberToObject(item, "priority", nf_profile->priority) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [priority]"); + goto end; + } + } + + if (nf_profile->capacity) { + if (cJSON_AddNumberToObject(item, "capacity", nf_profile->capacity) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [capacity]"); + goto end; + } + } + + if (nf_profile->load) { + if (cJSON_AddNumberToObject(item, "load", nf_profile->load) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [load]"); + goto end; + } + } + + if (nf_profile->locality) { + if (cJSON_AddStringToObject(item, "locality", nf_profile->locality) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [locality]"); + goto end; + } + } + + if (nf_profile->udr_info) { + cJSON *udr_info_local_JSON = OpenAPI_udr_info_convertToJSON(nf_profile->udr_info); + if (udr_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udr_info]"); + goto end; + } + cJSON_AddItemToObject(item, "udrInfo", udr_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udr_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udr_info_ext]"); + goto end; + } + cJSON_AddItemToArray(udr_info_extList, itemLocal); + } + } + } + + if (nf_profile->udm_info) { + cJSON *udm_info_local_JSON = OpenAPI_udm_info_convertToJSON(nf_profile->udm_info); + if (udm_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udm_info]"); + goto end; + } + cJSON_AddItemToObject(item, "udmInfo", udm_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udm_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [udm_info_ext]"); + goto end; + } + cJSON_AddItemToArray(udm_info_extList, itemLocal); + } + } + } + + if (nf_profile->ausf_info) { + cJSON *ausf_info_local_JSON = OpenAPI_ausf_info_convertToJSON(nf_profile->ausf_info); + if (ausf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ausf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "ausfInfo", ausf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ausf_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [ausf_info_ext]"); + goto end; + } + cJSON_AddItemToArray(ausf_info_extList, itemLocal); + } + } + } + + if (nf_profile->amf_info) { + cJSON *amf_info_local_JSON = OpenAPI_amf_info_convertToJSON(nf_profile->amf_info); + if (amf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [amf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "amfInfo", amf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [amf_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [amf_info_ext]"); + goto end; + } + cJSON_AddItemToArray(amf_info_extList, itemLocal); + } + } + } + + if (nf_profile->smf_info) { + cJSON *smf_info_local_JSON = OpenAPI_smf_info_convertToJSON(nf_profile->smf_info); + if (smf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [smf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "smfInfo", smf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [smf_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [smf_info_ext]"); + goto end; + } + cJSON_AddItemToArray(smf_info_extList, itemLocal); + } + } + } + + if (nf_profile->upf_info) { + cJSON *upf_info_local_JSON = OpenAPI_upf_info_convertToJSON(nf_profile->upf_info); + if (upf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [upf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "upfInfo", upf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [upf_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [upf_info_ext]"); + goto end; + } + cJSON_AddItemToArray(upf_info_extList, itemLocal); + } + } + } + + if (nf_profile->pcf_info) { + cJSON *pcf_info_local_JSON = OpenAPI_pcf_info_convertToJSON(nf_profile->pcf_info); + if (pcf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfInfo", pcf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcf_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [pcf_info_ext]"); + goto end; + } + cJSON_AddItemToArray(pcf_info_extList, itemLocal); + } + } + } + + if (nf_profile->bsf_info) { + cJSON *bsf_info_local_JSON = OpenAPI_bsf_info_convertToJSON(nf_profile->bsf_info); + if (bsf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [bsf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "bsfInfo", bsf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [bsf_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [bsf_info_ext]"); + goto end; + } + cJSON_AddItemToArray(bsf_info_extList, itemLocal); + } + } + } + + if (nf_profile->chf_info) { + cJSON *chf_info_local_JSON = OpenAPI_chf_info_convertToJSON(nf_profile->chf_info); + if (chf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [chf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "chfInfo", chf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [chf_info]"); + goto end; + } + } + + 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]"); + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [chf_info_ext]"); + goto end; + } + cJSON_AddItemToArray(chf_info_extList, itemLocal); + } + } + } + + if (nf_profile->nrf_info) { + cJSON *nrf_info_local_JSON = OpenAPI_nrf_info_convertToJSON(nf_profile->nrf_info); + if (nrf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nrf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "nrfInfo", nrf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nrf_info]"); + goto end; + } + } + + if (nf_profile->nwdaf_info) { + cJSON *nwdaf_info_local_JSON = OpenAPI_nwdaf_info_convertToJSON(nf_profile->nwdaf_info); + if (nwdaf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nwdaf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "nwdafInfo", nwdaf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nwdaf_info]"); + goto end; + } + } + + if (nf_profile->custom_info) { + cJSON *custom_info_object = OpenAPI_object_convertToJSON(nf_profile->custom_info); + if (custom_info_object == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [custom_info]"); + goto end; + } + cJSON_AddItemToObject(item, "customInfo", custom_info_object); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [custom_info]"); + goto end; + } + } + + if (nf_profile->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", nf_profile->recovery_time) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (nf_profile->nf_service_persistence) { + if (cJSON_AddBoolToObject(item, "nfServicePersistence", nf_profile->nf_service_persistence) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_service_persistence]"); + goto end; + } + } + + if (nf_profile->nf_services) { + cJSON *nf_servicesList = cJSON_AddArrayToObject(item, "nfServices"); + if (nf_servicesList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_services]"); + goto end; + } + + OpenAPI_lnode_t *nf_services_node; + if (nf_profile->nf_services) { + OpenAPI_list_for_each(nf_profile->nf_services, nf_services_node) { + cJSON *itemLocal = OpenAPI_nf_service_convertToJSON(nf_services_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_services]"); + goto end; + } + cJSON_AddItemToArray(nf_servicesList, 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]"); + goto end; + } + } + + if (nf_profile->nf_profile_changes_ind) { + if (cJSON_AddBoolToObject(item, "nfProfileChangesInd", nf_profile->nf_profile_changes_ind) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nf_profile_changes_ind]"); + goto end; + } + } + + if (nf_profile->default_notification_subscriptions) { + cJSON *default_notification_subscriptionsList = cJSON_AddArrayToObject(item, "defaultNotificationSubscriptions"); + if (default_notification_subscriptionsList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [default_notification_subscriptions]"); + goto end; + } + + OpenAPI_lnode_t *default_notification_subscriptions_node; + if (nf_profile->default_notification_subscriptions) { + OpenAPI_list_for_each(nf_profile->default_notification_subscriptions, default_notification_subscriptions_node) { + cJSON *itemLocal = OpenAPI_default_notification_subscription_convertToJSON(default_notification_subscriptions_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [default_notification_subscriptions]"); + goto end; + } + cJSON_AddItemToArray(default_notification_subscriptionsList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) +{ + OpenAPI_nf_profile_t *nf_profile_local_var = NULL; + cJSON *nf_instance_id = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfInstanceId"); + if (!nf_instance_id) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + + + if (!cJSON_IsString(nf_instance_id)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + + cJSON *nf_instance_name = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfInstanceName"); + + if (nf_instance_name) { + if (!cJSON_IsString(nf_instance_name)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_instance_name]"); + goto end; + } + } + + cJSON *nf_type = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfType"); + if (!nf_type) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_type]"); + goto end; + } + + OpenAPI_nf_type_e nf_typeVariable; + + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_nf_type_FromString(nf_type->valuestring); + + cJSON *nf_status = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfStatus"); + if (!nf_status) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_status]"); + goto end; + } + + OpenAPI_nf_status_e nf_statusVariable; + + if (!cJSON_IsString(nf_status)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_status]"); + goto end; + } + nf_statusVariable = OpenAPI_nf_status_FromString(nf_status->valuestring); + + cJSON *heart_beat_timer = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "heartBeatTimer"); + + if (heart_beat_timer) { + if (!cJSON_IsNumber(heart_beat_timer)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [heart_beat_timer]"); + goto end; + } + } + + cJSON *plmn_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "plmnList"); + + OpenAPI_list_t *plmn_listList; + if (plmn_list) { + cJSON *plmn_list_local_nonprimitive; + if (!cJSON_IsArray(plmn_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [plmn_list]"); + goto end; + } + + plmn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(plmn_list_local_nonprimitive, plmn_list ) { + if (!cJSON_IsObject(plmn_list_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [plmn_list]"); + goto end; + } + OpenAPI_plmn_id_t *plmn_listItem = OpenAPI_plmn_id_parseFromJSON(plmn_list_local_nonprimitive); + + OpenAPI_list_add(plmn_listList, plmn_listItem); + } + } + + cJSON *s_nssais = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "sNssais"); + + OpenAPI_list_t *s_nssaisList; + if (s_nssais) { + cJSON *s_nssais_local_nonprimitive; + if (!cJSON_IsArray(s_nssais)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [s_nssais]"); + goto end; + } + + s_nssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssais_local_nonprimitive, s_nssais ) { + if (!cJSON_IsObject(s_nssais_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [s_nssais]"); + goto end; + } + OpenAPI_snssai_t *s_nssaisItem = OpenAPI_snssai_parseFromJSON(s_nssais_local_nonprimitive); + + OpenAPI_list_add(s_nssaisList, s_nssaisItem); + } + } + + cJSON *per_plmn_snssai_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "perPlmnSnssaiList"); + + OpenAPI_list_t *per_plmn_snssai_listList; + if (per_plmn_snssai_list) { + cJSON *per_plmn_snssai_list_local_nonprimitive; + if (!cJSON_IsArray(per_plmn_snssai_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [per_plmn_snssai_list]"); + goto end; + } + + per_plmn_snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(per_plmn_snssai_list_local_nonprimitive, per_plmn_snssai_list ) { + if (!cJSON_IsObject(per_plmn_snssai_list_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [per_plmn_snssai_list]"); + goto end; + } + OpenAPI_plmn_snssai_t *per_plmn_snssai_listItem = OpenAPI_plmn_snssai_parseFromJSON(per_plmn_snssai_list_local_nonprimitive); + + OpenAPI_list_add(per_plmn_snssai_listList, per_plmn_snssai_listItem); + } + } + + cJSON *nsi_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nsiList"); + + OpenAPI_list_t *nsi_listList; + if (nsi_list) { + cJSON *nsi_list_local; + if (!cJSON_IsArray(nsi_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nsi_list]"); + goto end; + } + nsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_list_local, nsi_list) { + if (!cJSON_IsString(nsi_list_local)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nsi_list]"); + goto end; + } + OpenAPI_list_add(nsi_listList, ogs_strdup(nsi_list_local->valuestring)); + } + } + + cJSON *fqdn = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "fqdn"); + + if (fqdn) { + if (!cJSON_IsString(fqdn)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [fqdn]"); + goto end; + } + } + + cJSON *inter_plmn_fqdn = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "interPlmnFqdn"); + + if (inter_plmn_fqdn) { + if (!cJSON_IsString(inter_plmn_fqdn)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inter_plmn_fqdn]"); + goto end; + } + } + + cJSON *ipv4_addresses = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "ipv4Addresses"); + + OpenAPI_list_t *ipv4_addressesList; + if (ipv4_addresses) { + cJSON *ipv4_addresses_local; + if (!cJSON_IsArray(ipv4_addresses)) { + ogs_error("OpenAPI_nf_profile_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_nf_profile_parseFromJSON() failed [ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(ipv4_addressesList, ogs_strdup(ipv4_addresses_local->valuestring)); + } + } + + cJSON *ipv6_addresses = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "ipv6Addresses"); + + OpenAPI_list_t *ipv6_addressesList; + if (ipv6_addresses) { + cJSON *ipv6_addresses_local; + if (!cJSON_IsArray(ipv6_addresses)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [ipv6_addresses]"); + goto end; + } + ipv6_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_addresses_local, ipv6_addresses) { + if (!cJSON_IsString(ipv6_addresses_local)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [ipv6_addresses]"); + goto end; + } + OpenAPI_list_add(ipv6_addressesList, ogs_strdup(ipv6_addresses_local->valuestring)); + } + } + + cJSON *allowed_plmns = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "allowedPlmns"); + + OpenAPI_list_t *allowed_plmnsList; + if (allowed_plmns) { + cJSON *allowed_plmns_local_nonprimitive; + if (!cJSON_IsArray(allowed_plmns)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_plmns]"); + goto end; + } + + allowed_plmnsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_plmns_local_nonprimitive, allowed_plmns ) { + if (!cJSON_IsObject(allowed_plmns_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_plmns]"); + goto end; + } + OpenAPI_plmn_id_t *allowed_plmnsItem = OpenAPI_plmn_id_parseFromJSON(allowed_plmns_local_nonprimitive); + + OpenAPI_list_add(allowed_plmnsList, allowed_plmnsItem); + } + } + + cJSON *allowed_nf_types = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "allowedNfTypes"); + + OpenAPI_list_t *allowed_nf_typesList; + if (allowed_nf_types) { + cJSON *allowed_nf_types_local_nonprimitive; + if (!cJSON_IsArray(allowed_nf_types)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_nf_types]"); + goto end; + } + + allowed_nf_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nf_types_local_nonprimitive, allowed_nf_types ) { + if (!cJSON_IsString(allowed_nf_types_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_nf_types]"); + goto end; + } + + OpenAPI_list_add(allowed_nf_typesList, (void *)OpenAPI_nf_type_FromString(allowed_nf_types_local_nonprimitive->valuestring)); + } + } + + cJSON *allowed_nf_domains = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "allowedNfDomains"); + + OpenAPI_list_t *allowed_nf_domainsList; + if (allowed_nf_domains) { + cJSON *allowed_nf_domains_local; + if (!cJSON_IsArray(allowed_nf_domains)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_nf_domains]"); + goto end; + } + allowed_nf_domainsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nf_domains_local, allowed_nf_domains) { + if (!cJSON_IsString(allowed_nf_domains_local)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_nf_domains]"); + goto end; + } + OpenAPI_list_add(allowed_nf_domainsList, ogs_strdup(allowed_nf_domains_local->valuestring)); + } + } + + cJSON *allowed_nssais = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "allowedNssais"); + + OpenAPI_list_t *allowed_nssaisList; + if (allowed_nssais) { + cJSON *allowed_nssais_local_nonprimitive; + if (!cJSON_IsArray(allowed_nssais)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_nssais]"); + goto end; + } + + allowed_nssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nssais_local_nonprimitive, allowed_nssais ) { + if (!cJSON_IsObject(allowed_nssais_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [allowed_nssais]"); + goto end; + } + OpenAPI_snssai_t *allowed_nssaisItem = OpenAPI_snssai_parseFromJSON(allowed_nssais_local_nonprimitive); + + OpenAPI_list_add(allowed_nssaisList, allowed_nssaisItem); + } + } + + cJSON *priority = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "priority"); + + if (priority) { + if (!cJSON_IsNumber(priority)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [priority]"); + goto end; + } + } + + cJSON *capacity = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "capacity"); + + if (capacity) { + if (!cJSON_IsNumber(capacity)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [capacity]"); + goto end; + } + } + + cJSON *load = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "load"); + + if (load) { + if (!cJSON_IsNumber(load)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [load]"); + goto end; + } + } + + cJSON *locality = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "locality"); + + if (locality) { + if (!cJSON_IsString(locality)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [locality]"); + goto end; + } + } + + cJSON *udr_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udrInfo"); + + OpenAPI_udr_info_t *udr_info_local_nonprim = NULL; + if (udr_info) { + udr_info_local_nonprim = OpenAPI_udr_info_parseFromJSON(udr_info); + } + + cJSON *udr_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udrInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *udm_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udmInfo"); + + OpenAPI_udm_info_t *udm_info_local_nonprim = NULL; + if (udm_info) { + udm_info_local_nonprim = OpenAPI_udm_info_parseFromJSON(udm_info); + } + + cJSON *udm_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "udmInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *ausf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "ausfInfo"); + + OpenAPI_ausf_info_t *ausf_info_local_nonprim = NULL; + if (ausf_info) { + ausf_info_local_nonprim = OpenAPI_ausf_info_parseFromJSON(ausf_info); + } + + cJSON *ausf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "ausfInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *amf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "amfInfo"); + + OpenAPI_amf_info_t *amf_info_local_nonprim = NULL; + if (amf_info) { + amf_info_local_nonprim = OpenAPI_amf_info_parseFromJSON(amf_info); + } + + cJSON *amf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "amfInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *smf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "smfInfo"); + + OpenAPI_smf_info_t *smf_info_local_nonprim = NULL; + if (smf_info) { + smf_info_local_nonprim = OpenAPI_smf_info_parseFromJSON(smf_info); + } + + cJSON *smf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "smfInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *upf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "upfInfo"); + + OpenAPI_upf_info_t *upf_info_local_nonprim = NULL; + if (upf_info) { + upf_info_local_nonprim = OpenAPI_upf_info_parseFromJSON(upf_info); + } + + cJSON *upf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "upfInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *pcf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "pcfInfo"); + + OpenAPI_pcf_info_t *pcf_info_local_nonprim = NULL; + if (pcf_info) { + pcf_info_local_nonprim = OpenAPI_pcf_info_parseFromJSON(pcf_info); + } + + cJSON *pcf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "pcfInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *bsf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "bsfInfo"); + + OpenAPI_bsf_info_t *bsf_info_local_nonprim = NULL; + if (bsf_info) { + bsf_info_local_nonprim = OpenAPI_bsf_info_parseFromJSON(bsf_info); + } + + cJSON *bsf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "bsfInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *chf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "chfInfo"); + + OpenAPI_chf_info_t *chf_info_local_nonprim = NULL; + if (chf_info) { + chf_info_local_nonprim = OpenAPI_chf_info_parseFromJSON(chf_info); + } + + cJSON *chf_info_ext = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "chfInfoExt"); + + 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]"); + 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]"); + 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); + } + } + + cJSON *nrf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nrfInfo"); + + OpenAPI_nrf_info_t *nrf_info_local_nonprim = NULL; + if (nrf_info) { + nrf_info_local_nonprim = OpenAPI_nrf_info_parseFromJSON(nrf_info); + } + + cJSON *nwdaf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nwdafInfo"); + + OpenAPI_nwdaf_info_t *nwdaf_info_local_nonprim = NULL; + if (nwdaf_info) { + nwdaf_info_local_nonprim = OpenAPI_nwdaf_info_parseFromJSON(nwdaf_info); + } + + cJSON *custom_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "customInfo"); + + OpenAPI_object_t *custom_info_local_object = NULL; + if (custom_info) { + custom_info_local_object = OpenAPI_object_parseFromJSON(custom_info); + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + cJSON *nf_service_persistence = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfServicePersistence"); + + if (nf_service_persistence) { + if (!cJSON_IsBool(nf_service_persistence)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_service_persistence]"); + goto end; + } + } + + cJSON *nf_services = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfServices"); + + OpenAPI_list_t *nf_servicesList; + if (nf_services) { + cJSON *nf_services_local_nonprimitive; + if (!cJSON_IsArray(nf_services)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_services]"); + goto end; + } + + nf_servicesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_services_local_nonprimitive, nf_services ) { + if (!cJSON_IsObject(nf_services_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_services]"); + goto end; + } + OpenAPI_nf_service_t *nf_servicesItem = OpenAPI_nf_service_parseFromJSON(nf_services_local_nonprimitive); + + OpenAPI_list_add(nf_servicesList, nf_servicesItem); + } + } + + cJSON *nf_profile_changes_support_ind = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfProfileChangesSupportInd"); + + if (nf_profile_changes_support_ind) { + if (!cJSON_IsBool(nf_profile_changes_support_ind)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_profile_changes_support_ind]"); + goto end; + } + } + + cJSON *nf_profile_changes_ind = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfProfileChangesInd"); + + if (nf_profile_changes_ind) { + if (!cJSON_IsBool(nf_profile_changes_ind)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_profile_changes_ind]"); + goto end; + } + } + + cJSON *default_notification_subscriptions = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "defaultNotificationSubscriptions"); + + OpenAPI_list_t *default_notification_subscriptionsList; + if (default_notification_subscriptions) { + cJSON *default_notification_subscriptions_local_nonprimitive; + if (!cJSON_IsArray(default_notification_subscriptions)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [default_notification_subscriptions]"); + goto end; + } + + default_notification_subscriptionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(default_notification_subscriptions_local_nonprimitive, default_notification_subscriptions ) { + if (!cJSON_IsObject(default_notification_subscriptions_local_nonprimitive)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [default_notification_subscriptions]"); + goto end; + } + OpenAPI_default_notification_subscription_t *default_notification_subscriptionsItem = OpenAPI_default_notification_subscription_parseFromJSON(default_notification_subscriptions_local_nonprimitive); + + OpenAPI_list_add(default_notification_subscriptionsList, default_notification_subscriptionsItem); + } + } + + nf_profile_local_var = OpenAPI_nf_profile_create ( + ogs_strdup(nf_instance_id->valuestring), + nf_instance_name ? ogs_strdup(nf_instance_name->valuestring) : NULL, + nf_typeVariable, + nf_statusVariable, + heart_beat_timer ? heart_beat_timer->valuedouble : 0, + plmn_list ? plmn_listList : NULL, + s_nssais ? s_nssaisList : NULL, + per_plmn_snssai_list ? per_plmn_snssai_listList : NULL, + nsi_list ? nsi_listList : NULL, + fqdn ? ogs_strdup(fqdn->valuestring) : NULL, + inter_plmn_fqdn ? ogs_strdup(inter_plmn_fqdn->valuestring) : NULL, + ipv4_addresses ? ipv4_addressesList : NULL, + ipv6_addresses ? ipv6_addressesList : NULL, + allowed_plmns ? allowed_plmnsList : NULL, + allowed_nf_types ? allowed_nf_typesList : NULL, + allowed_nf_domains ? allowed_nf_domainsList : NULL, + allowed_nssais ? allowed_nssaisList : NULL, + priority ? priority->valuedouble : 0, + capacity ? capacity->valuedouble : 0, + load ? load->valuedouble : 0, + locality ? ogs_strdup(locality->valuestring) : NULL, + udr_info ? udr_info_local_nonprim : NULL, + udr_info_ext ? udr_info_extList : NULL, + udm_info ? udm_info_local_nonprim : NULL, + udm_info_ext ? udm_info_extList : NULL, + ausf_info ? ausf_info_local_nonprim : NULL, + ausf_info_ext ? ausf_info_extList : NULL, + amf_info ? amf_info_local_nonprim : NULL, + amf_info_ext ? amf_info_extList : NULL, + smf_info ? smf_info_local_nonprim : NULL, + smf_info_ext ? smf_info_extList : NULL, + upf_info ? upf_info_local_nonprim : NULL, + upf_info_ext ? upf_info_extList : NULL, + pcf_info ? pcf_info_local_nonprim : NULL, + pcf_info_ext ? pcf_info_extList : NULL, + bsf_info ? bsf_info_local_nonprim : NULL, + bsf_info_ext ? bsf_info_extList : NULL, + chf_info ? chf_info_local_nonprim : NULL, + chf_info_ext ? chf_info_extList : NULL, + nrf_info ? nrf_info_local_nonprim : NULL, + nwdaf_info ? nwdaf_info_local_nonprim : 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_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 + ); + + return nf_profile_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nf_profile.h b/lib/sbi/openapi/model/nf_profile.h new file mode 100644 index 000000000..f342888d9 --- /dev/null +++ b/lib/sbi/openapi/model/nf_profile.h @@ -0,0 +1,150 @@ +/* + * nf_profile.h + * + * + */ + +#ifndef _OpenAPI_nf_profile_H_ +#define _OpenAPI_nf_profile_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_info.h" +#include "ausf_info.h" +#include "bsf_info.h" +#include "chf_info.h" +#include "default_notification_subscription.h" +#include "nf_service.h" +#include "nf_status.h" +#include "nf_type.h" +#include "nrf_info.h" +#include "nwdaf_info.h" +#include "object.h" +#include "pcf_info.h" +#include "plmn_id.h" +#include "plmn_snssai.h" +#include "smf_info.h" +#include "snssai.h" +#include "udm_info.h" +#include "udr_info.h" +#include "upf_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_profile_s OpenAPI_nf_profile_t; +typedef struct OpenAPI_nf_profile_s { + char *nf_instance_id; + char *nf_instance_name; + OpenAPI_nf_type_e nf_type; + OpenAPI_nf_status_e nf_status; + int heart_beat_timer; + OpenAPI_list_t *plmn_list; + OpenAPI_list_t *s_nssais; + OpenAPI_list_t *per_plmn_snssai_list; + OpenAPI_list_t *nsi_list; + char *fqdn; + char *inter_plmn_fqdn; + OpenAPI_list_t *ipv4_addresses; + OpenAPI_list_t *ipv6_addresses; + OpenAPI_list_t *allowed_plmns; + OpenAPI_list_t *allowed_nf_types; + OpenAPI_list_t *allowed_nf_domains; + OpenAPI_list_t *allowed_nssais; + int priority; + int capacity; + int load; + char *locality; + struct OpenAPI_udr_info_s *udr_info; + OpenAPI_list_t *udr_info_ext; + struct OpenAPI_udm_info_s *udm_info; + OpenAPI_list_t *udm_info_ext; + struct OpenAPI_ausf_info_s *ausf_info; + OpenAPI_list_t *ausf_info_ext; + struct OpenAPI_amf_info_s *amf_info; + OpenAPI_list_t *amf_info_ext; + struct OpenAPI_smf_info_s *smf_info; + OpenAPI_list_t *smf_info_ext; + struct OpenAPI_upf_info_s *upf_info; + OpenAPI_list_t *upf_info_ext; + struct OpenAPI_pcf_info_s *pcf_info; + OpenAPI_list_t *pcf_info_ext; + struct OpenAPI_bsf_info_s *bsf_info; + OpenAPI_list_t *bsf_info_ext; + struct OpenAPI_chf_info_s *chf_info; + OpenAPI_list_t *chf_info_ext; + struct OpenAPI_nrf_info_s *nrf_info; + struct OpenAPI_nwdaf_info_s *nwdaf_info; + OpenAPI_object_t *custom_info; + char *recovery_time; + int nf_service_persistence; + OpenAPI_list_t *nf_services; + int nf_profile_changes_support_ind; + int nf_profile_changes_ind; + OpenAPI_list_t *default_notification_subscriptions; +} OpenAPI_nf_profile_t; + +OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( + char *nf_instance_id, + char *nf_instance_name, + OpenAPI_nf_type_e nf_type, + OpenAPI_nf_status_e nf_status, + int heart_beat_timer, + OpenAPI_list_t *plmn_list, + OpenAPI_list_t *s_nssais, + OpenAPI_list_t *per_plmn_snssai_list, + OpenAPI_list_t *nsi_list, + char *fqdn, + char *inter_plmn_fqdn, + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_addresses, + OpenAPI_list_t *allowed_plmns, + OpenAPI_list_t *allowed_nf_types, + OpenAPI_list_t *allowed_nf_domains, + OpenAPI_list_t *allowed_nssais, + int priority, + int capacity, + int load, + char *locality, + OpenAPI_udr_info_t *udr_info, + OpenAPI_list_t *udr_info_ext, + OpenAPI_udm_info_t *udm_info, + OpenAPI_list_t *udm_info_ext, + OpenAPI_ausf_info_t *ausf_info, + OpenAPI_list_t *ausf_info_ext, + OpenAPI_amf_info_t *amf_info, + OpenAPI_list_t *amf_info_ext, + OpenAPI_smf_info_t *smf_info, + OpenAPI_list_t *smf_info_ext, + OpenAPI_upf_info_t *upf_info, + OpenAPI_list_t *upf_info_ext, + OpenAPI_pcf_info_t *pcf_info, + OpenAPI_list_t *pcf_info_ext, + OpenAPI_bsf_info_t *bsf_info, + OpenAPI_list_t *bsf_info_ext, + OpenAPI_chf_info_t *chf_info, + OpenAPI_list_t *chf_info_ext, + OpenAPI_nrf_info_t *nrf_info, + OpenAPI_nwdaf_info_t *nwdaf_info, + OpenAPI_object_t *custom_info, + char *recovery_time, + int nf_service_persistence, + OpenAPI_list_t *nf_services, + int nf_profile_changes_support_ind, + int nf_profile_changes_ind, + OpenAPI_list_t *default_notification_subscriptions + ); +void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile); +OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON); +cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_profile_H_ */ + diff --git a/lib/sbi/openapi/model/nf_service.c b/lib/sbi/openapi/model/nf_service.c new file mode 100644 index 000000000..350536349 --- /dev/null +++ b/lib/sbi/openapi/model/nf_service.c @@ -0,0 +1,673 @@ + +#include +#include +#include +#include "nf_service.h" + +OpenAPI_nf_service_t *OpenAPI_nf_service_create( + char *service_instance_id, + char *service_name, + OpenAPI_list_t *versions, + OpenAPI_uri_scheme_e scheme, + OpenAPI_nf_service_status_e nf_service_status, + char *fqdn, + char *inter_plmn_fqdn, + OpenAPI_list_t *ip_end_points, + char *api_prefix, + OpenAPI_list_t *default_notification_subscriptions, + OpenAPI_list_t *allowed_plmns, + OpenAPI_list_t *allowed_nf_types, + OpenAPI_list_t *allowed_nf_domains, + OpenAPI_list_t *allowed_nssais, + int priority, + int capacity, + int load, + char *recovery_time, + OpenAPI_chf_service_info_t *chf_service_info, + char *supported_features + ) +{ + OpenAPI_nf_service_t *nf_service_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_service_t)); + if (!nf_service_local_var) { + return NULL; + } + nf_service_local_var->service_instance_id = service_instance_id; + nf_service_local_var->service_name = service_name; + nf_service_local_var->versions = versions; + nf_service_local_var->scheme = scheme; + nf_service_local_var->nf_service_status = nf_service_status; + nf_service_local_var->fqdn = fqdn; + nf_service_local_var->inter_plmn_fqdn = inter_plmn_fqdn; + nf_service_local_var->ip_end_points = ip_end_points; + nf_service_local_var->api_prefix = api_prefix; + nf_service_local_var->default_notification_subscriptions = default_notification_subscriptions; + nf_service_local_var->allowed_plmns = allowed_plmns; + 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->priority = priority; + nf_service_local_var->capacity = capacity; + nf_service_local_var->load = load; + nf_service_local_var->recovery_time = recovery_time; + nf_service_local_var->chf_service_info = chf_service_info; + nf_service_local_var->supported_features = supported_features; + + return nf_service_local_var; +} + +void OpenAPI_nf_service_free(OpenAPI_nf_service_t *nf_service) +{ + if (NULL == nf_service) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nf_service->service_instance_id); + ogs_free(nf_service->service_name); + OpenAPI_list_for_each(nf_service->versions, node) { + OpenAPI_nf_service_version_free(node->data); + } + OpenAPI_list_free(nf_service->versions); + ogs_free(nf_service->fqdn); + ogs_free(nf_service->inter_plmn_fqdn); + OpenAPI_list_for_each(nf_service->ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(nf_service->ip_end_points); + ogs_free(nf_service->api_prefix); + OpenAPI_list_for_each(nf_service->default_notification_subscriptions, node) { + OpenAPI_default_notification_subscription_free(node->data); + } + OpenAPI_list_free(nf_service->default_notification_subscriptions); + OpenAPI_list_for_each(nf_service->allowed_plmns, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(nf_service->allowed_plmns); + OpenAPI_list_free(nf_service->allowed_nf_types); + OpenAPI_list_for_each(nf_service->allowed_nf_domains, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_service->allowed_nf_domains); + OpenAPI_list_for_each(nf_service->allowed_nssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(nf_service->allowed_nssais); + ogs_free(nf_service->recovery_time); + OpenAPI_chf_service_info_free(nf_service->chf_service_info); + ogs_free(nf_service->supported_features); + ogs_free(nf_service); +} + +cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service) +{ + cJSON *item = NULL; + + if (nf_service == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [NFService]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nf_service->service_instance_id) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [service_instance_id]"); + goto end; + } + if (cJSON_AddStringToObject(item, "serviceInstanceId", nf_service->service_instance_id) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [service_instance_id]"); + goto end; + } + + if (!nf_service->service_name) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [service_name]"); + goto end; + } + if (cJSON_AddStringToObject(item, "serviceName", nf_service->service_name) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [service_name]"); + goto end; + } + + if (!nf_service->versions) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [versions]"); + goto end; + } + cJSON *versionsList = cJSON_AddArrayToObject(item, "versions"); + if (versionsList == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [versions]"); + goto end; + } + + OpenAPI_lnode_t *versions_node; + if (nf_service->versions) { + OpenAPI_list_for_each(nf_service->versions, versions_node) { + cJSON *itemLocal = OpenAPI_nf_service_version_convertToJSON(versions_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [versions]"); + goto end; + } + cJSON_AddItemToArray(versionsList, itemLocal); + } + } + + if (!nf_service->scheme) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [scheme]"); + goto end; + } + if (cJSON_AddStringToObject(item, "scheme", OpenAPI_uri_scheme_ToString(nf_service->scheme)) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [scheme]"); + goto end; + } + + if (!nf_service->nf_service_status) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [nf_service_status]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfServiceStatus", OpenAPI_nf_service_status_ToString(nf_service->nf_service_status)) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [nf_service_status]"); + goto end; + } + + if (nf_service->fqdn) { + if (cJSON_AddStringToObject(item, "fqdn", nf_service->fqdn) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [fqdn]"); + goto end; + } + } + + if (nf_service->inter_plmn_fqdn) { + if (cJSON_AddStringToObject(item, "interPlmnFqdn", nf_service->inter_plmn_fqdn) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [inter_plmn_fqdn]"); + goto end; + } + } + + if (nf_service->ip_end_points) { + cJSON *ip_end_pointsList = cJSON_AddArrayToObject(item, "ipEndPoints"); + if (ip_end_pointsList == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [ip_end_points]"); + goto end; + } + + OpenAPI_lnode_t *ip_end_points_node; + if (nf_service->ip_end_points) { + OpenAPI_list_for_each(nf_service->ip_end_points, ip_end_points_node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(ip_end_points_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(ip_end_pointsList, itemLocal); + } + } + } + + if (nf_service->api_prefix) { + if (cJSON_AddStringToObject(item, "apiPrefix", nf_service->api_prefix) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [api_prefix]"); + goto end; + } + } + + if (nf_service->default_notification_subscriptions) { + cJSON *default_notification_subscriptionsList = cJSON_AddArrayToObject(item, "defaultNotificationSubscriptions"); + if (default_notification_subscriptionsList == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [default_notification_subscriptions]"); + goto end; + } + + OpenAPI_lnode_t *default_notification_subscriptions_node; + if (nf_service->default_notification_subscriptions) { + OpenAPI_list_for_each(nf_service->default_notification_subscriptions, default_notification_subscriptions_node) { + cJSON *itemLocal = OpenAPI_default_notification_subscription_convertToJSON(default_notification_subscriptions_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [default_notification_subscriptions]"); + goto end; + } + cJSON_AddItemToArray(default_notification_subscriptionsList, itemLocal); + } + } + } + + if (nf_service->allowed_plmns) { + cJSON *allowed_plmnsList = cJSON_AddArrayToObject(item, "allowedPlmns"); + if (allowed_plmnsList == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_plmns]"); + goto end; + } + + OpenAPI_lnode_t *allowed_plmns_node; + if (nf_service->allowed_plmns) { + OpenAPI_list_for_each(nf_service->allowed_plmns, allowed_plmns_node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(allowed_plmns_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_plmns]"); + goto end; + } + cJSON_AddItemToArray(allowed_plmnsList, itemLocal); + } + } + } + + if (nf_service->allowed_nf_types) { + cJSON *allowed_nf_types = cJSON_AddArrayToObject(item, "allowedNfTypes"); + if (allowed_nf_types == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_nf_types]"); + goto end; + } + OpenAPI_lnode_t *allowed_nf_types_node; + OpenAPI_list_for_each(nf_service->allowed_nf_types, allowed_nf_types_node) { + if (cJSON_AddStringToObject(allowed_nf_types, "", OpenAPI_nf_type_ToString((OpenAPI_nf_type_e)allowed_nf_types_node->data)) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_nf_types]"); + goto end; + } + } + } + + if (nf_service->allowed_nf_domains) { + cJSON *allowed_nf_domains = cJSON_AddArrayToObject(item, "allowedNfDomains"); + if (allowed_nf_domains == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_nf_domains]"); + goto end; + } + + OpenAPI_lnode_t *allowed_nf_domains_node; + OpenAPI_list_for_each(nf_service->allowed_nf_domains, allowed_nf_domains_node) { + if (cJSON_AddStringToObject(allowed_nf_domains, "", (char*)allowed_nf_domains_node->data) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_nf_domains]"); + goto end; + } + } + } + + if (nf_service->allowed_nssais) { + cJSON *allowed_nssaisList = cJSON_AddArrayToObject(item, "allowedNssais"); + if (allowed_nssaisList == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_nssais]"); + goto end; + } + + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [allowed_nssais]"); + goto end; + } + cJSON_AddItemToArray(allowed_nssaisList, itemLocal); + } + } + } + + if (nf_service->priority) { + if (cJSON_AddNumberToObject(item, "priority", nf_service->priority) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [priority]"); + goto end; + } + } + + if (nf_service->capacity) { + if (cJSON_AddNumberToObject(item, "capacity", nf_service->capacity) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [capacity]"); + goto end; + } + } + + if (nf_service->load) { + if (cJSON_AddNumberToObject(item, "load", nf_service->load) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [load]"); + goto end; + } + } + + if (nf_service->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", nf_service->recovery_time) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (nf_service->chf_service_info) { + cJSON *chf_service_info_local_JSON = OpenAPI_chf_service_info_convertToJSON(nf_service->chf_service_info); + if (chf_service_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [chf_service_info]"); + goto end; + } + cJSON_AddItemToObject(item, "chfServiceInfo", chf_service_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [chf_service_info]"); + goto end; + } + } + + if (nf_service->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", nf_service->supported_features) == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON) +{ + OpenAPI_nf_service_t *nf_service_local_var = NULL; + cJSON *service_instance_id = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "serviceInstanceId"); + if (!service_instance_id) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [service_instance_id]"); + goto end; + } + + + if (!cJSON_IsString(service_instance_id)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [service_instance_id]"); + goto end; + } + + cJSON *service_name = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "serviceName"); + if (!service_name) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [service_name]"); + goto end; + } + + + if (!cJSON_IsString(service_name)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [service_name]"); + goto end; + } + + cJSON *versions = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "versions"); + if (!versions) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [versions]"); + goto end; + } + + OpenAPI_list_t *versionsList; + + cJSON *versions_local_nonprimitive; + if (!cJSON_IsArray(versions)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [versions]"); + goto end; + } + + versionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(versions_local_nonprimitive, versions ) { + if (!cJSON_IsObject(versions_local_nonprimitive)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [versions]"); + goto end; + } + OpenAPI_nf_service_version_t *versionsItem = OpenAPI_nf_service_version_parseFromJSON(versions_local_nonprimitive); + + OpenAPI_list_add(versionsList, versionsItem); + } + + cJSON *scheme = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "scheme"); + if (!scheme) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [scheme]"); + goto end; + } + + OpenAPI_uri_scheme_e schemeVariable; + + if (!cJSON_IsString(scheme)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [scheme]"); + goto end; + } + schemeVariable = OpenAPI_uri_scheme_FromString(scheme->valuestring); + + cJSON *nf_service_status = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "nfServiceStatus"); + if (!nf_service_status) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [nf_service_status]"); + goto end; + } + + OpenAPI_nf_service_status_e nf_service_statusVariable; + + if (!cJSON_IsString(nf_service_status)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [nf_service_status]"); + goto end; + } + nf_service_statusVariable = OpenAPI_nf_service_status_FromString(nf_service_status->valuestring); + + cJSON *fqdn = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "fqdn"); + + if (fqdn) { + if (!cJSON_IsString(fqdn)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [fqdn]"); + goto end; + } + } + + cJSON *inter_plmn_fqdn = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "interPlmnFqdn"); + + if (inter_plmn_fqdn) { + if (!cJSON_IsString(inter_plmn_fqdn)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [inter_plmn_fqdn]"); + goto end; + } + } + + cJSON *ip_end_points = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "ipEndPoints"); + + OpenAPI_list_t *ip_end_pointsList; + if (ip_end_points) { + cJSON *ip_end_points_local_nonprimitive; + if (!cJSON_IsArray(ip_end_points)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [ip_end_points]"); + goto end; + } + + ip_end_pointsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ip_end_points_local_nonprimitive, ip_end_points ) { + if (!cJSON_IsObject(ip_end_points_local_nonprimitive)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [ip_end_points]"); + goto end; + } + OpenAPI_ip_end_point_t *ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(ip_end_points_local_nonprimitive); + + OpenAPI_list_add(ip_end_pointsList, ip_end_pointsItem); + } + } + + cJSON *api_prefix = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "apiPrefix"); + + if (api_prefix) { + if (!cJSON_IsString(api_prefix)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [api_prefix]"); + goto end; + } + } + + cJSON *default_notification_subscriptions = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "defaultNotificationSubscriptions"); + + OpenAPI_list_t *default_notification_subscriptionsList; + if (default_notification_subscriptions) { + cJSON *default_notification_subscriptions_local_nonprimitive; + if (!cJSON_IsArray(default_notification_subscriptions)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [default_notification_subscriptions]"); + goto end; + } + + default_notification_subscriptionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(default_notification_subscriptions_local_nonprimitive, default_notification_subscriptions ) { + if (!cJSON_IsObject(default_notification_subscriptions_local_nonprimitive)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [default_notification_subscriptions]"); + goto end; + } + OpenAPI_default_notification_subscription_t *default_notification_subscriptionsItem = OpenAPI_default_notification_subscription_parseFromJSON(default_notification_subscriptions_local_nonprimitive); + + OpenAPI_list_add(default_notification_subscriptionsList, default_notification_subscriptionsItem); + } + } + + cJSON *allowed_plmns = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "allowedPlmns"); + + OpenAPI_list_t *allowed_plmnsList; + if (allowed_plmns) { + cJSON *allowed_plmns_local_nonprimitive; + if (!cJSON_IsArray(allowed_plmns)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_plmns]"); + goto end; + } + + allowed_plmnsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_plmns_local_nonprimitive, allowed_plmns ) { + if (!cJSON_IsObject(allowed_plmns_local_nonprimitive)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_plmns]"); + goto end; + } + OpenAPI_plmn_id_t *allowed_plmnsItem = OpenAPI_plmn_id_parseFromJSON(allowed_plmns_local_nonprimitive); + + OpenAPI_list_add(allowed_plmnsList, allowed_plmnsItem); + } + } + + cJSON *allowed_nf_types = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "allowedNfTypes"); + + OpenAPI_list_t *allowed_nf_typesList; + if (allowed_nf_types) { + cJSON *allowed_nf_types_local_nonprimitive; + if (!cJSON_IsArray(allowed_nf_types)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_nf_types]"); + goto end; + } + + allowed_nf_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nf_types_local_nonprimitive, allowed_nf_types ) { + if (!cJSON_IsString(allowed_nf_types_local_nonprimitive)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_nf_types]"); + goto end; + } + + OpenAPI_list_add(allowed_nf_typesList, (void *)OpenAPI_nf_type_FromString(allowed_nf_types_local_nonprimitive->valuestring)); + } + } + + cJSON *allowed_nf_domains = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "allowedNfDomains"); + + OpenAPI_list_t *allowed_nf_domainsList; + if (allowed_nf_domains) { + cJSON *allowed_nf_domains_local; + if (!cJSON_IsArray(allowed_nf_domains)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_nf_domains]"); + goto end; + } + allowed_nf_domainsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nf_domains_local, allowed_nf_domains) { + if (!cJSON_IsString(allowed_nf_domains_local)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_nf_domains]"); + goto end; + } + OpenAPI_list_add(allowed_nf_domainsList, ogs_strdup(allowed_nf_domains_local->valuestring)); + } + } + + cJSON *allowed_nssais = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "allowedNssais"); + + OpenAPI_list_t *allowed_nssaisList; + if (allowed_nssais) { + cJSON *allowed_nssais_local_nonprimitive; + if (!cJSON_IsArray(allowed_nssais)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_nssais]"); + goto end; + } + + allowed_nssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_nssais_local_nonprimitive, allowed_nssais ) { + if (!cJSON_IsObject(allowed_nssais_local_nonprimitive)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [allowed_nssais]"); + goto end; + } + OpenAPI_snssai_t *allowed_nssaisItem = OpenAPI_snssai_parseFromJSON(allowed_nssais_local_nonprimitive); + + OpenAPI_list_add(allowed_nssaisList, allowed_nssaisItem); + } + } + + cJSON *priority = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "priority"); + + if (priority) { + if (!cJSON_IsNumber(priority)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [priority]"); + goto end; + } + } + + cJSON *capacity = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "capacity"); + + if (capacity) { + if (!cJSON_IsNumber(capacity)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [capacity]"); + goto end; + } + } + + cJSON *load = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "load"); + + if (load) { + if (!cJSON_IsNumber(load)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [load]"); + goto end; + } + } + + cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "recoveryTime"); + + if (recovery_time) { + if (!cJSON_IsString(recovery_time)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + cJSON *chf_service_info = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "chfServiceInfo"); + + OpenAPI_chf_service_info_t *chf_service_info_local_nonprim = NULL; + if (chf_service_info) { + chf_service_info_local_nonprim = OpenAPI_chf_service_info_parseFromJSON(chf_service_info); + } + + cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_nf_service_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + nf_service_local_var = OpenAPI_nf_service_create ( + ogs_strdup(service_instance_id->valuestring), + ogs_strdup(service_name->valuestring), + versionsList, + schemeVariable, + nf_service_statusVariable, + fqdn ? ogs_strdup(fqdn->valuestring) : NULL, + inter_plmn_fqdn ? ogs_strdup(inter_plmn_fqdn->valuestring) : NULL, + ip_end_points ? ip_end_pointsList : NULL, + api_prefix ? ogs_strdup(api_prefix->valuestring) : NULL, + default_notification_subscriptions ? default_notification_subscriptionsList : NULL, + allowed_plmns ? allowed_plmnsList : NULL, + allowed_nf_types ? allowed_nf_typesList : NULL, + allowed_nf_domains ? allowed_nf_domainsList : NULL, + allowed_nssais ? allowed_nssaisList : NULL, + priority ? priority->valuedouble : 0, + capacity ? capacity->valuedouble : 0, + load ? load->valuedouble : 0, + recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL, + chf_service_info ? chf_service_info_local_nonprim : NULL, + supported_features ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return nf_service_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nf_service.h b/lib/sbi/openapi/model/nf_service.h new file mode 100644 index 000000000..f3755cca9 --- /dev/null +++ b/lib/sbi/openapi/model/nf_service.h @@ -0,0 +1,84 @@ +/* + * nf_service.h + * + * + */ + +#ifndef _OpenAPI_nf_service_H_ +#define _OpenAPI_nf_service_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "chf_service_info.h" +#include "default_notification_subscription.h" +#include "ip_end_point.h" +#include "nf_service_status.h" +#include "nf_service_version.h" +#include "nf_type.h" +#include "plmn_id.h" +#include "snssai.h" +#include "uri_scheme.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_service_s OpenAPI_nf_service_t; +typedef struct OpenAPI_nf_service_s { + char *service_instance_id; + char *service_name; + OpenAPI_list_t *versions; + OpenAPI_uri_scheme_e scheme; + OpenAPI_nf_service_status_e nf_service_status; + char *fqdn; + char *inter_plmn_fqdn; + OpenAPI_list_t *ip_end_points; + char *api_prefix; + OpenAPI_list_t *default_notification_subscriptions; + OpenAPI_list_t *allowed_plmns; + OpenAPI_list_t *allowed_nf_types; + OpenAPI_list_t *allowed_nf_domains; + OpenAPI_list_t *allowed_nssais; + int priority; + int capacity; + int load; + char *recovery_time; + struct OpenAPI_chf_service_info_s *chf_service_info; + char *supported_features; +} OpenAPI_nf_service_t; + +OpenAPI_nf_service_t *OpenAPI_nf_service_create( + char *service_instance_id, + char *service_name, + OpenAPI_list_t *versions, + OpenAPI_uri_scheme_e scheme, + OpenAPI_nf_service_status_e nf_service_status, + char *fqdn, + char *inter_plmn_fqdn, + OpenAPI_list_t *ip_end_points, + char *api_prefix, + OpenAPI_list_t *default_notification_subscriptions, + OpenAPI_list_t *allowed_plmns, + OpenAPI_list_t *allowed_nf_types, + OpenAPI_list_t *allowed_nf_domains, + OpenAPI_list_t *allowed_nssais, + int priority, + int capacity, + int load, + char *recovery_time, + OpenAPI_chf_service_info_t *chf_service_info, + char *supported_features + ); +void OpenAPI_nf_service_free(OpenAPI_nf_service_t *nf_service); +OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON); +cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_service_H_ */ + diff --git a/lib/sbi/openapi/model/nf_service_status.c b/lib/sbi/openapi/model/nf_service_status.c new file mode 100644 index 000000000..623c34954 --- /dev/null +++ b/lib/sbi/openapi/model/nf_service_status.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "nf_service_status.h" + +char* OpenAPI_nf_service_status_ToString(OpenAPI_nf_service_status_e nf_service_status) +{ + const char *nf_service_statusArray[] = { "NULL", "REGISTERED", "SUSPENDED", "UNDISCOVERABLE" }; + size_t sizeofArray = sizeof(nf_service_statusArray) / sizeof(nf_service_statusArray[0]); + if (nf_service_status < sizeofArray) + return (char *)nf_service_statusArray[nf_service_status]; + else + return (char *)"Unknown"; +} + +OpenAPI_nf_service_status_e OpenAPI_nf_service_status_FromString(char* nf_service_status) +{ + int stringToReturn = 0; + const char *nf_service_statusArray[] = { "NULL", "REGISTERED", "SUSPENDED", "UNDISCOVERABLE" }; + size_t sizeofArray = sizeof(nf_service_statusArray) / sizeof(nf_service_statusArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(nf_service_status, nf_service_statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/nf_service_status.h b/lib/sbi/openapi/model/nf_service_status.h new file mode 100644 index 000000000..371b58982 --- /dev/null +++ b/lib/sbi/openapi/model/nf_service_status.h @@ -0,0 +1,31 @@ +/* + * nf_service_status.h + * + * + */ + +#ifndef _OpenAPI_nf_service_status_H_ +#define _OpenAPI_nf_service_status_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_nf_service_status_NULL = 0, OpenAPI_nf_service_status_REGISTERED, OpenAPI_nf_service_status_SUSPENDED, OpenAPI_nf_service_status_UNDISCOVERABLE } OpenAPI_nf_service_status_e; + +char* OpenAPI_nf_service_status_ToString(OpenAPI_nf_service_status_e nf_service_status); + +OpenAPI_nf_service_status_e OpenAPI_nf_service_status_FromString(char* nf_service_status); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_service_status_H_ */ + diff --git a/lib/sbi/openapi/model/nf_service_version.c b/lib/sbi/openapi/model/nf_service_version.c new file mode 100644 index 000000000..90f0f021b --- /dev/null +++ b/lib/sbi/openapi/model/nf_service_version.c @@ -0,0 +1,121 @@ + +#include +#include +#include +#include "nf_service_version.h" + +OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_create( + char *api_version_in_uri, + char *api_full_version, + char *expiry + ) +{ + OpenAPI_nf_service_version_t *nf_service_version_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_service_version_t)); + if (!nf_service_version_local_var) { + return NULL; + } + nf_service_version_local_var->api_version_in_uri = api_version_in_uri; + nf_service_version_local_var->api_full_version = api_full_version; + nf_service_version_local_var->expiry = expiry; + + return nf_service_version_local_var; +} + +void OpenAPI_nf_service_version_free(OpenAPI_nf_service_version_t *nf_service_version) +{ + if (NULL == nf_service_version) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nf_service_version->api_version_in_uri); + ogs_free(nf_service_version->api_full_version); + ogs_free(nf_service_version->expiry); + ogs_free(nf_service_version); +} + +cJSON *OpenAPI_nf_service_version_convertToJSON(OpenAPI_nf_service_version_t *nf_service_version) +{ + cJSON *item = NULL; + + if (nf_service_version == NULL) { + ogs_error("OpenAPI_nf_service_version_convertToJSON() failed [NFServiceVersion]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nf_service_version->api_version_in_uri) { + ogs_error("OpenAPI_nf_service_version_convertToJSON() failed [api_version_in_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "apiVersionInUri", nf_service_version->api_version_in_uri) == NULL) { + ogs_error("OpenAPI_nf_service_version_convertToJSON() failed [api_version_in_uri]"); + goto end; + } + + if (!nf_service_version->api_full_version) { + ogs_error("OpenAPI_nf_service_version_convertToJSON() failed [api_full_version]"); + goto end; + } + if (cJSON_AddStringToObject(item, "apiFullVersion", nf_service_version->api_full_version) == NULL) { + ogs_error("OpenAPI_nf_service_version_convertToJSON() failed [api_full_version]"); + goto end; + } + + if (nf_service_version->expiry) { + if (cJSON_AddStringToObject(item, "expiry", nf_service_version->expiry) == NULL) { + ogs_error("OpenAPI_nf_service_version_convertToJSON() failed [expiry]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_parseFromJSON(cJSON *nf_service_versionJSON) +{ + OpenAPI_nf_service_version_t *nf_service_version_local_var = NULL; + cJSON *api_version_in_uri = cJSON_GetObjectItemCaseSensitive(nf_service_versionJSON, "apiVersionInUri"); + if (!api_version_in_uri) { + ogs_error("OpenAPI_nf_service_version_parseFromJSON() failed [api_version_in_uri]"); + goto end; + } + + + if (!cJSON_IsString(api_version_in_uri)) { + ogs_error("OpenAPI_nf_service_version_parseFromJSON() failed [api_version_in_uri]"); + goto end; + } + + cJSON *api_full_version = cJSON_GetObjectItemCaseSensitive(nf_service_versionJSON, "apiFullVersion"); + if (!api_full_version) { + ogs_error("OpenAPI_nf_service_version_parseFromJSON() failed [api_full_version]"); + goto end; + } + + + if (!cJSON_IsString(api_full_version)) { + ogs_error("OpenAPI_nf_service_version_parseFromJSON() failed [api_full_version]"); + goto end; + } + + cJSON *expiry = cJSON_GetObjectItemCaseSensitive(nf_service_versionJSON, "expiry"); + + if (expiry) { + if (!cJSON_IsString(expiry)) { + ogs_error("OpenAPI_nf_service_version_parseFromJSON() failed [expiry]"); + goto end; + } + } + + nf_service_version_local_var = OpenAPI_nf_service_version_create ( + ogs_strdup(api_version_in_uri->valuestring), + ogs_strdup(api_full_version->valuestring), + expiry ? ogs_strdup(expiry->valuestring) : NULL + ); + + return nf_service_version_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nf_service_version.h b/lib/sbi/openapi/model/nf_service_version.h new file mode 100644 index 000000000..2cf60eb92 --- /dev/null +++ b/lib/sbi/openapi/model/nf_service_version.h @@ -0,0 +1,41 @@ +/* + * nf_service_version.h + * + * + */ + +#ifndef _OpenAPI_nf_service_version_H_ +#define _OpenAPI_nf_service_version_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_service_version_s OpenAPI_nf_service_version_t; +typedef struct OpenAPI_nf_service_version_s { + char *api_version_in_uri; + char *api_full_version; + char *expiry; +} OpenAPI_nf_service_version_t; + +OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_create( + char *api_version_in_uri, + char *api_full_version, + char *expiry + ); +void OpenAPI_nf_service_version_free(OpenAPI_nf_service_version_t *nf_service_version); +OpenAPI_nf_service_version_t *OpenAPI_nf_service_version_parseFromJSON(cJSON *nf_service_versionJSON); +cJSON *OpenAPI_nf_service_version_convertToJSON(OpenAPI_nf_service_version_t *nf_service_version); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_service_version_H_ */ + diff --git a/lib/sbi/openapi/model/nf_status.c b/lib/sbi/openapi/model/nf_status.c new file mode 100644 index 000000000..c80b688cb --- /dev/null +++ b/lib/sbi/openapi/model/nf_status.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "nf_status.h" + +char* OpenAPI_nf_status_ToString(OpenAPI_nf_status_e nf_status) +{ + const char *nf_statusArray[] = { "NULL", "REGISTERED", "SUSPENDED", "UNDISCOVERABLE" }; + size_t sizeofArray = sizeof(nf_statusArray) / sizeof(nf_statusArray[0]); + if (nf_status < sizeofArray) + return (char *)nf_statusArray[nf_status]; + else + return (char *)"Unknown"; +} + +OpenAPI_nf_status_e OpenAPI_nf_status_FromString(char* nf_status) +{ + int stringToReturn = 0; + const char *nf_statusArray[] = { "NULL", "REGISTERED", "SUSPENDED", "UNDISCOVERABLE" }; + size_t sizeofArray = sizeof(nf_statusArray) / sizeof(nf_statusArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(nf_status, nf_statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/nf_status.h b/lib/sbi/openapi/model/nf_status.h new file mode 100644 index 000000000..fc27af587 --- /dev/null +++ b/lib/sbi/openapi/model/nf_status.h @@ -0,0 +1,31 @@ +/* + * nf_status.h + * + * + */ + +#ifndef _OpenAPI_nf_status_H_ +#define _OpenAPI_nf_status_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_nf_status_NULL = 0, OpenAPI_nf_status_REGISTERED, OpenAPI_nf_status_SUSPENDED, OpenAPI_nf_status_UNDISCOVERABLE } OpenAPI_nf_status_e; + +char* OpenAPI_nf_status_ToString(OpenAPI_nf_status_e nf_status); + +OpenAPI_nf_status_e OpenAPI_nf_status_FromString(char* nf_status); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_status_H_ */ + diff --git a/lib/sbi/openapi/model/nf_type.c b/lib/sbi/openapi/model/nf_type.c new file mode 100644 index 000000000..d1f4c686e --- /dev/null +++ b/lib/sbi/openapi/model/nf_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "nf_type.h" + +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" }; + size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); + if (nf_type < sizeofArray) + return (char *)nf_typeArray[nf_type]; + else + return (char *)"Unknown"; +} + +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" }; + size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(nf_type, nf_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/nf_type.h b/lib/sbi/openapi/model/nf_type.h new file mode 100644 index 000000000..ae3551997 --- /dev/null +++ b/lib/sbi/openapi/model/nf_type.h @@ -0,0 +1,31 @@ +/* + * nf_type.h + * + * + */ + +#ifndef _OpenAPI_nf_type_H_ +#define _OpenAPI_nf_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_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_e; + +char* OpenAPI_nf_type_ToString(OpenAPI_nf_type_e nf_type); + +OpenAPI_nf_type_e OpenAPI_nf_type_FromString(char* nf_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_type_H_ */ + diff --git a/lib/sbi/openapi/model/nf_type_cond.c b/lib/sbi/openapi/model/nf_type_cond.c new file mode 100644 index 000000000..6f1cb8cad --- /dev/null +++ b/lib/sbi/openapi/model/nf_type_cond.c @@ -0,0 +1,77 @@ + +#include +#include +#include +#include "nf_type_cond.h" + +OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_create( + OpenAPI_nf_type_e nf_type + ) +{ + OpenAPI_nf_type_cond_t *nf_type_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_nf_type_cond_t)); + if (!nf_type_cond_local_var) { + return NULL; + } + nf_type_cond_local_var->nf_type = nf_type; + + return nf_type_cond_local_var; +} + +void OpenAPI_nf_type_cond_free(OpenAPI_nf_type_cond_t *nf_type_cond) +{ + if (NULL == nf_type_cond) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nf_type_cond); +} + +cJSON *OpenAPI_nf_type_cond_convertToJSON(OpenAPI_nf_type_cond_t *nf_type_cond) +{ + cJSON *item = NULL; + + if (nf_type_cond == NULL) { + ogs_error("OpenAPI_nf_type_cond_convertToJSON() failed [NfTypeCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nf_type_cond->nf_type) { + ogs_error("OpenAPI_nf_type_cond_convertToJSON() failed [nf_type]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_type_ToString(nf_type_cond->nf_type)) == NULL) { + ogs_error("OpenAPI_nf_type_cond_convertToJSON() failed [nf_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_parseFromJSON(cJSON *nf_type_condJSON) +{ + OpenAPI_nf_type_cond_t *nf_type_cond_local_var = NULL; + cJSON *nf_type = cJSON_GetObjectItemCaseSensitive(nf_type_condJSON, "nfType"); + if (!nf_type) { + ogs_error("OpenAPI_nf_type_cond_parseFromJSON() failed [nf_type]"); + goto end; + } + + OpenAPI_nf_type_e nf_typeVariable; + + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_nf_type_cond_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_nf_type_FromString(nf_type->valuestring); + + nf_type_cond_local_var = OpenAPI_nf_type_cond_create ( + nf_typeVariable + ); + + return nf_type_cond_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nf_type_cond.h b/lib/sbi/openapi/model/nf_type_cond.h new file mode 100644 index 000000000..2a4a3db40 --- /dev/null +++ b/lib/sbi/openapi/model/nf_type_cond.h @@ -0,0 +1,38 @@ +/* + * nf_type_cond.h + * + * + */ + +#ifndef _OpenAPI_nf_type_cond_H_ +#define _OpenAPI_nf_type_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_type_cond_s OpenAPI_nf_type_cond_t; +typedef struct OpenAPI_nf_type_cond_s { + OpenAPI_nf_type_e nf_type; +} OpenAPI_nf_type_cond_t; + +OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_create( + OpenAPI_nf_type_e nf_type + ); +void OpenAPI_nf_type_cond_free(OpenAPI_nf_type_cond_t *nf_type_cond); +OpenAPI_nf_type_cond_t *OpenAPI_nf_type_cond_parseFromJSON(cJSON *nf_type_condJSON); +cJSON *OpenAPI_nf_type_cond_convertToJSON(OpenAPI_nf_type_cond_t *nf_type_cond); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_type_cond_H_ */ + diff --git a/lib/sbi/openapi/model/notif_condition.c b/lib/sbi/openapi/model/notif_condition.c new file mode 100644 index 000000000..26daf1076 --- /dev/null +++ b/lib/sbi/openapi/model/notif_condition.c @@ -0,0 +1,137 @@ + +#include +#include +#include +#include "notif_condition.h" + +OpenAPI_notif_condition_t *OpenAPI_notif_condition_create( + OpenAPI_list_t *monitored_attributes, + OpenAPI_list_t *unmonitored_attributes + ) +{ + OpenAPI_notif_condition_t *notif_condition_local_var = OpenAPI_malloc(sizeof(OpenAPI_notif_condition_t)); + if (!notif_condition_local_var) { + return NULL; + } + notif_condition_local_var->monitored_attributes = monitored_attributes; + notif_condition_local_var->unmonitored_attributes = unmonitored_attributes; + + return notif_condition_local_var; +} + +void OpenAPI_notif_condition_free(OpenAPI_notif_condition_t *notif_condition) +{ + if (NULL == notif_condition) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(notif_condition->monitored_attributes, node) { + ogs_free(node->data); + } + OpenAPI_list_free(notif_condition->monitored_attributes); + OpenAPI_list_for_each(notif_condition->unmonitored_attributes, node) { + ogs_free(node->data); + } + OpenAPI_list_free(notif_condition->unmonitored_attributes); + ogs_free(notif_condition); +} + +cJSON *OpenAPI_notif_condition_convertToJSON(OpenAPI_notif_condition_t *notif_condition) +{ + cJSON *item = NULL; + + if (notif_condition == NULL) { + ogs_error("OpenAPI_notif_condition_convertToJSON() failed [NotifCondition]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (notif_condition->monitored_attributes) { + cJSON *monitored_attributes = cJSON_AddArrayToObject(item, "monitoredAttributes"); + if (monitored_attributes == NULL) { + ogs_error("OpenAPI_notif_condition_convertToJSON() failed [monitored_attributes]"); + goto end; + } + + OpenAPI_lnode_t *monitored_attributes_node; + OpenAPI_list_for_each(notif_condition->monitored_attributes, monitored_attributes_node) { + if (cJSON_AddStringToObject(monitored_attributes, "", (char*)monitored_attributes_node->data) == NULL) { + ogs_error("OpenAPI_notif_condition_convertToJSON() failed [monitored_attributes]"); + goto end; + } + } + } + + if (notif_condition->unmonitored_attributes) { + cJSON *unmonitored_attributes = cJSON_AddArrayToObject(item, "unmonitoredAttributes"); + if (unmonitored_attributes == NULL) { + ogs_error("OpenAPI_notif_condition_convertToJSON() failed [unmonitored_attributes]"); + goto end; + } + + OpenAPI_lnode_t *unmonitored_attributes_node; + OpenAPI_list_for_each(notif_condition->unmonitored_attributes, unmonitored_attributes_node) { + if (cJSON_AddStringToObject(unmonitored_attributes, "", (char*)unmonitored_attributes_node->data) == NULL) { + ogs_error("OpenAPI_notif_condition_convertToJSON() failed [unmonitored_attributes]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_notif_condition_t *OpenAPI_notif_condition_parseFromJSON(cJSON *notif_conditionJSON) +{ + OpenAPI_notif_condition_t *notif_condition_local_var = NULL; + cJSON *monitored_attributes = cJSON_GetObjectItemCaseSensitive(notif_conditionJSON, "monitoredAttributes"); + + OpenAPI_list_t *monitored_attributesList; + if (monitored_attributes) { + cJSON *monitored_attributes_local; + if (!cJSON_IsArray(monitored_attributes)) { + ogs_error("OpenAPI_notif_condition_parseFromJSON() failed [monitored_attributes]"); + goto end; + } + monitored_attributesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(monitored_attributes_local, monitored_attributes) { + if (!cJSON_IsString(monitored_attributes_local)) { + ogs_error("OpenAPI_notif_condition_parseFromJSON() failed [monitored_attributes]"); + goto end; + } + OpenAPI_list_add(monitored_attributesList, ogs_strdup(monitored_attributes_local->valuestring)); + } + } + + cJSON *unmonitored_attributes = cJSON_GetObjectItemCaseSensitive(notif_conditionJSON, "unmonitoredAttributes"); + + OpenAPI_list_t *unmonitored_attributesList; + if (unmonitored_attributes) { + cJSON *unmonitored_attributes_local; + if (!cJSON_IsArray(unmonitored_attributes)) { + ogs_error("OpenAPI_notif_condition_parseFromJSON() failed [unmonitored_attributes]"); + goto end; + } + unmonitored_attributesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(unmonitored_attributes_local, unmonitored_attributes) { + if (!cJSON_IsString(unmonitored_attributes_local)) { + ogs_error("OpenAPI_notif_condition_parseFromJSON() failed [unmonitored_attributes]"); + goto end; + } + OpenAPI_list_add(unmonitored_attributesList, ogs_strdup(unmonitored_attributes_local->valuestring)); + } + } + + notif_condition_local_var = OpenAPI_notif_condition_create ( + monitored_attributes ? monitored_attributesList : NULL, + unmonitored_attributes ? unmonitored_attributesList : NULL + ); + + return notif_condition_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/notif_condition.h b/lib/sbi/openapi/model/notif_condition.h new file mode 100644 index 000000000..c2c5e5688 --- /dev/null +++ b/lib/sbi/openapi/model/notif_condition.h @@ -0,0 +1,39 @@ +/* + * notif_condition.h + * + * + */ + +#ifndef _OpenAPI_notif_condition_H_ +#define _OpenAPI_notif_condition_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_notif_condition_s OpenAPI_notif_condition_t; +typedef struct OpenAPI_notif_condition_s { + OpenAPI_list_t *monitored_attributes; + OpenAPI_list_t *unmonitored_attributes; +} OpenAPI_notif_condition_t; + +OpenAPI_notif_condition_t *OpenAPI_notif_condition_create( + OpenAPI_list_t *monitored_attributes, + OpenAPI_list_t *unmonitored_attributes + ); +void OpenAPI_notif_condition_free(OpenAPI_notif_condition_t *notif_condition); +OpenAPI_notif_condition_t *OpenAPI_notif_condition_parseFromJSON(cJSON *notif_conditionJSON); +cJSON *OpenAPI_notif_condition_convertToJSON(OpenAPI_notif_condition_t *notif_condition); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notif_condition_H_ */ + diff --git a/lib/sbi/openapi/model/notification_data.c b/lib/sbi/openapi/model/notification_data.c new file mode 100644 index 000000000..f5637ee61 --- /dev/null +++ b/lib/sbi/openapi/model/notification_data.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "notification_data.h" + +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_notification_data_t *notification_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_notification_data_t)); + if (!notification_data_local_var) { + return NULL; + } + notification_data_local_var->event = event; + 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; + + return notification_data_local_var; +} + +void OpenAPI_notification_data_free(OpenAPI_notification_data_t *notification_data) +{ + if (NULL == notification_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(notification_data->nf_instance_uri); + OpenAPI_nf_profile_free(notification_data->nf_profile); + OpenAPI_list_for_each(notification_data->profile_changes, node) { + OpenAPI_change_item_free(node->data); + } + OpenAPI_list_free(notification_data->profile_changes); + ogs_free(notification_data); +} + +cJSON *OpenAPI_notification_data_convertToJSON(OpenAPI_notification_data_t *notification_data) +{ + cJSON *item = NULL; + + if (notification_data == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [NotificationData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!notification_data->event) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [event]"); + goto end; + } + if (cJSON_AddStringToObject(item, "event", OpenAPI_notification_event_type_ToString(notification_data->event)) == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [event]"); + goto end; + } + + if (!notification_data->nf_instance_uri) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [nf_instance_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfInstanceUri", notification_data->nf_instance_uri) == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [nf_instance_uri]"); + goto end; + } + + if (notification_data->nf_profile) { + cJSON *nf_profile_local_JSON = OpenAPI_nf_profile_convertToJSON(notification_data->nf_profile); + if (nf_profile_local_JSON == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [nf_profile]"); + goto end; + } + cJSON_AddItemToObject(item, "nfProfile", nf_profile_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [nf_profile]"); + goto end; + } + } + + if (notification_data->profile_changes) { + cJSON *profile_changesList = cJSON_AddArrayToObject(item, "profileChanges"); + if (profile_changesList == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [profile_changes]"); + goto end; + } + + OpenAPI_lnode_t *profile_changes_node; + if (notification_data->profile_changes) { + OpenAPI_list_for_each(notification_data->profile_changes, profile_changes_node) { + cJSON *itemLocal = OpenAPI_change_item_convertToJSON(profile_changes_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [profile_changes]"); + goto end; + } + cJSON_AddItemToArray(profile_changesList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *notification_dataJSON) +{ + OpenAPI_notification_data_t *notification_data_local_var = NULL; + cJSON *event = cJSON_GetObjectItemCaseSensitive(notification_dataJSON, "event"); + if (!event) { + ogs_error("OpenAPI_notification_data_parseFromJSON() failed [event]"); + goto end; + } + + OpenAPI_notification_event_type_e eventVariable; + + if (!cJSON_IsString(event)) { + ogs_error("OpenAPI_notification_data_parseFromJSON() failed [event]"); + goto end; + } + eventVariable = OpenAPI_notification_event_type_FromString(event->valuestring); + + cJSON *nf_instance_uri = cJSON_GetObjectItemCaseSensitive(notification_dataJSON, "nfInstanceUri"); + if (!nf_instance_uri) { + ogs_error("OpenAPI_notification_data_parseFromJSON() failed [nf_instance_uri]"); + goto end; + } + + + if (!cJSON_IsString(nf_instance_uri)) { + ogs_error("OpenAPI_notification_data_parseFromJSON() failed [nf_instance_uri]"); + goto end; + } + + cJSON *nf_profile = cJSON_GetObjectItemCaseSensitive(notification_dataJSON, "nfProfile"); + + OpenAPI_nf_profile_t *nf_profile_local_nonprim = NULL; + if (nf_profile) { + nf_profile_local_nonprim = OpenAPI_nf_profile_parseFromJSON(nf_profile); + } + + cJSON *profile_changes = cJSON_GetObjectItemCaseSensitive(notification_dataJSON, "profileChanges"); + + OpenAPI_list_t *profile_changesList; + if (profile_changes) { + cJSON *profile_changes_local_nonprimitive; + if (!cJSON_IsArray(profile_changes)) { + ogs_error("OpenAPI_notification_data_parseFromJSON() failed [profile_changes]"); + goto end; + } + + profile_changesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(profile_changes_local_nonprimitive, profile_changes ) { + if (!cJSON_IsObject(profile_changes_local_nonprimitive)) { + ogs_error("OpenAPI_notification_data_parseFromJSON() failed [profile_changes]"); + goto end; + } + OpenAPI_change_item_t *profile_changesItem = OpenAPI_change_item_parseFromJSON(profile_changes_local_nonprimitive); + + OpenAPI_list_add(profile_changesList, profile_changesItem); + } + } + + 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 + ); + + return notification_data_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/notification_data.h b/lib/sbi/openapi/model/notification_data.h new file mode 100644 index 000000000..91194c7a6 --- /dev/null +++ b/lib/sbi/openapi/model/notification_data.h @@ -0,0 +1,46 @@ +/* + * notification_data.h + * + * + */ + +#ifndef _OpenAPI_notification_data_H_ +#define _OpenAPI_notification_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "change_item.h" +#include "nf_profile.h" +#include "notification_event_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_notification_data_s OpenAPI_notification_data_t; +typedef struct OpenAPI_notification_data_s { + OpenAPI_notification_event_type_e event; + char *nf_instance_uri; + struct OpenAPI_nf_profile_s *nf_profile; + OpenAPI_list_t *profile_changes; +} 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 + ); +void OpenAPI_notification_data_free(OpenAPI_notification_data_t *notification_data); +OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *notification_dataJSON); +cJSON *OpenAPI_notification_data_convertToJSON(OpenAPI_notification_data_t *notification_data); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_data_H_ */ + diff --git a/lib/sbi/openapi/model/notification_event_type.c b/lib/sbi/openapi/model/notification_event_type.c new file mode 100644 index 000000000..338ccf34f --- /dev/null +++ b/lib/sbi/openapi/model/notification_event_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "notification_event_type.h" + +char* OpenAPI_notification_event_type_ToString(OpenAPI_notification_event_type_e notification_event_type) +{ + const char *notification_event_typeArray[] = { "NULL", "NF_REGISTERED", "NF_DEREGISTERED", "NF_PROFILE_CHANGED" }; + size_t sizeofArray = sizeof(notification_event_typeArray) / sizeof(notification_event_typeArray[0]); + if (notification_event_type < sizeofArray) + return (char *)notification_event_typeArray[notification_event_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_notification_event_type_e OpenAPI_notification_event_type_FromString(char* notification_event_type) +{ + int stringToReturn = 0; + const char *notification_event_typeArray[] = { "NULL", "NF_REGISTERED", "NF_DEREGISTERED", "NF_PROFILE_CHANGED" }; + size_t sizeofArray = sizeof(notification_event_typeArray) / sizeof(notification_event_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(notification_event_type, notification_event_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/notification_event_type.h b/lib/sbi/openapi/model/notification_event_type.h new file mode 100644 index 000000000..7892f4b96 --- /dev/null +++ b/lib/sbi/openapi/model/notification_event_type.h @@ -0,0 +1,31 @@ +/* + * notification_event_type.h + * + * + */ + +#ifndef _OpenAPI_notification_event_type_H_ +#define _OpenAPI_notification_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_notification_event_type_NULL = 0, OpenAPI_notification_event_type_NF_REGISTERED, OpenAPI_notification_event_type_NF_DEREGISTERED, OpenAPI_notification_event_type_NF_PROFILE_CHANGED } OpenAPI_notification_event_type_e; + +char* OpenAPI_notification_event_type_ToString(OpenAPI_notification_event_type_e notification_event_type); + +OpenAPI_notification_event_type_e OpenAPI_notification_event_type_FromString(char* notification_event_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_event_type_H_ */ + diff --git a/lib/sbi/openapi/model/notification_type.c b/lib/sbi/openapi/model/notification_type.c new file mode 100644 index 000000000..66b6e32a6 --- /dev/null +++ b/lib/sbi/openapi/model/notification_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "notification_type.h" + +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" }; + size_t sizeofArray = sizeof(notification_typeArray) / sizeof(notification_typeArray[0]); + if (notification_type < sizeofArray) + return (char *)notification_typeArray[notification_type]; + else + return (char *)"Unknown"; +} + +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" }; + size_t sizeofArray = sizeof(notification_typeArray) / sizeof(notification_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(notification_type, notification_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/notification_type.h b/lib/sbi/openapi/model/notification_type.h new file mode 100644 index 000000000..3cf33b4f9 --- /dev/null +++ b/lib/sbi/openapi/model/notification_type.h @@ -0,0 +1,31 @@ +/* + * notification_type.h + * + * + */ + +#ifndef _OpenAPI_notification_type_H_ +#define _OpenAPI_notification_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_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_e; + +char* OpenAPI_notification_type_ToString(OpenAPI_notification_type_e notification_type); + +OpenAPI_notification_type_e OpenAPI_notification_type_FromString(char* notification_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_type_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info.c b/lib/sbi/openapi/model/nrf_info.c new file mode 100644 index 000000000..8d5e60f9e --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info.c @@ -0,0 +1,581 @@ + +#include +#include +#include +#include "nrf_info.h" + +OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( + OpenAPI_list_t* served_udr_info, + OpenAPI_list_t* served_udm_info, + OpenAPI_list_t* served_ausf_info, + OpenAPI_list_t* served_amf_info, + OpenAPI_list_t* served_smf_info, + OpenAPI_list_t* served_upf_info, + OpenAPI_list_t* served_pcf_info, + OpenAPI_list_t* served_bsf_info, + OpenAPI_list_t* served_chf_info, + OpenAPI_list_t* served_nwdaf_info + ) +{ + OpenAPI_nrf_info_t *nrf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_nrf_info_t)); + if (!nrf_info_local_var) { + return NULL; + } + nrf_info_local_var->served_udr_info = served_udr_info; + nrf_info_local_var->served_udm_info = served_udm_info; + nrf_info_local_var->served_ausf_info = served_ausf_info; + nrf_info_local_var->served_amf_info = served_amf_info; + nrf_info_local_var->served_smf_info = served_smf_info; + nrf_info_local_var->served_upf_info = served_upf_info; + nrf_info_local_var->served_pcf_info = served_pcf_info; + nrf_info_local_var->served_bsf_info = served_bsf_info; + nrf_info_local_var->served_chf_info = served_chf_info; + nrf_info_local_var->served_nwdaf_info = served_nwdaf_info; + + return nrf_info_local_var; +} + +void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) +{ + if (NULL == nrf_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(nrf_info->served_udr_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_udr_info_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_udr_info); + 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_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_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_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_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_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_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_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_nwdaf_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + OpenAPI_nwdaf_info_free(localKeyValue->value); + ogs_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_nwdaf_info); + ogs_free(nrf_info); +} + +cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) +{ + cJSON *item = NULL; + + if (nrf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [NrfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info->served_udr_info) { + cJSON *served_udr_info = cJSON_AddObjectToObject(item, "servedUdrInfo"); + if (served_udr_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udr_info]"); + goto end; + } + cJSON *localMapObject = served_udr_info; + OpenAPI_lnode_t *served_udr_info_node; + if (nrf_info->served_udr_info) { + OpenAPI_list_for_each(nrf_info->served_udr_info, served_udr_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_udr_info_node->data; + cJSON *itemLocal = OpenAPI_udr_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udr_info]"); + goto end; + } + cJSON_AddItemToObject(served_udr_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_udm_info) { + cJSON *served_udm_info = cJSON_AddObjectToObject(item, "servedUdmInfo"); + if (served_udm_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udm_info]"); + goto end; + } + cJSON *localMapObject = served_udm_info; + OpenAPI_lnode_t *served_udm_info_node; + if (nrf_info->served_udm_info) { + OpenAPI_list_for_each(nrf_info->served_udm_info, served_udm_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_udm_info_node->data; + cJSON *itemLocal = OpenAPI_udm_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_udm_info]"); + goto end; + } + cJSON_AddItemToObject(served_udm_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_ausf_info) { + cJSON *served_ausf_info = cJSON_AddObjectToObject(item, "servedAusfInfo"); + if (served_ausf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_ausf_info]"); + goto end; + } + cJSON *localMapObject = served_ausf_info; + OpenAPI_lnode_t *served_ausf_info_node; + if (nrf_info->served_ausf_info) { + OpenAPI_list_for_each(nrf_info->served_ausf_info, served_ausf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_ausf_info_node->data; + cJSON *itemLocal = OpenAPI_ausf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_ausf_info]"); + goto end; + } + cJSON_AddItemToObject(served_ausf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_amf_info) { + cJSON *served_amf_info = cJSON_AddObjectToObject(item, "servedAmfInfo"); + if (served_amf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_amf_info]"); + goto end; + } + cJSON *localMapObject = served_amf_info; + OpenAPI_lnode_t *served_amf_info_node; + if (nrf_info->served_amf_info) { + OpenAPI_list_for_each(nrf_info->served_amf_info, served_amf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_amf_info_node->data; + cJSON *itemLocal = OpenAPI_amf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_amf_info]"); + goto end; + } + cJSON_AddItemToObject(served_amf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_smf_info) { + cJSON *served_smf_info = cJSON_AddObjectToObject(item, "servedSmfInfo"); + if (served_smf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_smf_info]"); + goto end; + } + cJSON *localMapObject = served_smf_info; + OpenAPI_lnode_t *served_smf_info_node; + if (nrf_info->served_smf_info) { + OpenAPI_list_for_each(nrf_info->served_smf_info, served_smf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_smf_info_node->data; + cJSON *itemLocal = OpenAPI_smf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_smf_info]"); + goto end; + } + cJSON_AddItemToObject(served_smf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_upf_info) { + cJSON *served_upf_info = cJSON_AddObjectToObject(item, "servedUpfInfo"); + if (served_upf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_upf_info]"); + goto end; + } + cJSON *localMapObject = served_upf_info; + OpenAPI_lnode_t *served_upf_info_node; + if (nrf_info->served_upf_info) { + OpenAPI_list_for_each(nrf_info->served_upf_info, served_upf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_upf_info_node->data; + cJSON *itemLocal = OpenAPI_upf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_upf_info]"); + goto end; + } + cJSON_AddItemToObject(served_upf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_pcf_info) { + cJSON *served_pcf_info = cJSON_AddObjectToObject(item, "servedPcfInfo"); + if (served_pcf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_pcf_info]"); + goto end; + } + cJSON *localMapObject = served_pcf_info; + OpenAPI_lnode_t *served_pcf_info_node; + if (nrf_info->served_pcf_info) { + OpenAPI_list_for_each(nrf_info->served_pcf_info, served_pcf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_pcf_info_node->data; + cJSON *itemLocal = OpenAPI_pcf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_pcf_info]"); + goto end; + } + cJSON_AddItemToObject(served_pcf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_bsf_info) { + cJSON *served_bsf_info = cJSON_AddObjectToObject(item, "servedBsfInfo"); + if (served_bsf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_bsf_info]"); + goto end; + } + cJSON *localMapObject = served_bsf_info; + OpenAPI_lnode_t *served_bsf_info_node; + if (nrf_info->served_bsf_info) { + OpenAPI_list_for_each(nrf_info->served_bsf_info, served_bsf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_bsf_info_node->data; + cJSON *itemLocal = OpenAPI_bsf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_bsf_info]"); + goto end; + } + cJSON_AddItemToObject(served_bsf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_chf_info) { + cJSON *served_chf_info = cJSON_AddObjectToObject(item, "servedChfInfo"); + if (served_chf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_chf_info]"); + goto end; + } + cJSON *localMapObject = served_chf_info; + OpenAPI_lnode_t *served_chf_info_node; + if (nrf_info->served_chf_info) { + OpenAPI_list_for_each(nrf_info->served_chf_info, served_chf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_chf_info_node->data; + cJSON *itemLocal = OpenAPI_chf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_chf_info]"); + goto end; + } + cJSON_AddItemToObject(served_chf_info, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_nwdaf_info) { + cJSON *served_nwdaf_info = cJSON_AddObjectToObject(item, "servedNwdafInfo"); + if (served_nwdaf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_nwdaf_info]"); + goto end; + } + cJSON *localMapObject = served_nwdaf_info; + OpenAPI_lnode_t *served_nwdaf_info_node; + if (nrf_info->served_nwdaf_info) { + OpenAPI_list_for_each(nrf_info->served_nwdaf_info, served_nwdaf_info_node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)served_nwdaf_info_node->data; + cJSON *itemLocal = OpenAPI_nwdaf_info_convertToJSON(localKeyValue->value); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_nwdaf_info]"); + goto end; + } + cJSON_AddItemToObject(served_nwdaf_info, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) +{ + OpenAPI_nrf_info_t *nrf_info_local_var = NULL; + cJSON *served_udr_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdrInfo"); + + OpenAPI_list_t *served_udr_infoList; + if (served_udr_info) { + cJSON *served_udr_info_local_map; + if (!cJSON_IsObject(served_udr_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udr_info]"); + goto end; + } + served_udr_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_udr_info_local_map, served_udr_info) { + cJSON *localMapObject = served_udr_info_local_map; + if (!cJSON_IsObject(served_udr_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udr_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_udr_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_udr_infoList, localMapKeyPair); + } + } + + cJSON *served_udm_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdmInfo"); + + OpenAPI_list_t *served_udm_infoList; + if (served_udm_info) { + cJSON *served_udm_info_local_map; + if (!cJSON_IsObject(served_udm_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udm_info]"); + goto end; + } + served_udm_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_udm_info_local_map, served_udm_info) { + cJSON *localMapObject = served_udm_info_local_map; + if (!cJSON_IsObject(served_udm_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_udm_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_udm_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_udm_infoList, localMapKeyPair); + } + } + + cJSON *served_ausf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedAusfInfo"); + + OpenAPI_list_t *served_ausf_infoList; + if (served_ausf_info) { + cJSON *served_ausf_info_local_map; + if (!cJSON_IsObject(served_ausf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_ausf_info]"); + goto end; + } + served_ausf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_ausf_info_local_map, served_ausf_info) { + cJSON *localMapObject = served_ausf_info_local_map; + if (!cJSON_IsObject(served_ausf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_ausf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_ausf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_ausf_infoList, localMapKeyPair); + } + } + + cJSON *served_amf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedAmfInfo"); + + OpenAPI_list_t *served_amf_infoList; + if (served_amf_info) { + cJSON *served_amf_info_local_map; + if (!cJSON_IsObject(served_amf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_amf_info]"); + goto end; + } + served_amf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_amf_info_local_map, served_amf_info) { + cJSON *localMapObject = served_amf_info_local_map; + if (!cJSON_IsObject(served_amf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_amf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_amf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_amf_infoList, localMapKeyPair); + } + } + + cJSON *served_smf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedSmfInfo"); + + OpenAPI_list_t *served_smf_infoList; + if (served_smf_info) { + cJSON *served_smf_info_local_map; + if (!cJSON_IsObject(served_smf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_smf_info]"); + goto end; + } + served_smf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_smf_info_local_map, served_smf_info) { + cJSON *localMapObject = served_smf_info_local_map; + if (!cJSON_IsObject(served_smf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_smf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_smf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_smf_infoList, localMapKeyPair); + } + } + + cJSON *served_upf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUpfInfo"); + + OpenAPI_list_t *served_upf_infoList; + if (served_upf_info) { + cJSON *served_upf_info_local_map; + if (!cJSON_IsObject(served_upf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_upf_info]"); + goto end; + } + served_upf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_upf_info_local_map, served_upf_info) { + cJSON *localMapObject = served_upf_info_local_map; + if (!cJSON_IsObject(served_upf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_upf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_upf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_upf_infoList, localMapKeyPair); + } + } + + cJSON *served_pcf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedPcfInfo"); + + OpenAPI_list_t *served_pcf_infoList; + if (served_pcf_info) { + cJSON *served_pcf_info_local_map; + if (!cJSON_IsObject(served_pcf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_pcf_info]"); + goto end; + } + served_pcf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_pcf_info_local_map, served_pcf_info) { + cJSON *localMapObject = served_pcf_info_local_map; + if (!cJSON_IsObject(served_pcf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_pcf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_pcf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_pcf_infoList, localMapKeyPair); + } + } + + cJSON *served_bsf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedBsfInfo"); + + OpenAPI_list_t *served_bsf_infoList; + if (served_bsf_info) { + cJSON *served_bsf_info_local_map; + if (!cJSON_IsObject(served_bsf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_bsf_info]"); + goto end; + } + served_bsf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_bsf_info_local_map, served_bsf_info) { + cJSON *localMapObject = served_bsf_info_local_map; + if (!cJSON_IsObject(served_bsf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_bsf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_bsf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_bsf_infoList, localMapKeyPair); + } + } + + cJSON *served_chf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedChfInfo"); + + OpenAPI_list_t *served_chf_infoList; + if (served_chf_info) { + cJSON *served_chf_info_local_map; + if (!cJSON_IsObject(served_chf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_chf_info]"); + goto end; + } + served_chf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_chf_info_local_map, served_chf_info) { + cJSON *localMapObject = served_chf_info_local_map; + if (!cJSON_IsObject(served_chf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_chf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_chf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_chf_infoList, localMapKeyPair); + } + } + + cJSON *served_nwdaf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedNwdafInfo"); + + OpenAPI_list_t *served_nwdaf_infoList; + if (served_nwdaf_info) { + cJSON *served_nwdaf_info_local_map; + if (!cJSON_IsObject(served_nwdaf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_nwdaf_info]"); + goto end; + } + served_nwdaf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_nwdaf_info_local_map, served_nwdaf_info) { + cJSON *localMapObject = served_nwdaf_info_local_map; + if (!cJSON_IsObject(served_nwdaf_info_local_map)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_nwdaf_info]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create( + localMapObject->string, OpenAPI_nwdaf_info_parseFromJSON(localMapObject)); + OpenAPI_list_add(served_nwdaf_infoList, localMapKeyPair); + } + } + + nrf_info_local_var = OpenAPI_nrf_info_create ( + served_udr_info ? served_udr_infoList : NULL, + served_udm_info ? served_udm_infoList : NULL, + served_ausf_info ? served_ausf_infoList : NULL, + served_amf_info ? served_amf_infoList : NULL, + served_smf_info ? served_smf_infoList : NULL, + served_upf_info ? served_upf_infoList : NULL, + served_pcf_info ? served_pcf_infoList : NULL, + served_bsf_info ? served_bsf_infoList : NULL, + served_chf_info ? served_chf_infoList : NULL, + served_nwdaf_info ? served_nwdaf_infoList : NULL + ); + + return nrf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nrf_info.h b/lib/sbi/openapi/model/nrf_info.h new file mode 100644 index 000000000..1863ce310 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info.h @@ -0,0 +1,65 @@ +/* + * nrf_info.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_H_ +#define _OpenAPI_nrf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_info.h" +#include "ausf_info.h" +#include "bsf_info.h" +#include "chf_info.h" +#include "nwdaf_info.h" +#include "pcf_info.h" +#include "smf_info.h" +#include "udm_info.h" +#include "udr_info.h" +#include "upf_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +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_udm_info; + OpenAPI_list_t* served_ausf_info; + OpenAPI_list_t* served_amf_info; + OpenAPI_list_t* served_smf_info; + OpenAPI_list_t* served_upf_info; + OpenAPI_list_t* served_pcf_info; + OpenAPI_list_t* served_bsf_info; + OpenAPI_list_t* served_chf_info; + OpenAPI_list_t* served_nwdaf_info; +} OpenAPI_nrf_info_t; + +OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( + OpenAPI_list_t* served_udr_info, + OpenAPI_list_t* served_udm_info, + OpenAPI_list_t* served_ausf_info, + OpenAPI_list_t* served_amf_info, + OpenAPI_list_t* served_smf_info, + OpenAPI_list_t* served_upf_info, + OpenAPI_list_t* served_pcf_info, + OpenAPI_list_t* served_bsf_info, + OpenAPI_list_t* served_chf_info, + OpenAPI_list_t* served_nwdaf_info + ); +void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info); +OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON); +cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_event.c b/lib/sbi/openapi/model/nwdaf_event.c new file mode 100644 index 000000000..c4413ee03 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_event.c @@ -0,0 +1,51 @@ + +#include +#include +#include +#include "nwdaf_event.h" + +OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_create( + ) +{ + OpenAPI_nwdaf_event_t *nwdaf_event_local_var = OpenAPI_malloc(sizeof(OpenAPI_nwdaf_event_t)); + if (!nwdaf_event_local_var) { + return NULL; + } + + return nwdaf_event_local_var; +} + +void OpenAPI_nwdaf_event_free(OpenAPI_nwdaf_event_t *nwdaf_event) +{ + if (NULL == nwdaf_event) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(nwdaf_event); +} + +cJSON *OpenAPI_nwdaf_event_convertToJSON(OpenAPI_nwdaf_event_t *nwdaf_event) +{ + cJSON *item = NULL; + + if (nwdaf_event == NULL) { + ogs_error("OpenAPI_nwdaf_event_convertToJSON() failed [NwdafEvent]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_parseFromJSON(cJSON *nwdaf_eventJSON) +{ + OpenAPI_nwdaf_event_t *nwdaf_event_local_var = NULL; + nwdaf_event_local_var = OpenAPI_nwdaf_event_create ( + ); + + return nwdaf_event_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nwdaf_event.h b/lib/sbi/openapi/model/nwdaf_event.h new file mode 100644 index 000000000..be9d694dd --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_event.h @@ -0,0 +1,35 @@ +/* + * nwdaf_event.h + * + * Possible values are - SLICE_LOAD_LEVEL: Indicates that the event subscribed is load level information of Network Slice instance - NETWORK_PERFORMANCE: Indicates that the event subscribed is network performance information. - NF_LOAD: Indicates that the event subscribed is load level and status of one or several Network Functions. - SERVICE_EXPERIENCE: Indicates that the event subscribed is service experience. - UE_MOBILITY: Indicates that the event subscribed is UE mobility information. - UE_COMMUNICATION: Indicates that the event subscribed is UE communication information. - QOS_SUSTAINABILITY: Indicates that the event subscribed is QoS sustainability. - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour. - USER_DATA_CONGESTION: Indicates that the event subscribed is user data congestion information. + */ + +#ifndef _OpenAPI_nwdaf_event_H_ +#define _OpenAPI_nwdaf_event_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_event_s OpenAPI_nwdaf_event_t; +typedef struct OpenAPI_nwdaf_event_s { +} OpenAPI_nwdaf_event_t; + +OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_create( + ); +void OpenAPI_nwdaf_event_free(OpenAPI_nwdaf_event_t *nwdaf_event); +OpenAPI_nwdaf_event_t *OpenAPI_nwdaf_event_parseFromJSON(cJSON *nwdaf_eventJSON); +cJSON *OpenAPI_nwdaf_event_convertToJSON(OpenAPI_nwdaf_event_t *nwdaf_event); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_event_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_info.c b/lib/sbi/openapi/model/nwdaf_info.c new file mode 100644 index 000000000..ae416f21c --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_info.c @@ -0,0 +1,251 @@ + +#include +#include +#include +#include "nwdaf_info.h" + +OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_create( + OpenAPI_list_t *event_ids, + OpenAPI_list_t *nwdaf_events, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list + ) +{ + OpenAPI_nwdaf_info_t *nwdaf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_nwdaf_info_t)); + if (!nwdaf_info_local_var) { + return NULL; + } + nwdaf_info_local_var->event_ids = event_ids; + nwdaf_info_local_var->nwdaf_events = nwdaf_events; + nwdaf_info_local_var->tai_list = tai_list; + nwdaf_info_local_var->tai_range_list = tai_range_list; + + return nwdaf_info_local_var; +} + +void OpenAPI_nwdaf_info_free(OpenAPI_nwdaf_info_t *nwdaf_info) +{ + if (NULL == nwdaf_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(nwdaf_info->event_ids, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(nwdaf_info->event_ids); + OpenAPI_list_for_each(nwdaf_info->nwdaf_events, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(nwdaf_info->nwdaf_events); + OpenAPI_list_for_each(nwdaf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nwdaf_info->tai_list); + OpenAPI_list_for_each(nwdaf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nwdaf_info->tai_range_list); + ogs_free(nwdaf_info); +} + +cJSON *OpenAPI_nwdaf_info_convertToJSON(OpenAPI_nwdaf_info_t *nwdaf_info) +{ + cJSON *item = NULL; + + if (nwdaf_info == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [NwdafInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nwdaf_info->event_ids) { + cJSON *event_idsList = cJSON_AddArrayToObject(item, "eventIds"); + if (event_idsList == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [event_ids]"); + goto end; + } + + OpenAPI_lnode_t *event_ids_node; + if (nwdaf_info->event_ids) { + OpenAPI_list_for_each(nwdaf_info->event_ids, event_ids_node) { + cJSON *itemLocal = OpenAPI_event_id_convertToJSON(event_ids_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [event_ids]"); + goto end; + } + cJSON_AddItemToArray(event_idsList, itemLocal); + } + } + } + + if (nwdaf_info->nwdaf_events) { + cJSON *nwdaf_eventsList = cJSON_AddArrayToObject(item, "nwdafEvents"); + if (nwdaf_eventsList == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [nwdaf_events]"); + goto end; + } + + OpenAPI_lnode_t *nwdaf_events_node; + if (nwdaf_info->nwdaf_events) { + OpenAPI_list_for_each(nwdaf_info->nwdaf_events, nwdaf_events_node) { + cJSON *itemLocal = OpenAPI_nwdaf_event_convertToJSON(nwdaf_events_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [nwdaf_events]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_eventsList, itemLocal); + } + } + } + + if (nwdaf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [tai_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_list_node; + if (nwdaf_info->tai_list) { + OpenAPI_list_for_each(nwdaf_info->tai_list, tai_list_node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(tai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + } + + if (nwdaf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_range_list_node; + if (nwdaf_info->tai_range_list) { + OpenAPI_list_for_each(nwdaf_info->tai_range_list, tai_range_list_node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(tai_range_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_parseFromJSON(cJSON *nwdaf_infoJSON) +{ + OpenAPI_nwdaf_info_t *nwdaf_info_local_var = NULL; + cJSON *event_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "eventIds"); + + OpenAPI_list_t *event_idsList; + if (event_ids) { + cJSON *event_ids_local_nonprimitive; + if (!cJSON_IsArray(event_ids)) { + ogs_error("OpenAPI_nwdaf_info_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_nwdaf_info_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); + } + } + + cJSON *nwdaf_events = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "nwdafEvents"); + + OpenAPI_list_t *nwdaf_eventsList; + if (nwdaf_events) { + cJSON *nwdaf_events_local_nonprimitive; + if (!cJSON_IsArray(nwdaf_events)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [nwdaf_events]"); + goto end; + } + + nwdaf_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_events_local_nonprimitive, nwdaf_events ) { + if (!cJSON_IsObject(nwdaf_events_local_nonprimitive)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [nwdaf_events]"); + goto end; + } + OpenAPI_nwdaf_event_t *nwdaf_eventsItem = OpenAPI_nwdaf_event_parseFromJSON(nwdaf_events_local_nonprimitive); + + OpenAPI_list_add(nwdaf_eventsList, nwdaf_eventsItem); + } + } + + cJSON *tai_list = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "taiList"); + + OpenAPI_list_t *tai_listList; + if (tai_list) { + cJSON *tai_list_local_nonprimitive; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local_nonprimitive, tai_list ) { + if (!cJSON_IsObject(tai_list_local_nonprimitive)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local_nonprimitive); + + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + cJSON *tai_range_list = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "taiRangeList"); + + OpenAPI_list_t *tai_range_listList; + if (tai_range_list) { + cJSON *tai_range_list_local_nonprimitive; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local_nonprimitive, tai_range_list ) { + if (!cJSON_IsObject(tai_range_list_local_nonprimitive)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local_nonprimitive); + + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + nwdaf_info_local_var = OpenAPI_nwdaf_info_create ( + event_ids ? event_idsList : NULL, + nwdaf_events ? nwdaf_eventsList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL + ); + + return nwdaf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/nwdaf_info.h b/lib/sbi/openapi/model/nwdaf_info.h new file mode 100644 index 000000000..fa5a3b6dc --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_info.h @@ -0,0 +1,47 @@ +/* + * nwdaf_info.h + * + * + */ + +#ifndef _OpenAPI_nwdaf_info_H_ +#define _OpenAPI_nwdaf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "event_id.h" +#include "nwdaf_event.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_info_s OpenAPI_nwdaf_info_t; +typedef struct OpenAPI_nwdaf_info_s { + OpenAPI_list_t *event_ids; + OpenAPI_list_t *nwdaf_events; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; +} OpenAPI_nwdaf_info_t; + +OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_create( + OpenAPI_list_t *event_ids, + OpenAPI_list_t *nwdaf_events, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list + ); +void OpenAPI_nwdaf_info_free(OpenAPI_nwdaf_info_t *nwdaf_info); +OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_parseFromJSON(cJSON *nwdaf_infoJSON); +cJSON *OpenAPI_nwdaf_info_convertToJSON(OpenAPI_nwdaf_info_t *nwdaf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_info_H_ */ + diff --git a/lib/sbi/openapi/model/object.c b/lib/sbi/openapi/model/object.c new file mode 100644 index 000000000..cf94a1a8e --- /dev/null +++ b/lib/sbi/openapi/model/object.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include "object.h" + +OpenAPI_object_t *OpenAPI_object_create(void) +{ + OpenAPI_object_t *object = ogs_malloc(sizeof(OpenAPI_object_t)); + + return object; +} + +void OpenAPI_object_free(OpenAPI_object_t *object) +{ + ogs_free (object); +} + +cJSON *OpenAPI_object_convertToJSON(OpenAPI_object_t *object) +{ + cJSON *item = cJSON_CreateObject(); + + return item; +fail: + cJSON_Delete(item); + return NULL; +} + +OpenAPI_object_t *OpenAPI_object_parseFromJSON(cJSON *objectJSON) +{ + OpenAPI_object_t *object = NULL; + + return object; +end: + return NULL; +} diff --git a/lib/sbi/openapi/model/object.h b/lib/sbi/openapi/model/object.h new file mode 100644 index 000000000..bc874ce50 --- /dev/null +++ b/lib/sbi/openapi/model/object.h @@ -0,0 +1,30 @@ +#ifndef OGS_SBI_OBJECT_H +#define OGS_SBI_OBJECT_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_object_s { + void *temporary; +} OpenAPI_object_t; + +OpenAPI_object_t *OpenAPI_object_create(void); + +void OpenAPI_object_free(OpenAPI_object_t *object); + +OpenAPI_object_t *OpenAPI_object_parseFromJSON(cJSON *objectJSON); + +cJSON *OpenAPI_object_convertToJSON(OpenAPI_object_t *object); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_OBJECT_H */ diff --git a/lib/sbi/openapi/model/patch_item.c b/lib/sbi/openapi/model/patch_item.c new file mode 100644 index 000000000..56a6104fb --- /dev/null +++ b/lib/sbi/openapi/model/patch_item.c @@ -0,0 +1,142 @@ + +#include +#include +#include +#include "patch_item.h" + +OpenAPI_patch_item_t *OpenAPI_patch_item_create( + OpenAPI_patch_operation_e op, + char *path, + char *from, + char *value + ) +{ + OpenAPI_patch_item_t *patch_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_patch_item_t)); + if (!patch_item_local_var) { + return NULL; + } + patch_item_local_var->op = op; + patch_item_local_var->path = path; + patch_item_local_var->from = from; + patch_item_local_var->value = value; + + return patch_item_local_var; +} + +void OpenAPI_patch_item_free(OpenAPI_patch_item_t *patch_item) +{ + if (NULL == patch_item) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(patch_item->path); + ogs_free(patch_item->from); + ogs_free(patch_item->value); + ogs_free(patch_item); +} + +cJSON *OpenAPI_patch_item_convertToJSON(OpenAPI_patch_item_t *patch_item) +{ + cJSON *item = NULL; + + if (patch_item == NULL) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed [PatchItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!patch_item->op) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed [op]"); + goto end; + } + if (cJSON_AddStringToObject(item, "op", OpenAPI_patch_operation_ToString(patch_item->op)) == NULL) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed [op]"); + goto end; + } + + if (!patch_item->path) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed [path]"); + goto end; + } + if (cJSON_AddStringToObject(item, "path", patch_item->path) == NULL) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed [path]"); + goto end; + } + + if (patch_item->from) { + if (cJSON_AddStringToObject(item, "from", patch_item->from) == NULL) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed [from]"); + goto end; + } + } + + if (patch_item->value) { + if (cJSON_AddStringToObject(item, "value", patch_item->value) == NULL) { + ogs_error("OpenAPI_patch_item_convertToJSON() failed [value]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_patch_item_t *OpenAPI_patch_item_parseFromJSON(cJSON *patch_itemJSON) +{ + OpenAPI_patch_item_t *patch_item_local_var = NULL; + cJSON *op = cJSON_GetObjectItemCaseSensitive(patch_itemJSON, "op"); + if (!op) { + ogs_error("OpenAPI_patch_item_parseFromJSON() failed [op]"); + goto end; + } + + OpenAPI_patch_operation_e opVariable; + + if (!cJSON_IsString(op)) { + ogs_error("OpenAPI_patch_item_parseFromJSON() failed [op]"); + goto end; + } + opVariable = OpenAPI_patch_operation_FromString(op->valuestring); + + cJSON *path = cJSON_GetObjectItemCaseSensitive(patch_itemJSON, "path"); + if (!path) { + ogs_error("OpenAPI_patch_item_parseFromJSON() failed [path]"); + goto end; + } + + + if (!cJSON_IsString(path)) { + ogs_error("OpenAPI_patch_item_parseFromJSON() failed [path]"); + goto end; + } + + cJSON *from = cJSON_GetObjectItemCaseSensitive(patch_itemJSON, "from"); + + if (from) { + if (!cJSON_IsString(from)) { + ogs_error("OpenAPI_patch_item_parseFromJSON() failed [from]"); + goto end; + } + } + + cJSON *value = cJSON_GetObjectItemCaseSensitive(patch_itemJSON, "value"); + + if (value) { + if (!cJSON_IsString(value)) { + ogs_error("OpenAPI_patch_item_parseFromJSON() failed [value]"); + goto end; + } + } + + patch_item_local_var = OpenAPI_patch_item_create ( + opVariable, + ogs_strdup(path->valuestring), + from ? ogs_strdup(from->valuestring) : NULL, + value ? ogs_strdup(value->valuestring) : NULL + ); + + return patch_item_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/patch_item.h b/lib/sbi/openapi/model/patch_item.h new file mode 100644 index 000000000..53045038e --- /dev/null +++ b/lib/sbi/openapi/model/patch_item.h @@ -0,0 +1,44 @@ +/* + * patch_item.h + * + * + */ + +#ifndef _OpenAPI_patch_item_H_ +#define _OpenAPI_patch_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "patch_operation.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_patch_item_s OpenAPI_patch_item_t; +typedef struct OpenAPI_patch_item_s { + OpenAPI_patch_operation_e op; + char *path; + char *from; + char *value; +} OpenAPI_patch_item_t; + +OpenAPI_patch_item_t *OpenAPI_patch_item_create( + OpenAPI_patch_operation_e op, + char *path, + char *from, + char *value + ); +void OpenAPI_patch_item_free(OpenAPI_patch_item_t *patch_item); +OpenAPI_patch_item_t *OpenAPI_patch_item_parseFromJSON(cJSON *patch_itemJSON); +cJSON *OpenAPI_patch_item_convertToJSON(OpenAPI_patch_item_t *patch_item); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_patch_item_H_ */ + diff --git a/lib/sbi/openapi/model/patch_operation.c b/lib/sbi/openapi/model/patch_operation.c new file mode 100644 index 000000000..2e725acb8 --- /dev/null +++ b/lib/sbi/openapi/model/patch_operation.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "patch_operation.h" + +char* OpenAPI_patch_operation_ToString(OpenAPI_patch_operation_e patch_operation) +{ + const char *patch_operationArray[] = { "NULL", "add", "copy", "move", "_remove", "replace", "test" }; + size_t sizeofArray = sizeof(patch_operationArray) / sizeof(patch_operationArray[0]); + if (patch_operation < sizeofArray) + return (char *)patch_operationArray[patch_operation]; + else + return (char *)"Unknown"; +} + +OpenAPI_patch_operation_e OpenAPI_patch_operation_FromString(char* patch_operation) +{ + int stringToReturn = 0; + const char *patch_operationArray[] = { "NULL", "add", "copy", "move", "_remove", "replace", "test" }; + size_t sizeofArray = sizeof(patch_operationArray) / sizeof(patch_operationArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(patch_operation, patch_operationArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/patch_operation.h b/lib/sbi/openapi/model/patch_operation.h new file mode 100644 index 000000000..5aaaec560 --- /dev/null +++ b/lib/sbi/openapi/model/patch_operation.h @@ -0,0 +1,31 @@ +/* + * patch_operation.h + * + * + */ + +#ifndef _OpenAPI_patch_operation_H_ +#define _OpenAPI_patch_operation_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_patch_operation_NULL = 0, OpenAPI_patch_operation_add, OpenAPI_patch_operation_copy, OpenAPI_patch_operation_move, OpenAPI_patch_operation__remove, OpenAPI_patch_operation_replace, OpenAPI_patch_operation_test } OpenAPI_patch_operation_e; + +char* OpenAPI_patch_operation_ToString(OpenAPI_patch_operation_e patch_operation); + +OpenAPI_patch_operation_e OpenAPI_patch_operation_FromString(char* patch_operation); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_patch_operation_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_info.c b/lib/sbi/openapi/model/pcf_info.c new file mode 100644 index 000000000..3a246d77d --- /dev/null +++ b/lib/sbi/openapi/model/pcf_info.c @@ -0,0 +1,254 @@ + +#include +#include +#include +#include "pcf_info.h" + +OpenAPI_pcf_info_t *OpenAPI_pcf_info_create( + char *group_id, + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + char *rx_diam_host, + char *rx_diam_realm + ) +{ + OpenAPI_pcf_info_t *pcf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_pcf_info_t)); + if (!pcf_info_local_var) { + return NULL; + } + pcf_info_local_var->group_id = group_id; + pcf_info_local_var->dnn_list = dnn_list; + pcf_info_local_var->supi_ranges = supi_ranges; + pcf_info_local_var->gpsi_ranges = gpsi_ranges; + pcf_info_local_var->rx_diam_host = rx_diam_host; + pcf_info_local_var->rx_diam_realm = rx_diam_realm; + + return pcf_info_local_var; +} + +void OpenAPI_pcf_info_free(OpenAPI_pcf_info_t *pcf_info) +{ + if (NULL == pcf_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(pcf_info->group_id); + OpenAPI_list_for_each(pcf_info->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcf_info->dnn_list); + OpenAPI_list_for_each(pcf_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(pcf_info->supi_ranges); + OpenAPI_list_for_each(pcf_info->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(pcf_info->gpsi_ranges); + ogs_free(pcf_info->rx_diam_host); + ogs_free(pcf_info->rx_diam_realm); + ogs_free(pcf_info); +} + +cJSON *OpenAPI_pcf_info_convertToJSON(OpenAPI_pcf_info_t *pcf_info) +{ + cJSON *item = NULL; + + if (pcf_info == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [PcfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pcf_info->group_id) { + if (cJSON_AddStringToObject(item, "groupId", pcf_info->group_id) == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (pcf_info->dnn_list) { + cJSON *dnn_list = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_list == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [dnn_list]"); + goto end; + } + + OpenAPI_lnode_t *dnn_list_node; + OpenAPI_list_for_each(pcf_info->dnn_list, dnn_list_node) { + if (cJSON_AddStringToObject(dnn_list, "", (char*)dnn_list_node->data) == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (pcf_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *supi_ranges_node; + if (pcf_info->supi_ranges) { + OpenAPI_list_for_each(pcf_info->supi_ranges, supi_ranges_node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(supi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + } + + if (pcf_info->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *gpsi_ranges_node; + if (pcf_info->gpsi_ranges) { + OpenAPI_list_for_each(pcf_info->gpsi_ranges, gpsi_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(gpsi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + } + + if (pcf_info->rx_diam_host) { + if (cJSON_AddStringToObject(item, "rxDiamHost", pcf_info->rx_diam_host) == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [rx_diam_host]"); + goto end; + } + } + + if (pcf_info->rx_diam_realm) { + if (cJSON_AddStringToObject(item, "rxDiamRealm", pcf_info->rx_diam_realm) == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [rx_diam_realm]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_info_t *OpenAPI_pcf_info_parseFromJSON(cJSON *pcf_infoJSON) +{ + OpenAPI_pcf_info_t *pcf_info_local_var = NULL; + cJSON *group_id = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "groupId"); + + if (group_id) { + if (!cJSON_IsString(group_id)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [group_id]"); + goto end; + } + } + + cJSON *dnn_list = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "dnnList"); + + OpenAPI_list_t *dnn_listList; + if (dnn_list) { + cJSON *dnn_list_local; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [dnn_list]"); + goto end; + } + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + cJSON *supi_ranges = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "supiRanges"); + + OpenAPI_list_t *supi_rangesList; + if (supi_ranges) { + cJSON *supi_ranges_local_nonprimitive; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local_nonprimitive, supi_ranges ) { + if (!cJSON_IsObject(supi_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local_nonprimitive); + + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + cJSON *gpsi_ranges = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "gpsiRanges"); + + OpenAPI_list_t *gpsi_rangesList; + if (gpsi_ranges) { + cJSON *gpsi_ranges_local_nonprimitive; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_pcf_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_pcf_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 *rx_diam_host = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "rxDiamHost"); + + if (rx_diam_host) { + if (!cJSON_IsString(rx_diam_host)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [rx_diam_host]"); + goto end; + } + } + + cJSON *rx_diam_realm = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "rxDiamRealm"); + + if (rx_diam_realm) { + if (!cJSON_IsString(rx_diam_realm)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [rx_diam_realm]"); + goto end; + } + } + + pcf_info_local_var = OpenAPI_pcf_info_create ( + group_id ? ogs_strdup(group_id->valuestring) : NULL, + dnn_list ? dnn_listList : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + rx_diam_host ? ogs_strdup(rx_diam_host->valuestring) : NULL, + rx_diam_realm ? ogs_strdup(rx_diam_realm->valuestring) : NULL + ); + + return pcf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/pcf_info.h b/lib/sbi/openapi/model/pcf_info.h new file mode 100644 index 000000000..369fc06e3 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_info.h @@ -0,0 +1,49 @@ +/* + * pcf_info.h + * + * + */ + +#ifndef _OpenAPI_pcf_info_H_ +#define _OpenAPI_pcf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_info_s OpenAPI_pcf_info_t; +typedef struct OpenAPI_pcf_info_s { + char *group_id; + OpenAPI_list_t *dnn_list; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + char *rx_diam_host; + char *rx_diam_realm; +} OpenAPI_pcf_info_t; + +OpenAPI_pcf_info_t *OpenAPI_pcf_info_create( + char *group_id, + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + char *rx_diam_host, + char *rx_diam_realm + ); +void OpenAPI_pcf_info_free(OpenAPI_pcf_info_t *pcf_info); +OpenAPI_pcf_info_t *OpenAPI_pcf_info_parseFromJSON(cJSON *pcf_infoJSON); +cJSON *OpenAPI_pcf_info_convertToJSON(OpenAPI_pcf_info_t *pcf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_info_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_type.c b/lib/sbi/openapi/model/pdu_session_type.c new file mode 100644 index 000000000..e8bf1ff1f --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_type.c @@ -0,0 +1,51 @@ + +#include +#include +#include +#include "pdu_session_type.h" + +OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_create( + ) +{ + OpenAPI_pdu_session_type_t *pdu_session_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_type_t)); + if (!pdu_session_type_local_var) { + return NULL; + } + + return pdu_session_type_local_var; +} + +void OpenAPI_pdu_session_type_free(OpenAPI_pdu_session_type_t *pdu_session_type) +{ + if (NULL == pdu_session_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(pdu_session_type); +} + +cJSON *OpenAPI_pdu_session_type_convertToJSON(OpenAPI_pdu_session_type_t *pdu_session_type) +{ + cJSON *item = NULL; + + if (pdu_session_type == NULL) { + ogs_error("OpenAPI_pdu_session_type_convertToJSON() failed [PduSessionType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_parseFromJSON(cJSON *pdu_session_typeJSON) +{ + OpenAPI_pdu_session_type_t *pdu_session_type_local_var = NULL; + pdu_session_type_local_var = OpenAPI_pdu_session_type_create ( + ); + + return pdu_session_type_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/pdu_session_type.h b/lib/sbi/openapi/model/pdu_session_type.h new file mode 100644 index 000000000..632e245d1 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_type.h @@ -0,0 +1,35 @@ +/* + * pdu_session_type.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_type_H_ +#define _OpenAPI_pdu_session_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 struct OpenAPI_pdu_session_type_s OpenAPI_pdu_session_type_t; +typedef struct OpenAPI_pdu_session_type_s { +} OpenAPI_pdu_session_type_t; + +OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_create( + ); +void OpenAPI_pdu_session_type_free(OpenAPI_pdu_session_type_t *pdu_session_type); +OpenAPI_pdu_session_type_t *OpenAPI_pdu_session_type_parseFromJSON(cJSON *pdu_session_typeJSON); +cJSON *OpenAPI_pdu_session_type_convertToJSON(OpenAPI_pdu_session_type_t *pdu_session_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_type_H_ */ + diff --git a/lib/sbi/openapi/model/plmn_id.c b/lib/sbi/openapi/model/plmn_id.c new file mode 100644 index 000000000..1cf6e8832 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_id.c @@ -0,0 +1,101 @@ + +#include +#include +#include +#include "plmn_id.h" + +OpenAPI_plmn_id_t *OpenAPI_plmn_id_create( + char *mcc, + char *mnc + ) +{ + OpenAPI_plmn_id_t *plmn_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_plmn_id_t)); + if (!plmn_id_local_var) { + return NULL; + } + plmn_id_local_var->mcc = mcc; + plmn_id_local_var->mnc = mnc; + + return plmn_id_local_var; +} + +void OpenAPI_plmn_id_free(OpenAPI_plmn_id_t *plmn_id) +{ + if (NULL == plmn_id) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(plmn_id->mcc); + ogs_free(plmn_id->mnc); + ogs_free(plmn_id); +} + +cJSON *OpenAPI_plmn_id_convertToJSON(OpenAPI_plmn_id_t *plmn_id) +{ + cJSON *item = NULL; + + if (plmn_id == NULL) { + ogs_error("OpenAPI_plmn_id_convertToJSON() failed [PlmnId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!plmn_id->mcc) { + ogs_error("OpenAPI_plmn_id_convertToJSON() failed [mcc]"); + goto end; + } + if (cJSON_AddStringToObject(item, "mcc", plmn_id->mcc) == NULL) { + ogs_error("OpenAPI_plmn_id_convertToJSON() failed [mcc]"); + goto end; + } + + if (!plmn_id->mnc) { + ogs_error("OpenAPI_plmn_id_convertToJSON() failed [mnc]"); + goto end; + } + if (cJSON_AddStringToObject(item, "mnc", plmn_id->mnc) == NULL) { + ogs_error("OpenAPI_plmn_id_convertToJSON() failed [mnc]"); + goto end; + } + +end: + return item; +} + +OpenAPI_plmn_id_t *OpenAPI_plmn_id_parseFromJSON(cJSON *plmn_idJSON) +{ + OpenAPI_plmn_id_t *plmn_id_local_var = NULL; + cJSON *mcc = cJSON_GetObjectItemCaseSensitive(plmn_idJSON, "mcc"); + if (!mcc) { + ogs_error("OpenAPI_plmn_id_parseFromJSON() failed [mcc]"); + goto end; + } + + + if (!cJSON_IsString(mcc)) { + ogs_error("OpenAPI_plmn_id_parseFromJSON() failed [mcc]"); + goto end; + } + + cJSON *mnc = cJSON_GetObjectItemCaseSensitive(plmn_idJSON, "mnc"); + if (!mnc) { + ogs_error("OpenAPI_plmn_id_parseFromJSON() failed [mnc]"); + goto end; + } + + + if (!cJSON_IsString(mnc)) { + ogs_error("OpenAPI_plmn_id_parseFromJSON() failed [mnc]"); + goto end; + } + + plmn_id_local_var = OpenAPI_plmn_id_create ( + ogs_strdup(mcc->valuestring), + ogs_strdup(mnc->valuestring) + ); + + return plmn_id_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/plmn_id.h b/lib/sbi/openapi/model/plmn_id.h new file mode 100644 index 000000000..2f308d91e --- /dev/null +++ b/lib/sbi/openapi/model/plmn_id.h @@ -0,0 +1,39 @@ +/* + * plmn_id.h + * + * + */ + +#ifndef _OpenAPI_plmn_id_H_ +#define _OpenAPI_plmn_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_plmn_id_s OpenAPI_plmn_id_t; +typedef struct OpenAPI_plmn_id_s { + char *mcc; + char *mnc; +} OpenAPI_plmn_id_t; + +OpenAPI_plmn_id_t *OpenAPI_plmn_id_create( + char *mcc, + char *mnc + ); +void OpenAPI_plmn_id_free(OpenAPI_plmn_id_t *plmn_id); +OpenAPI_plmn_id_t *OpenAPI_plmn_id_parseFromJSON(cJSON *plmn_idJSON); +cJSON *OpenAPI_plmn_id_convertToJSON(OpenAPI_plmn_id_t *plmn_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_plmn_id_H_ */ + diff --git a/lib/sbi/openapi/model/plmn_range.c b/lib/sbi/openapi/model/plmn_range.c new file mode 100644 index 000000000..199ed1e19 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_range.c @@ -0,0 +1,111 @@ + +#include +#include +#include +#include "plmn_range.h" + +OpenAPI_plmn_range_t *OpenAPI_plmn_range_create( + char *start, + char *end, + char *pattern + ) +{ + OpenAPI_plmn_range_t *plmn_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_plmn_range_t)); + if (!plmn_range_local_var) { + return NULL; + } + plmn_range_local_var->start = start; + plmn_range_local_var->end = end; + plmn_range_local_var->pattern = pattern; + + return plmn_range_local_var; +} + +void OpenAPI_plmn_range_free(OpenAPI_plmn_range_t *plmn_range) +{ + if (NULL == plmn_range) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(plmn_range->start); + ogs_free(plmn_range->end); + ogs_free(plmn_range->pattern); + ogs_free(plmn_range); +} + +cJSON *OpenAPI_plmn_range_convertToJSON(OpenAPI_plmn_range_t *plmn_range) +{ + cJSON *item = NULL; + + if (plmn_range == NULL) { + ogs_error("OpenAPI_plmn_range_convertToJSON() failed [PlmnRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (plmn_range->start) { + if (cJSON_AddStringToObject(item, "start", plmn_range->start) == NULL) { + ogs_error("OpenAPI_plmn_range_convertToJSON() failed [start]"); + goto end; + } + } + + if (plmn_range->end) { + if (cJSON_AddStringToObject(item, "end", plmn_range->end) == NULL) { + ogs_error("OpenAPI_plmn_range_convertToJSON() failed [end]"); + goto end; + } + } + + if (plmn_range->pattern) { + if (cJSON_AddStringToObject(item, "pattern", plmn_range->pattern) == NULL) { + ogs_error("OpenAPI_plmn_range_convertToJSON() failed [pattern]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_plmn_range_t *OpenAPI_plmn_range_parseFromJSON(cJSON *plmn_rangeJSON) +{ + OpenAPI_plmn_range_t *plmn_range_local_var = NULL; + cJSON *start = cJSON_GetObjectItemCaseSensitive(plmn_rangeJSON, "start"); + + if (start) { + if (!cJSON_IsString(start)) { + ogs_error("OpenAPI_plmn_range_parseFromJSON() failed [start]"); + goto end; + } + } + + cJSON *end = cJSON_GetObjectItemCaseSensitive(plmn_rangeJSON, "end"); + + if (end) { + if (!cJSON_IsString(end)) { + ogs_error("OpenAPI_plmn_range_parseFromJSON() failed [end]"); + goto end; + } + } + + cJSON *pattern = cJSON_GetObjectItemCaseSensitive(plmn_rangeJSON, "pattern"); + + if (pattern) { + if (!cJSON_IsString(pattern)) { + ogs_error("OpenAPI_plmn_range_parseFromJSON() failed [pattern]"); + goto end; + } + } + + plmn_range_local_var = OpenAPI_plmn_range_create ( + start ? ogs_strdup(start->valuestring) : NULL, + end ? ogs_strdup(end->valuestring) : NULL, + pattern ? ogs_strdup(pattern->valuestring) : NULL + ); + + return plmn_range_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/plmn_range.h b/lib/sbi/openapi/model/plmn_range.h new file mode 100644 index 000000000..77246f8c4 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_range.h @@ -0,0 +1,41 @@ +/* + * plmn_range.h + * + * + */ + +#ifndef _OpenAPI_plmn_range_H_ +#define _OpenAPI_plmn_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_plmn_range_s OpenAPI_plmn_range_t; +typedef struct OpenAPI_plmn_range_s { + char *start; + char *end; + char *pattern; +} OpenAPI_plmn_range_t; + +OpenAPI_plmn_range_t *OpenAPI_plmn_range_create( + char *start, + char *end, + char *pattern + ); +void OpenAPI_plmn_range_free(OpenAPI_plmn_range_t *plmn_range); +OpenAPI_plmn_range_t *OpenAPI_plmn_range_parseFromJSON(cJSON *plmn_rangeJSON); +cJSON *OpenAPI_plmn_range_convertToJSON(OpenAPI_plmn_range_t *plmn_range); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_plmn_range_H_ */ + diff --git a/lib/sbi/openapi/model/plmn_snssai.c b/lib/sbi/openapi/model/plmn_snssai.c new file mode 100644 index 000000000..bf9e36fd9 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_snssai.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "plmn_snssai.h" + +OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_create( + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_list_t *s_nssai_list + ) +{ + OpenAPI_plmn_snssai_t *plmn_snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_plmn_snssai_t)); + if (!plmn_snssai_local_var) { + return NULL; + } + plmn_snssai_local_var->plmn_id = plmn_id; + plmn_snssai_local_var->s_nssai_list = s_nssai_list; + + return plmn_snssai_local_var; +} + +void OpenAPI_plmn_snssai_free(OpenAPI_plmn_snssai_t *plmn_snssai) +{ + if (NULL == plmn_snssai) { + return; + } + 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_list_free(plmn_snssai->s_nssai_list); + ogs_free(plmn_snssai); +} + +cJSON *OpenAPI_plmn_snssai_convertToJSON(OpenAPI_plmn_snssai_t *plmn_snssai) +{ + cJSON *item = NULL; + + if (plmn_snssai == NULL) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [PlmnSnssai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!plmn_snssai->plmn_id) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(plmn_snssai->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!plmn_snssai->s_nssai_list) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [s_nssai_list]"); + goto end; + } + cJSON *s_nssai_listList = cJSON_AddArrayToObject(item, "sNssaiList"); + if (s_nssai_listList == NULL) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [s_nssai_list]"); + goto end; + } + + 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); + if (itemLocal == NULL) { + ogs_error("OpenAPI_plmn_snssai_convertToJSON() failed [s_nssai_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_parseFromJSON(cJSON *plmn_snssaiJSON) +{ + OpenAPI_plmn_snssai_t *plmn_snssai_local_var = NULL; + cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(plmn_snssaiJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_plmn_snssai_parseFromJSON() failed [plmn_id]"); + goto end; + } + + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + cJSON *s_nssai_list = cJSON_GetObjectItemCaseSensitive(plmn_snssaiJSON, "sNssaiList"); + if (!s_nssai_list) { + ogs_error("OpenAPI_plmn_snssai_parseFromJSON() failed [s_nssai_list]"); + goto end; + } + + OpenAPI_list_t *s_nssai_listList; + + cJSON *s_nssai_list_local_nonprimitive; + if (!cJSON_IsArray(s_nssai_list)) { + ogs_error("OpenAPI_plmn_snssai_parseFromJSON() failed [s_nssai_list]"); + goto end; + } + + s_nssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_list_local_nonprimitive, s_nssai_list ) { + if (!cJSON_IsObject(s_nssai_list_local_nonprimitive)) { + 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_list_add(s_nssai_listList, s_nssai_listItem); + } + + plmn_snssai_local_var = OpenAPI_plmn_snssai_create ( + plmn_id_local_nonprim, + s_nssai_listList + ); + + return plmn_snssai_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/plmn_snssai.h b/lib/sbi/openapi/model/plmn_snssai.h new file mode 100644 index 000000000..fc5a57a53 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_snssai.h @@ -0,0 +1,41 @@ +/* + * plmn_snssai.h + * + * + */ + +#ifndef _OpenAPI_plmn_snssai_H_ +#define _OpenAPI_plmn_snssai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_plmn_snssai_s OpenAPI_plmn_snssai_t; +typedef struct OpenAPI_plmn_snssai_s { + struct OpenAPI_plmn_id_s *plmn_id; + OpenAPI_list_t *s_nssai_list; +} OpenAPI_plmn_snssai_t; + +OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_create( + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_list_t *s_nssai_list + ); +void OpenAPI_plmn_snssai_free(OpenAPI_plmn_snssai_t *plmn_snssai); +OpenAPI_plmn_snssai_t *OpenAPI_plmn_snssai_parseFromJSON(cJSON *plmn_snssaiJSON); +cJSON *OpenAPI_plmn_snssai_convertToJSON(OpenAPI_plmn_snssai_t *plmn_snssai); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_plmn_snssai_H_ */ + diff --git a/lib/sbi/openapi/model/problem_details.c b/lib/sbi/openapi/model/problem_details.c new file mode 100644 index 000000000..efebad10e --- /dev/null +++ b/lib/sbi/openapi/model/problem_details.c @@ -0,0 +1,240 @@ + +#include +#include +#include +#include "problem_details.h" + +OpenAPI_problem_details_t *OpenAPI_problem_details_create( + char *type, + char *title, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features + ) +{ + OpenAPI_problem_details_t *problem_details_local_var = OpenAPI_malloc(sizeof(OpenAPI_problem_details_t)); + if (!problem_details_local_var) { + return NULL; + } + problem_details_local_var->type = type; + problem_details_local_var->title = title; + problem_details_local_var->status = status; + problem_details_local_var->detail = detail; + problem_details_local_var->instance = instance; + problem_details_local_var->cause = cause; + problem_details_local_var->invalid_params = invalid_params; + problem_details_local_var->supported_features = supported_features; + + return problem_details_local_var; +} + +void OpenAPI_problem_details_free(OpenAPI_problem_details_t *problem_details) +{ + if (NULL == problem_details) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(problem_details->type); + ogs_free(problem_details->title); + ogs_free(problem_details->detail); + ogs_free(problem_details->instance); + ogs_free(problem_details->cause); + OpenAPI_list_for_each(problem_details->invalid_params, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(problem_details->invalid_params); + ogs_free(problem_details->supported_features); + ogs_free(problem_details); +} + +cJSON *OpenAPI_problem_details_convertToJSON(OpenAPI_problem_details_t *problem_details) +{ + cJSON *item = NULL; + + if (problem_details == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [ProblemDetails]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (problem_details->type) { + if (cJSON_AddStringToObject(item, "type", problem_details->type) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [type]"); + goto end; + } + } + + if (problem_details->title) { + if (cJSON_AddStringToObject(item, "title", problem_details->title) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [title]"); + goto end; + } + } + + if (problem_details->status) { + if (cJSON_AddNumberToObject(item, "status", problem_details->status) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [status]"); + goto end; + } + } + + if (problem_details->detail) { + if (cJSON_AddStringToObject(item, "detail", problem_details->detail) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [detail]"); + goto end; + } + } + + if (problem_details->instance) { + if (cJSON_AddStringToObject(item, "instance", problem_details->instance) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [instance]"); + goto end; + } + } + + if (problem_details->cause) { + if (cJSON_AddStringToObject(item, "cause", problem_details->cause) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [cause]"); + goto end; + } + } + + if (problem_details->invalid_params) { + cJSON *invalid_paramsList = cJSON_AddArrayToObject(item, "invalidParams"); + if (invalid_paramsList == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [invalid_params]"); + goto end; + } + + OpenAPI_lnode_t *invalid_params_node; + if (problem_details->invalid_params) { + OpenAPI_list_for_each(problem_details->invalid_params, invalid_params_node) { + cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(invalid_params_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [invalid_params]"); + goto end; + } + cJSON_AddItemToArray(invalid_paramsList, itemLocal); + } + } + } + + if (problem_details->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", problem_details->supported_features) == NULL) { + ogs_error("OpenAPI_problem_details_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_problem_details_t *OpenAPI_problem_details_parseFromJSON(cJSON *problem_detailsJSON) +{ + OpenAPI_problem_details_t *problem_details_local_var = NULL; + cJSON *type = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "type"); + + if (type) { + if (!cJSON_IsString(type)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [type]"); + goto end; + } + } + + cJSON *title = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "title"); + + if (title) { + if (!cJSON_IsString(title)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [title]"); + goto end; + } + } + + cJSON *status = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "status"); + + if (status) { + if (!cJSON_IsNumber(status)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [status]"); + goto end; + } + } + + cJSON *detail = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "detail"); + + if (detail) { + if (!cJSON_IsString(detail)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [detail]"); + goto end; + } + } + + cJSON *instance = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "instance"); + + if (instance) { + if (!cJSON_IsString(instance)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [instance]"); + goto end; + } + } + + cJSON *cause = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "cause"); + + if (cause) { + if (!cJSON_IsString(cause)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [cause]"); + goto end; + } + } + + cJSON *invalid_params = cJSON_GetObjectItemCaseSensitive(problem_detailsJSON, "invalidParams"); + + OpenAPI_list_t *invalid_paramsList; + if (invalid_params) { + cJSON *invalid_params_local_nonprimitive; + if (!cJSON_IsArray(invalid_params)) { + ogs_error("OpenAPI_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_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(problem_detailsJSON, "supportedFeatures"); + + if (supported_features) { + if (!cJSON_IsString(supported_features)) { + ogs_error("OpenAPI_problem_details_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + problem_details_local_var = OpenAPI_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 + ); + + return problem_details_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/problem_details.h b/lib/sbi/openapi/model/problem_details.h new file mode 100644 index 000000000..9e17ea11c --- /dev/null +++ b/lib/sbi/openapi/model/problem_details.h @@ -0,0 +1,52 @@ +/* + * problem_details.h + * + * + */ + +#ifndef _OpenAPI_problem_details_H_ +#define _OpenAPI_problem_details_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "invalid_param.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_problem_details_s OpenAPI_problem_details_t; +typedef struct OpenAPI_problem_details_s { + char *type; + char *title; + int status; + char *detail; + char *instance; + char *cause; + OpenAPI_list_t *invalid_params; + char *supported_features; +} OpenAPI_problem_details_t; + +OpenAPI_problem_details_t *OpenAPI_problem_details_create( + char *type, + char *title, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features + ); +void OpenAPI_problem_details_free(OpenAPI_problem_details_t *problem_details); +OpenAPI_problem_details_t *OpenAPI_problem_details_parseFromJSON(cJSON *problem_detailsJSON); +cJSON *OpenAPI_problem_details_convertToJSON(OpenAPI_problem_details_t *problem_details); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_problem_details_H_ */ + diff --git a/lib/sbi/openapi/model/search_result.c b/lib/sbi/openapi/model/search_result.c new file mode 100644 index 000000000..69b5a3df4 --- /dev/null +++ b/lib/sbi/openapi/model/search_result.c @@ -0,0 +1,184 @@ + +#include +#include +#include +#include "search_result.h" + +OpenAPI_search_result_t *OpenAPI_search_result_create( + int validity_period, + OpenAPI_list_t *nf_instances, + char *search_id, + int num_nf_inst_complete, + char *nrf_supported_features + ) +{ + OpenAPI_search_result_t *search_result_local_var = OpenAPI_malloc(sizeof(OpenAPI_search_result_t)); + if (!search_result_local_var) { + return NULL; + } + search_result_local_var->validity_period = validity_period; + search_result_local_var->nf_instances = nf_instances; + search_result_local_var->search_id = search_id; + search_result_local_var->num_nf_inst_complete = num_nf_inst_complete; + search_result_local_var->nrf_supported_features = nrf_supported_features; + + return search_result_local_var; +} + +void OpenAPI_search_result_free(OpenAPI_search_result_t *search_result) +{ + if (NULL == search_result) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(search_result->nf_instances, node) { + OpenAPI_nf_profile_free(node->data); + } + OpenAPI_list_free(search_result->nf_instances); + ogs_free(search_result->search_id); + ogs_free(search_result->nrf_supported_features); + ogs_free(search_result); +} + +cJSON *OpenAPI_search_result_convertToJSON(OpenAPI_search_result_t *search_result) +{ + cJSON *item = NULL; + + if (search_result == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [SearchResult]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (search_result->validity_period) { + if (cJSON_AddNumberToObject(item, "validityPeriod", search_result->validity_period) == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [validity_period]"); + goto end; + } + } + + if (!search_result->nf_instances) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [nf_instances]"); + goto end; + } + cJSON *nf_instancesList = cJSON_AddArrayToObject(item, "nfInstances"); + if (nf_instancesList == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [nf_instances]"); + goto end; + } + + OpenAPI_lnode_t *nf_instances_node; + if (search_result->nf_instances) { + OpenAPI_list_for_each(search_result->nf_instances, nf_instances_node) { + cJSON *itemLocal = OpenAPI_nf_profile_convertToJSON(nf_instances_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [nf_instances]"); + goto end; + } + cJSON_AddItemToArray(nf_instancesList, itemLocal); + } + } + + if (search_result->search_id) { + if (cJSON_AddStringToObject(item, "searchId", search_result->search_id) == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [search_id]"); + goto end; + } + } + + if (search_result->num_nf_inst_complete) { + if (cJSON_AddNumberToObject(item, "numNfInstComplete", search_result->num_nf_inst_complete) == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [num_nf_inst_complete]"); + goto end; + } + } + + if (search_result->nrf_supported_features) { + if (cJSON_AddStringToObject(item, "nrfSupportedFeatures", search_result->nrf_supported_features) == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [nrf_supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_search_result_t *OpenAPI_search_result_parseFromJSON(cJSON *search_resultJSON) +{ + OpenAPI_search_result_t *search_result_local_var = NULL; + cJSON *validity_period = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "validityPeriod"); + + if (validity_period) { + if (!cJSON_IsNumber(validity_period)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [validity_period]"); + goto end; + } + } + + cJSON *nf_instances = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "nfInstances"); + if (!nf_instances) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [nf_instances]"); + goto end; + } + + OpenAPI_list_t *nf_instancesList; + + cJSON *nf_instances_local_nonprimitive; + if (!cJSON_IsArray(nf_instances)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [nf_instances]"); + goto end; + } + + nf_instancesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_instances_local_nonprimitive, nf_instances ) { + if (!cJSON_IsObject(nf_instances_local_nonprimitive)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [nf_instances]"); + goto end; + } + OpenAPI_nf_profile_t *nf_instancesItem = OpenAPI_nf_profile_parseFromJSON(nf_instances_local_nonprimitive); + + OpenAPI_list_add(nf_instancesList, nf_instancesItem); + } + + cJSON *search_id = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "searchId"); + + if (search_id) { + if (!cJSON_IsString(search_id)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [search_id]"); + goto end; + } + } + + cJSON *num_nf_inst_complete = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "numNfInstComplete"); + + if (num_nf_inst_complete) { + if (!cJSON_IsNumber(num_nf_inst_complete)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [num_nf_inst_complete]"); + goto end; + } + } + + cJSON *nrf_supported_features = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "nrfSupportedFeatures"); + + if (nrf_supported_features) { + if (!cJSON_IsString(nrf_supported_features)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [nrf_supported_features]"); + goto end; + } + } + + search_result_local_var = OpenAPI_search_result_create ( + validity_period ? validity_period->valuedouble : 0, + nf_instancesList, + search_id ? ogs_strdup(search_id->valuestring) : NULL, + num_nf_inst_complete ? num_nf_inst_complete->valuedouble : 0, + nrf_supported_features ? ogs_strdup(nrf_supported_features->valuestring) : NULL + ); + + return search_result_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/search_result.h b/lib/sbi/openapi/model/search_result.h new file mode 100644 index 000000000..c32bf680a --- /dev/null +++ b/lib/sbi/openapi/model/search_result.h @@ -0,0 +1,46 @@ +/* + * search_result.h + * + * + */ + +#ifndef _OpenAPI_search_result_H_ +#define _OpenAPI_search_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_profile.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_search_result_s OpenAPI_search_result_t; +typedef struct OpenAPI_search_result_s { + int validity_period; + OpenAPI_list_t *nf_instances; + char *search_id; + int num_nf_inst_complete; + char *nrf_supported_features; +} OpenAPI_search_result_t; + +OpenAPI_search_result_t *OpenAPI_search_result_create( + int validity_period, + OpenAPI_list_t *nf_instances, + char *search_id, + int num_nf_inst_complete, + char *nrf_supported_features + ); +void OpenAPI_search_result_free(OpenAPI_search_result_t *search_result); +OpenAPI_search_result_t *OpenAPI_search_result_parseFromJSON(cJSON *search_resultJSON); +cJSON *OpenAPI_search_result_convertToJSON(OpenAPI_search_result_t *search_result); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_search_result_H_ */ + diff --git a/lib/sbi/openapi/model/service_name_cond.c b/lib/sbi/openapi/model/service_name_cond.c new file mode 100644 index 000000000..d637beea2 --- /dev/null +++ b/lib/sbi/openapi/model/service_name_cond.c @@ -0,0 +1,76 @@ + +#include +#include +#include +#include "service_name_cond.h" + +OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_create( + char *service_name + ) +{ + OpenAPI_service_name_cond_t *service_name_cond_local_var = OpenAPI_malloc(sizeof(OpenAPI_service_name_cond_t)); + if (!service_name_cond_local_var) { + return NULL; + } + service_name_cond_local_var->service_name = service_name; + + return service_name_cond_local_var; +} + +void OpenAPI_service_name_cond_free(OpenAPI_service_name_cond_t *service_name_cond) +{ + if (NULL == service_name_cond) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(service_name_cond->service_name); + ogs_free(service_name_cond); +} + +cJSON *OpenAPI_service_name_cond_convertToJSON(OpenAPI_service_name_cond_t *service_name_cond) +{ + cJSON *item = NULL; + + if (service_name_cond == NULL) { + ogs_error("OpenAPI_service_name_cond_convertToJSON() failed [ServiceNameCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!service_name_cond->service_name) { + ogs_error("OpenAPI_service_name_cond_convertToJSON() failed [service_name]"); + goto end; + } + if (cJSON_AddStringToObject(item, "serviceName", service_name_cond->service_name) == NULL) { + ogs_error("OpenAPI_service_name_cond_convertToJSON() failed [service_name]"); + goto end; + } + +end: + return item; +} + +OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_parseFromJSON(cJSON *service_name_condJSON) +{ + OpenAPI_service_name_cond_t *service_name_cond_local_var = NULL; + cJSON *service_name = cJSON_GetObjectItemCaseSensitive(service_name_condJSON, "serviceName"); + if (!service_name) { + ogs_error("OpenAPI_service_name_cond_parseFromJSON() failed [service_name]"); + goto end; + } + + + if (!cJSON_IsString(service_name)) { + ogs_error("OpenAPI_service_name_cond_parseFromJSON() failed [service_name]"); + goto end; + } + + service_name_cond_local_var = OpenAPI_service_name_cond_create ( + ogs_strdup(service_name->valuestring) + ); + + return service_name_cond_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/service_name_cond.h b/lib/sbi/openapi/model/service_name_cond.h new file mode 100644 index 000000000..995ce9bba --- /dev/null +++ b/lib/sbi/openapi/model/service_name_cond.h @@ -0,0 +1,37 @@ +/* + * service_name_cond.h + * + * + */ + +#ifndef _OpenAPI_service_name_cond_H_ +#define _OpenAPI_service_name_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_service_name_cond_s OpenAPI_service_name_cond_t; +typedef struct OpenAPI_service_name_cond_s { + char *service_name; +} OpenAPI_service_name_cond_t; + +OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_create( + char *service_name + ); +void OpenAPI_service_name_cond_free(OpenAPI_service_name_cond_t *service_name_cond); +OpenAPI_service_name_cond_t *OpenAPI_service_name_cond_parseFromJSON(cJSON *service_name_condJSON); +cJSON *OpenAPI_service_name_cond_convertToJSON(OpenAPI_service_name_cond_t *service_name_cond); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_name_cond_H_ */ + diff --git a/lib/sbi/openapi/model/smf_info.c b/lib/sbi/openapi/model/smf_info.c new file mode 100644 index 000000000..40f0c6784 --- /dev/null +++ b/lib/sbi/openapi/model/smf_info.c @@ -0,0 +1,267 @@ + +#include +#include +#include +#include "smf_info.h" + +OpenAPI_smf_info_t *OpenAPI_smf_info_create( + OpenAPI_list_t *s_nssai_smf_info_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + char *pgw_fqdn, + OpenAPI_list_t *access_type + ) +{ + OpenAPI_smf_info_t *smf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_smf_info_t)); + if (!smf_info_local_var) { + return NULL; + } + smf_info_local_var->s_nssai_smf_info_list = s_nssai_smf_info_list; + smf_info_local_var->tai_list = tai_list; + smf_info_local_var->tai_range_list = tai_range_list; + smf_info_local_var->pgw_fqdn = pgw_fqdn; + smf_info_local_var->access_type = access_type; + + return smf_info_local_var; +} + +void OpenAPI_smf_info_free(OpenAPI_smf_info_t *smf_info) +{ + if (NULL == smf_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(smf_info->s_nssai_smf_info_list, node) { + OpenAPI_snssai_smf_info_item_free(node->data); + } + OpenAPI_list_free(smf_info->s_nssai_smf_info_list); + OpenAPI_list_for_each(smf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(smf_info->tai_list); + OpenAPI_list_for_each(smf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(smf_info->tai_range_list); + ogs_free(smf_info->pgw_fqdn); + OpenAPI_list_free(smf_info->access_type); + ogs_free(smf_info); +} + +cJSON *OpenAPI_smf_info_convertToJSON(OpenAPI_smf_info_t *smf_info) +{ + cJSON *item = NULL; + + if (smf_info == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [SmfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!smf_info->s_nssai_smf_info_list) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + cJSON *s_nssai_smf_info_listList = cJSON_AddArrayToObject(item, "sNssaiSmfInfoList"); + if (s_nssai_smf_info_listList == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + + OpenAPI_lnode_t *s_nssai_smf_info_list_node; + if (smf_info->s_nssai_smf_info_list) { + OpenAPI_list_for_each(smf_info->s_nssai_smf_info_list, s_nssai_smf_info_list_node) { + cJSON *itemLocal = OpenAPI_snssai_smf_info_item_convertToJSON(s_nssai_smf_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_smf_info_listList, itemLocal); + } + } + + if (smf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [tai_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_list_node; + if (smf_info->tai_list) { + OpenAPI_list_for_each(smf_info->tai_list, tai_list_node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(tai_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + } + + if (smf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + + OpenAPI_lnode_t *tai_range_list_node; + if (smf_info->tai_range_list) { + OpenAPI_list_for_each(smf_info->tai_range_list, tai_range_list_node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(tai_range_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + } + + if (smf_info->pgw_fqdn) { + if (cJSON_AddStringToObject(item, "pgwFqdn", smf_info->pgw_fqdn) == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [pgw_fqdn]"); + goto end; + } + } + + if (smf_info->access_type) { + cJSON *access_type = cJSON_AddArrayToObject(item, "accessType"); + if (access_type == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [access_type]"); + goto end; + } + OpenAPI_lnode_t *access_type_node; + OpenAPI_list_for_each(smf_info->access_type, access_type_node) { + if (cJSON_AddStringToObject(access_type, "", OpenAPI_access_type_ToString((OpenAPI_access_type_e)access_type_node->data)) == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [access_type]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON) +{ + OpenAPI_smf_info_t *smf_info_local_var = NULL; + cJSON *s_nssai_smf_info_list = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "sNssaiSmfInfoList"); + if (!s_nssai_smf_info_list) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + + OpenAPI_list_t *s_nssai_smf_info_listList; + + cJSON *s_nssai_smf_info_list_local_nonprimitive; + if (!cJSON_IsArray(s_nssai_smf_info_list)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + + s_nssai_smf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_smf_info_list_local_nonprimitive, s_nssai_smf_info_list ) { + if (!cJSON_IsObject(s_nssai_smf_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + OpenAPI_snssai_smf_info_item_t *s_nssai_smf_info_listItem = OpenAPI_snssai_smf_info_item_parseFromJSON(s_nssai_smf_info_list_local_nonprimitive); + + OpenAPI_list_add(s_nssai_smf_info_listList, s_nssai_smf_info_listItem); + } + + cJSON *tai_list = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "taiList"); + + OpenAPI_list_t *tai_listList; + if (tai_list) { + cJSON *tai_list_local_nonprimitive; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local_nonprimitive, tai_list ) { + if (!cJSON_IsObject(tai_list_local_nonprimitive)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local_nonprimitive); + + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + cJSON *tai_range_list = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "taiRangeList"); + + OpenAPI_list_t *tai_range_listList; + if (tai_range_list) { + cJSON *tai_range_list_local_nonprimitive; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local_nonprimitive, tai_range_list ) { + if (!cJSON_IsObject(tai_range_list_local_nonprimitive)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local_nonprimitive); + + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + cJSON *pgw_fqdn = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "pgwFqdn"); + + if (pgw_fqdn) { + if (!cJSON_IsString(pgw_fqdn)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [pgw_fqdn]"); + goto end; + } + } + + cJSON *access_type = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "accessType"); + + OpenAPI_list_t *access_typeList; + if (access_type) { + cJSON *access_type_local_nonprimitive; + if (!cJSON_IsArray(access_type)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [access_type]"); + goto end; + } + + access_typeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(access_type_local_nonprimitive, access_type ) { + if (!cJSON_IsString(access_type_local_nonprimitive)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [access_type]"); + goto end; + } + + OpenAPI_list_add(access_typeList, (void *)OpenAPI_access_type_FromString(access_type_local_nonprimitive->valuestring)); + } + } + + 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 + ); + + return smf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/smf_info.h b/lib/sbi/openapi/model/smf_info.h new file mode 100644 index 000000000..8ef8c67ac --- /dev/null +++ b/lib/sbi/openapi/model/smf_info.h @@ -0,0 +1,49 @@ +/* + * smf_info.h + * + * + */ + +#ifndef _OpenAPI_smf_info_H_ +#define _OpenAPI_smf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "snssai_smf_info_item.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_smf_info_s OpenAPI_smf_info_t; +typedef struct OpenAPI_smf_info_s { + OpenAPI_list_t *s_nssai_smf_info_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + char *pgw_fqdn; + OpenAPI_list_t *access_type; +} OpenAPI_smf_info_t; + +OpenAPI_smf_info_t *OpenAPI_smf_info_create( + OpenAPI_list_t *s_nssai_smf_info_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + char *pgw_fqdn, + OpenAPI_list_t *access_type + ); +void OpenAPI_smf_info_free(OpenAPI_smf_info_t *smf_info); +OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON); +cJSON *OpenAPI_smf_info_convertToJSON(OpenAPI_smf_info_t *smf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smf_info_H_ */ + diff --git a/lib/sbi/openapi/model/snssai.c b/lib/sbi/openapi/model/snssai.c new file mode 100644 index 000000000..296e6ef74 --- /dev/null +++ b/lib/sbi/openapi/model/snssai.c @@ -0,0 +1,95 @@ + +#include +#include +#include +#include "snssai.h" + +OpenAPI_snssai_t *OpenAPI_snssai_create( + int sst, + char *sd + ) +{ + OpenAPI_snssai_t *snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_snssai_t)); + if (!snssai_local_var) { + return NULL; + } + snssai_local_var->sst = sst; + snssai_local_var->sd = sd; + + return snssai_local_var; +} + +void OpenAPI_snssai_free(OpenAPI_snssai_t *snssai) +{ + if (NULL == snssai) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(snssai->sd); + ogs_free(snssai); +} + +cJSON *OpenAPI_snssai_convertToJSON(OpenAPI_snssai_t *snssai) +{ + cJSON *item = NULL; + + if (snssai == NULL) { + ogs_error("OpenAPI_snssai_convertToJSON() failed [Snssai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai->sst) { + ogs_error("OpenAPI_snssai_convertToJSON() failed [sst]"); + goto end; + } + if (cJSON_AddNumberToObject(item, "sst", snssai->sst) == NULL) { + ogs_error("OpenAPI_snssai_convertToJSON() failed [sst]"); + goto end; + } + + if (snssai->sd) { + if (cJSON_AddStringToObject(item, "sd", snssai->sd) == NULL) { + ogs_error("OpenAPI_snssai_convertToJSON() failed [sd]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_snssai_t *OpenAPI_snssai_parseFromJSON(cJSON *snssaiJSON) +{ + OpenAPI_snssai_t *snssai_local_var = NULL; + cJSON *sst = cJSON_GetObjectItemCaseSensitive(snssaiJSON, "sst"); + if (!sst) { + ogs_error("OpenAPI_snssai_parseFromJSON() failed [sst]"); + goto end; + } + + + if (!cJSON_IsNumber(sst)) { + ogs_error("OpenAPI_snssai_parseFromJSON() failed [sst]"); + goto end; + } + + cJSON *sd = cJSON_GetObjectItemCaseSensitive(snssaiJSON, "sd"); + + if (sd) { + if (!cJSON_IsString(sd)) { + ogs_error("OpenAPI_snssai_parseFromJSON() failed [sd]"); + goto end; + } + } + + snssai_local_var = OpenAPI_snssai_create ( + sst->valuedouble, + sd ? ogs_strdup(sd->valuestring) : NULL + ); + + return snssai_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/snssai.h b/lib/sbi/openapi/model/snssai.h new file mode 100644 index 000000000..72e6da199 --- /dev/null +++ b/lib/sbi/openapi/model/snssai.h @@ -0,0 +1,39 @@ +/* + * snssai.h + * + * + */ + +#ifndef _OpenAPI_snssai_H_ +#define _OpenAPI_snssai_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_snssai_s OpenAPI_snssai_t; +typedef struct OpenAPI_snssai_s { + int sst; + char *sd; +} OpenAPI_snssai_t; + +OpenAPI_snssai_t *OpenAPI_snssai_create( + int sst, + char *sd + ); +void OpenAPI_snssai_free(OpenAPI_snssai_t *snssai); +OpenAPI_snssai_t *OpenAPI_snssai_parseFromJSON(cJSON *snssaiJSON); +cJSON *OpenAPI_snssai_convertToJSON(OpenAPI_snssai_t *snssai); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_H_ */ + diff --git a/lib/sbi/openapi/model/snssai_smf_info_item.c b/lib/sbi/openapi/model/snssai_smf_info_item.c new file mode 100644 index 000000000..6af09046f --- /dev/null +++ b/lib/sbi/openapi/model/snssai_smf_info_item.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "snssai_smf_info_item.h" + +OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_create( + OpenAPI_snssai_t *s_nssai, + OpenAPI_list_t *dnn_smf_info_list + ) +{ + OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_snssai_smf_info_item_t)); + if (!snssai_smf_info_item_local_var) { + return NULL; + } + snssai_smf_info_item_local_var->s_nssai = s_nssai; + snssai_smf_info_item_local_var->dnn_smf_info_list = dnn_smf_info_list; + + return snssai_smf_info_item_local_var; +} + +void OpenAPI_snssai_smf_info_item_free(OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item) +{ + if (NULL == snssai_smf_info_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(snssai_smf_info_item->s_nssai); + OpenAPI_list_for_each(snssai_smf_info_item->dnn_smf_info_list, node) { + OpenAPI_dnn_smf_info_item_free(node->data); + } + OpenAPI_list_free(snssai_smf_info_item->dnn_smf_info_list); + ogs_free(snssai_smf_info_item); +} + +cJSON *OpenAPI_snssai_smf_info_item_convertToJSON(OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item) +{ + cJSON *item = NULL; + + if (snssai_smf_info_item == NULL) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [SnssaiSmfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai_smf_info_item->s_nssai) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(snssai_smf_info_item->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!snssai_smf_info_item->dnn_smf_info_list) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [dnn_smf_info_list]"); + goto end; + } + cJSON *dnn_smf_info_listList = cJSON_AddArrayToObject(item, "dnnSmfInfoList"); + if (dnn_smf_info_listList == NULL) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [dnn_smf_info_list]"); + goto end; + } + + OpenAPI_lnode_t *dnn_smf_info_list_node; + if (snssai_smf_info_item->dnn_smf_info_list) { + OpenAPI_list_for_each(snssai_smf_info_item->dnn_smf_info_list, dnn_smf_info_list_node) { + cJSON *itemLocal = OpenAPI_dnn_smf_info_item_convertToJSON(dnn_smf_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [dnn_smf_info_list]"); + goto end; + } + cJSON_AddItemToArray(dnn_smf_info_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_parseFromJSON(cJSON *snssai_smf_info_itemJSON) +{ + OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item_local_var = NULL; + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(snssai_smf_info_itemJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_snssai_smf_info_item_parseFromJSON() failed [s_nssai]"); + goto end; + } + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + + cJSON *dnn_smf_info_list = cJSON_GetObjectItemCaseSensitive(snssai_smf_info_itemJSON, "dnnSmfInfoList"); + if (!dnn_smf_info_list) { + ogs_error("OpenAPI_snssai_smf_info_item_parseFromJSON() failed [dnn_smf_info_list]"); + goto end; + } + + OpenAPI_list_t *dnn_smf_info_listList; + + cJSON *dnn_smf_info_list_local_nonprimitive; + if (!cJSON_IsArray(dnn_smf_info_list)) { + ogs_error("OpenAPI_snssai_smf_info_item_parseFromJSON() failed [dnn_smf_info_list]"); + goto end; + } + + dnn_smf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_smf_info_list_local_nonprimitive, dnn_smf_info_list ) { + if (!cJSON_IsObject(dnn_smf_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_snssai_smf_info_item_parseFromJSON() failed [dnn_smf_info_list]"); + goto end; + } + OpenAPI_dnn_smf_info_item_t *dnn_smf_info_listItem = OpenAPI_dnn_smf_info_item_parseFromJSON(dnn_smf_info_list_local_nonprimitive); + + OpenAPI_list_add(dnn_smf_info_listList, dnn_smf_info_listItem); + } + + snssai_smf_info_item_local_var = OpenAPI_snssai_smf_info_item_create ( + s_nssai_local_nonprim, + dnn_smf_info_listList + ); + + return snssai_smf_info_item_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/snssai_smf_info_item.h b/lib/sbi/openapi/model/snssai_smf_info_item.h new file mode 100644 index 000000000..ad1a170f3 --- /dev/null +++ b/lib/sbi/openapi/model/snssai_smf_info_item.h @@ -0,0 +1,41 @@ +/* + * snssai_smf_info_item.h + * + * + */ + +#ifndef _OpenAPI_snssai_smf_info_item_H_ +#define _OpenAPI_snssai_smf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnn_smf_info_item.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_smf_info_item_s OpenAPI_snssai_smf_info_item_t; +typedef struct OpenAPI_snssai_smf_info_item_s { + struct OpenAPI_snssai_s *s_nssai; + OpenAPI_list_t *dnn_smf_info_list; +} OpenAPI_snssai_smf_info_item_t; + +OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_create( + OpenAPI_snssai_t *s_nssai, + OpenAPI_list_t *dnn_smf_info_list + ); +void OpenAPI_snssai_smf_info_item_free(OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item); +OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_parseFromJSON(cJSON *snssai_smf_info_itemJSON); +cJSON *OpenAPI_snssai_smf_info_item_convertToJSON(OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_smf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/snssai_upf_info_item.c b/lib/sbi/openapi/model/snssai_upf_info_item.c new file mode 100644 index 000000000..79376eeea --- /dev/null +++ b/lib/sbi/openapi/model/snssai_upf_info_item.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "snssai_upf_info_item.h" + +OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_create( + OpenAPI_snssai_t *s_nssai, + OpenAPI_list_t *dnn_upf_info_list + ) +{ + OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item_local_var = OpenAPI_malloc(sizeof(OpenAPI_snssai_upf_info_item_t)); + if (!snssai_upf_info_item_local_var) { + return NULL; + } + snssai_upf_info_item_local_var->s_nssai = s_nssai; + snssai_upf_info_item_local_var->dnn_upf_info_list = dnn_upf_info_list; + + return snssai_upf_info_item_local_var; +} + +void OpenAPI_snssai_upf_info_item_free(OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item) +{ + if (NULL == snssai_upf_info_item) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_snssai_free(snssai_upf_info_item->s_nssai); + OpenAPI_list_for_each(snssai_upf_info_item->dnn_upf_info_list, node) { + OpenAPI_dnn_upf_info_item_free(node->data); + } + OpenAPI_list_free(snssai_upf_info_item->dnn_upf_info_list); + ogs_free(snssai_upf_info_item); +} + +cJSON *OpenAPI_snssai_upf_info_item_convertToJSON(OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item) +{ + cJSON *item = NULL; + + if (snssai_upf_info_item == NULL) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [SnssaiUpfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai_upf_info_item->s_nssai) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(snssai_upf_info_item->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!snssai_upf_info_item->dnn_upf_info_list) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [dnn_upf_info_list]"); + goto end; + } + cJSON *dnn_upf_info_listList = cJSON_AddArrayToObject(item, "dnnUpfInfoList"); + if (dnn_upf_info_listList == NULL) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [dnn_upf_info_list]"); + goto end; + } + + OpenAPI_lnode_t *dnn_upf_info_list_node; + if (snssai_upf_info_item->dnn_upf_info_list) { + OpenAPI_list_for_each(snssai_upf_info_item->dnn_upf_info_list, dnn_upf_info_list_node) { + cJSON *itemLocal = OpenAPI_dnn_upf_info_item_convertToJSON(dnn_upf_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [dnn_upf_info_list]"); + goto end; + } + cJSON_AddItemToArray(dnn_upf_info_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_parseFromJSON(cJSON *snssai_upf_info_itemJSON) +{ + OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item_local_var = NULL; + cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(snssai_upf_info_itemJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_snssai_upf_info_item_parseFromJSON() failed [s_nssai]"); + goto end; + } + + OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + + s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + + cJSON *dnn_upf_info_list = cJSON_GetObjectItemCaseSensitive(snssai_upf_info_itemJSON, "dnnUpfInfoList"); + if (!dnn_upf_info_list) { + ogs_error("OpenAPI_snssai_upf_info_item_parseFromJSON() failed [dnn_upf_info_list]"); + goto end; + } + + OpenAPI_list_t *dnn_upf_info_listList; + + cJSON *dnn_upf_info_list_local_nonprimitive; + if (!cJSON_IsArray(dnn_upf_info_list)) { + ogs_error("OpenAPI_snssai_upf_info_item_parseFromJSON() failed [dnn_upf_info_list]"); + goto end; + } + + dnn_upf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_upf_info_list_local_nonprimitive, dnn_upf_info_list ) { + if (!cJSON_IsObject(dnn_upf_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_snssai_upf_info_item_parseFromJSON() failed [dnn_upf_info_list]"); + goto end; + } + OpenAPI_dnn_upf_info_item_t *dnn_upf_info_listItem = OpenAPI_dnn_upf_info_item_parseFromJSON(dnn_upf_info_list_local_nonprimitive); + + OpenAPI_list_add(dnn_upf_info_listList, dnn_upf_info_listItem); + } + + snssai_upf_info_item_local_var = OpenAPI_snssai_upf_info_item_create ( + s_nssai_local_nonprim, + dnn_upf_info_listList + ); + + return snssai_upf_info_item_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/snssai_upf_info_item.h b/lib/sbi/openapi/model/snssai_upf_info_item.h new file mode 100644 index 000000000..5bd6399ef --- /dev/null +++ b/lib/sbi/openapi/model/snssai_upf_info_item.h @@ -0,0 +1,41 @@ +/* + * snssai_upf_info_item.h + * + * + */ + +#ifndef _OpenAPI_snssai_upf_info_item_H_ +#define _OpenAPI_snssai_upf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnn_upf_info_item.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_upf_info_item_s OpenAPI_snssai_upf_info_item_t; +typedef struct OpenAPI_snssai_upf_info_item_s { + struct OpenAPI_snssai_s *s_nssai; + OpenAPI_list_t *dnn_upf_info_list; +} OpenAPI_snssai_upf_info_item_t; + +OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_create( + OpenAPI_snssai_t *s_nssai, + OpenAPI_list_t *dnn_upf_info_list + ); +void OpenAPI_snssai_upf_info_item_free(OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item); +OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_parseFromJSON(cJSON *snssai_upf_info_itemJSON); +cJSON *OpenAPI_snssai_upf_info_item_convertToJSON(OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_upf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/stored_search_result.c b/lib/sbi/openapi/model/stored_search_result.c new file mode 100644 index 000000000..44555c475 --- /dev/null +++ b/lib/sbi/openapi/model/stored_search_result.c @@ -0,0 +1,106 @@ + +#include +#include +#include +#include "stored_search_result.h" + +OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_create( + OpenAPI_list_t *nf_instances + ) +{ + OpenAPI_stored_search_result_t *stored_search_result_local_var = OpenAPI_malloc(sizeof(OpenAPI_stored_search_result_t)); + if (!stored_search_result_local_var) { + return NULL; + } + stored_search_result_local_var->nf_instances = nf_instances; + + return stored_search_result_local_var; +} + +void OpenAPI_stored_search_result_free(OpenAPI_stored_search_result_t *stored_search_result) +{ + if (NULL == stored_search_result) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(stored_search_result->nf_instances, node) { + OpenAPI_nf_profile_free(node->data); + } + OpenAPI_list_free(stored_search_result->nf_instances); + ogs_free(stored_search_result); +} + +cJSON *OpenAPI_stored_search_result_convertToJSON(OpenAPI_stored_search_result_t *stored_search_result) +{ + cJSON *item = NULL; + + if (stored_search_result == NULL) { + ogs_error("OpenAPI_stored_search_result_convertToJSON() failed [StoredSearchResult]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!stored_search_result->nf_instances) { + ogs_error("OpenAPI_stored_search_result_convertToJSON() failed [nf_instances]"); + goto end; + } + cJSON *nf_instancesList = cJSON_AddArrayToObject(item, "nfInstances"); + if (nf_instancesList == NULL) { + ogs_error("OpenAPI_stored_search_result_convertToJSON() failed [nf_instances]"); + goto end; + } + + OpenAPI_lnode_t *nf_instances_node; + if (stored_search_result->nf_instances) { + OpenAPI_list_for_each(stored_search_result->nf_instances, nf_instances_node) { + cJSON *itemLocal = OpenAPI_nf_profile_convertToJSON(nf_instances_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_stored_search_result_convertToJSON() failed [nf_instances]"); + goto end; + } + cJSON_AddItemToArray(nf_instancesList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_parseFromJSON(cJSON *stored_search_resultJSON) +{ + OpenAPI_stored_search_result_t *stored_search_result_local_var = NULL; + cJSON *nf_instances = cJSON_GetObjectItemCaseSensitive(stored_search_resultJSON, "nfInstances"); + if (!nf_instances) { + ogs_error("OpenAPI_stored_search_result_parseFromJSON() failed [nf_instances]"); + goto end; + } + + OpenAPI_list_t *nf_instancesList; + + cJSON *nf_instances_local_nonprimitive; + if (!cJSON_IsArray(nf_instances)) { + ogs_error("OpenAPI_stored_search_result_parseFromJSON() failed [nf_instances]"); + goto end; + } + + nf_instancesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_instances_local_nonprimitive, nf_instances ) { + if (!cJSON_IsObject(nf_instances_local_nonprimitive)) { + ogs_error("OpenAPI_stored_search_result_parseFromJSON() failed [nf_instances]"); + goto end; + } + OpenAPI_nf_profile_t *nf_instancesItem = OpenAPI_nf_profile_parseFromJSON(nf_instances_local_nonprimitive); + + OpenAPI_list_add(nf_instancesList, nf_instancesItem); + } + + stored_search_result_local_var = OpenAPI_stored_search_result_create ( + nf_instancesList + ); + + return stored_search_result_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/stored_search_result.h b/lib/sbi/openapi/model/stored_search_result.h new file mode 100644 index 000000000..4c6bd0be4 --- /dev/null +++ b/lib/sbi/openapi/model/stored_search_result.h @@ -0,0 +1,38 @@ +/* + * stored_search_result.h + * + * + */ + +#ifndef _OpenAPI_stored_search_result_H_ +#define _OpenAPI_stored_search_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_profile.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_stored_search_result_s OpenAPI_stored_search_result_t; +typedef struct OpenAPI_stored_search_result_s { + OpenAPI_list_t *nf_instances; +} OpenAPI_stored_search_result_t; + +OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_create( + OpenAPI_list_t *nf_instances + ); +void OpenAPI_stored_search_result_free(OpenAPI_stored_search_result_t *stored_search_result); +OpenAPI_stored_search_result_t *OpenAPI_stored_search_result_parseFromJSON(cJSON *stored_search_resultJSON); +cJSON *OpenAPI_stored_search_result_convertToJSON(OpenAPI_stored_search_result_t *stored_search_result); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_stored_search_result_H_ */ + diff --git a/lib/sbi/openapi/model/subscription_data.c b/lib/sbi/openapi/model/subscription_data.c new file mode 100644 index 000000000..1cc986e42 --- /dev/null +++ b/lib/sbi/openapi/model/subscription_data.c @@ -0,0 +1,316 @@ + +#include +#include +#include +#include "subscription_data.h" + +OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( + char *nf_status_notification_uri, + char *req_nf_instance_id, + char *subscription_id, + char *validity_time, + OpenAPI_list_t *req_notif_events, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_notif_condition_t *notif_condition, + OpenAPI_nf_type_e req_nf_type, + char *req_nf_fqdn, + OpenAPI_list_t *req_snssais + ) +{ + OpenAPI_subscription_data_t *subscription_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_subscription_data_t)); + if (!subscription_data_local_var) { + return NULL; + } + subscription_data_local_var->nf_status_notification_uri = nf_status_notification_uri; + subscription_data_local_var->req_nf_instance_id = req_nf_instance_id; + subscription_data_local_var->subscription_id = subscription_id; + subscription_data_local_var->validity_time = validity_time; + subscription_data_local_var->req_notif_events = req_notif_events; + subscription_data_local_var->plmn_id = plmn_id; + subscription_data_local_var->notif_condition = notif_condition; + 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; + + return subscription_data_local_var; +} + +void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_data) +{ + if (NULL == subscription_data) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(subscription_data->nf_status_notification_uri); + ogs_free(subscription_data->req_nf_instance_id); + ogs_free(subscription_data->subscription_id); + ogs_free(subscription_data->validity_time); + OpenAPI_list_free(subscription_data->req_notif_events); + OpenAPI_plmn_id_free(subscription_data->plmn_id); + OpenAPI_notif_condition_free(subscription_data->notif_condition); + ogs_free(subscription_data->req_nf_fqdn); + OpenAPI_list_for_each(subscription_data->req_snssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(subscription_data->req_snssais); + ogs_free(subscription_data); +} + +cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subscription_data) +{ + cJSON *item = NULL; + + if (subscription_data == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [SubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!subscription_data->nf_status_notification_uri) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [nf_status_notification_uri]"); + goto end; + } + if (cJSON_AddStringToObject(item, "nfStatusNotificationUri", subscription_data->nf_status_notification_uri) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [nf_status_notification_uri]"); + goto end; + } + + if (subscription_data->req_nf_instance_id) { + if (cJSON_AddStringToObject(item, "reqNfInstanceId", subscription_data->req_nf_instance_id) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_nf_instance_id]"); + goto end; + } + } + + if (subscription_data->subscription_id) { + if (cJSON_AddStringToObject(item, "subscriptionId", subscription_data->subscription_id) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [subscription_id]"); + goto end; + } + } + + if (subscription_data->validity_time) { + if (cJSON_AddStringToObject(item, "validityTime", subscription_data->validity_time) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [validity_time]"); + goto end; + } + } + + if (subscription_data->req_notif_events) { + cJSON *req_notif_events = cJSON_AddArrayToObject(item, "reqNotifEvents"); + if (req_notif_events == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_notif_events]"); + goto end; + } + OpenAPI_lnode_t *req_notif_events_node; + OpenAPI_list_for_each(subscription_data->req_notif_events, req_notif_events_node) { + if (cJSON_AddStringToObject(req_notif_events, "", OpenAPI_notification_event_type_ToString((OpenAPI_notification_event_type_e)req_notif_events_node->data)) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_notif_events]"); + goto end; + } + } + } + + if (subscription_data->plmn_id) { + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(subscription_data->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [plmn_id]"); + goto end; + } + } + + if (subscription_data->notif_condition) { + cJSON *notif_condition_local_JSON = OpenAPI_notif_condition_convertToJSON(subscription_data->notif_condition); + if (notif_condition_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [notif_condition]"); + goto end; + } + cJSON_AddItemToObject(item, "notifCondition", notif_condition_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [notif_condition]"); + goto end; + } + } + + if (subscription_data->req_nf_type) { + if (cJSON_AddStringToObject(item, "reqNfType", OpenAPI_nf_type_ToString(subscription_data->req_nf_type)) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_nf_type]"); + goto end; + } + } + + if (subscription_data->req_nf_fqdn) { + if (cJSON_AddStringToObject(item, "reqNfFqdn", subscription_data->req_nf_fqdn) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_nf_fqdn]"); + goto end; + } + } + + if (subscription_data->req_snssais) { + cJSON *req_snssaisList = cJSON_AddArrayToObject(item, "reqSnssais"); + if (req_snssaisList == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snssais]"); + goto end; + } + + OpenAPI_lnode_t *req_snssais_node; + if (subscription_data->req_snssais) { + OpenAPI_list_for_each(subscription_data->req_snssais, req_snssais_node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(req_snssais_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snssais]"); + goto end; + } + cJSON_AddItemToArray(req_snssaisList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subscription_dataJSON) +{ + OpenAPI_subscription_data_t *subscription_data_local_var = NULL; + cJSON *nf_status_notification_uri = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nfStatusNotificationUri"); + if (!nf_status_notification_uri) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [nf_status_notification_uri]"); + goto end; + } + + + if (!cJSON_IsString(nf_status_notification_uri)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [nf_status_notification_uri]"); + goto end; + } + + cJSON *req_nf_instance_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfInstanceId"); + + if (req_nf_instance_id) { + if (!cJSON_IsString(req_nf_instance_id)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_nf_instance_id]"); + goto end; + } + } + + cJSON *subscription_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "subscriptionId"); + + if (subscription_id) { + if (!cJSON_IsString(subscription_id)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [subscription_id]"); + goto end; + } + } + + cJSON *validity_time = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "validityTime"); + + if (validity_time) { + if (!cJSON_IsString(validity_time)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [validity_time]"); + goto end; + } + } + + cJSON *req_notif_events = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNotifEvents"); + + OpenAPI_list_t *req_notif_eventsList; + if (req_notif_events) { + cJSON *req_notif_events_local_nonprimitive; + if (!cJSON_IsArray(req_notif_events)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_notif_events]"); + goto end; + } + + req_notif_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(req_notif_events_local_nonprimitive, req_notif_events ) { + if (!cJSON_IsString(req_notif_events_local_nonprimitive)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_notif_events]"); + goto end; + } + + OpenAPI_list_add(req_notif_eventsList, (void *)OpenAPI_notification_event_type_FromString(req_notif_events_local_nonprimitive->valuestring)); + } + } + + cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "plmnId"); + + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + if (plmn_id) { + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + } + + cJSON *notif_condition = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "notifCondition"); + + OpenAPI_notif_condition_t *notif_condition_local_nonprim = NULL; + if (notif_condition) { + notif_condition_local_nonprim = OpenAPI_notif_condition_parseFromJSON(notif_condition); + } + + cJSON *req_nf_type = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfType"); + + OpenAPI_nf_type_e req_nf_typeVariable; + if (req_nf_type) { + if (!cJSON_IsString(req_nf_type)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_nf_type]"); + goto end; + } + req_nf_typeVariable = OpenAPI_nf_type_FromString(req_nf_type->valuestring); + } + + cJSON *req_nf_fqdn = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfFqdn"); + + if (req_nf_fqdn) { + if (!cJSON_IsString(req_nf_fqdn)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_nf_fqdn]"); + goto end; + } + } + + cJSON *req_snssais = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqSnssais"); + + OpenAPI_list_t *req_snssaisList; + if (req_snssais) { + cJSON *req_snssais_local_nonprimitive; + if (!cJSON_IsArray(req_snssais)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snssais]"); + goto end; + } + + req_snssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(req_snssais_local_nonprimitive, req_snssais ) { + if (!cJSON_IsObject(req_snssais_local_nonprimitive)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snssais]"); + goto end; + } + OpenAPI_snssai_t *req_snssaisItem = OpenAPI_snssai_parseFromJSON(req_snssais_local_nonprimitive); + + OpenAPI_list_add(req_snssaisList, req_snssaisItem); + } + } + + 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, + subscription_id ? ogs_strdup(subscription_id->valuestring) : NULL, + validity_time ? ogs_strdup(validity_time->valuestring) : NULL, + req_notif_events ? req_notif_eventsList : NULL, + plmn_id ? plmn_id_local_nonprim : NULL, + notif_condition ? notif_condition_local_nonprim : NULL, + req_nf_type ? req_nf_typeVariable : 0, + req_nf_fqdn ? ogs_strdup(req_nf_fqdn->valuestring) : NULL, + req_snssais ? req_snssaisList : NULL + ); + + return subscription_data_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/subscription_data.h b/lib/sbi/openapi/model/subscription_data.h new file mode 100644 index 000000000..90c3db399 --- /dev/null +++ b/lib/sbi/openapi/model/subscription_data.h @@ -0,0 +1,60 @@ +/* + * subscription_data.h + * + * + */ + +#ifndef _OpenAPI_subscription_data_H_ +#define _OpenAPI_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_type.h" +#include "notif_condition.h" +#include "notification_event_type.h" +#include "plmn_id.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_subscription_data_s OpenAPI_subscription_data_t; +typedef struct OpenAPI_subscription_data_s { + char *nf_status_notification_uri; + char *req_nf_instance_id; + char *subscription_id; + char *validity_time; + OpenAPI_list_t *req_notif_events; + struct OpenAPI_plmn_id_s *plmn_id; + struct OpenAPI_notif_condition_s *notif_condition; + OpenAPI_nf_type_e req_nf_type; + char *req_nf_fqdn; + OpenAPI_list_t *req_snssais; +} OpenAPI_subscription_data_t; + +OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( + char *nf_status_notification_uri, + char *req_nf_instance_id, + char *subscription_id, + char *validity_time, + OpenAPI_list_t *req_notif_events, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_notif_condition_t *notif_condition, + OpenAPI_nf_type_e req_nf_type, + char *req_nf_fqdn, + OpenAPI_list_t *req_snssais + ); +void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_data); +OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subscription_dataJSON); +cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subscription_data); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/supi_range.c b/lib/sbi/openapi/model/supi_range.c new file mode 100644 index 000000000..e6594ee9a --- /dev/null +++ b/lib/sbi/openapi/model/supi_range.c @@ -0,0 +1,111 @@ + +#include +#include +#include +#include "supi_range.h" + +OpenAPI_supi_range_t *OpenAPI_supi_range_create( + char *start, + char *end, + char *pattern + ) +{ + OpenAPI_supi_range_t *supi_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_supi_range_t)); + if (!supi_range_local_var) { + return NULL; + } + supi_range_local_var->start = start; + supi_range_local_var->end = end; + supi_range_local_var->pattern = pattern; + + return supi_range_local_var; +} + +void OpenAPI_supi_range_free(OpenAPI_supi_range_t *supi_range) +{ + if (NULL == supi_range) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(supi_range->start); + ogs_free(supi_range->end); + ogs_free(supi_range->pattern); + ogs_free(supi_range); +} + +cJSON *OpenAPI_supi_range_convertToJSON(OpenAPI_supi_range_t *supi_range) +{ + cJSON *item = NULL; + + if (supi_range == NULL) { + ogs_error("OpenAPI_supi_range_convertToJSON() failed [SupiRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (supi_range->start) { + if (cJSON_AddStringToObject(item, "start", supi_range->start) == NULL) { + ogs_error("OpenAPI_supi_range_convertToJSON() failed [start]"); + goto end; + } + } + + if (supi_range->end) { + if (cJSON_AddStringToObject(item, "end", supi_range->end) == NULL) { + ogs_error("OpenAPI_supi_range_convertToJSON() failed [end]"); + goto end; + } + } + + if (supi_range->pattern) { + if (cJSON_AddStringToObject(item, "pattern", supi_range->pattern) == NULL) { + ogs_error("OpenAPI_supi_range_convertToJSON() failed [pattern]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_supi_range_t *OpenAPI_supi_range_parseFromJSON(cJSON *supi_rangeJSON) +{ + OpenAPI_supi_range_t *supi_range_local_var = NULL; + cJSON *start = cJSON_GetObjectItemCaseSensitive(supi_rangeJSON, "start"); + + if (start) { + if (!cJSON_IsString(start)) { + ogs_error("OpenAPI_supi_range_parseFromJSON() failed [start]"); + goto end; + } + } + + cJSON *end = cJSON_GetObjectItemCaseSensitive(supi_rangeJSON, "end"); + + if (end) { + if (!cJSON_IsString(end)) { + ogs_error("OpenAPI_supi_range_parseFromJSON() failed [end]"); + goto end; + } + } + + cJSON *pattern = cJSON_GetObjectItemCaseSensitive(supi_rangeJSON, "pattern"); + + if (pattern) { + if (!cJSON_IsString(pattern)) { + ogs_error("OpenAPI_supi_range_parseFromJSON() failed [pattern]"); + goto end; + } + } + + supi_range_local_var = OpenAPI_supi_range_create ( + start ? ogs_strdup(start->valuestring) : NULL, + end ? ogs_strdup(end->valuestring) : NULL, + pattern ? ogs_strdup(pattern->valuestring) : NULL + ); + + return supi_range_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/supi_range.h b/lib/sbi/openapi/model/supi_range.h new file mode 100644 index 000000000..ce9e17933 --- /dev/null +++ b/lib/sbi/openapi/model/supi_range.h @@ -0,0 +1,41 @@ +/* + * supi_range.h + * + * + */ + +#ifndef _OpenAPI_supi_range_H_ +#define _OpenAPI_supi_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_supi_range_s OpenAPI_supi_range_t; +typedef struct OpenAPI_supi_range_s { + char *start; + char *end; + char *pattern; +} OpenAPI_supi_range_t; + +OpenAPI_supi_range_t *OpenAPI_supi_range_create( + char *start, + char *end, + char *pattern + ); +void OpenAPI_supi_range_free(OpenAPI_supi_range_t *supi_range); +OpenAPI_supi_range_t *OpenAPI_supi_range_parseFromJSON(cJSON *supi_rangeJSON); +cJSON *OpenAPI_supi_range_convertToJSON(OpenAPI_supi_range_t *supi_range); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_supi_range_H_ */ + diff --git a/lib/sbi/openapi/model/tac_range.c b/lib/sbi/openapi/model/tac_range.c new file mode 100644 index 000000000..e83017c52 --- /dev/null +++ b/lib/sbi/openapi/model/tac_range.c @@ -0,0 +1,111 @@ + +#include +#include +#include +#include "tac_range.h" + +OpenAPI_tac_range_t *OpenAPI_tac_range_create( + char *start, + char *end, + char *pattern + ) +{ + OpenAPI_tac_range_t *tac_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_tac_range_t)); + if (!tac_range_local_var) { + return NULL; + } + tac_range_local_var->start = start; + tac_range_local_var->end = end; + tac_range_local_var->pattern = pattern; + + return tac_range_local_var; +} + +void OpenAPI_tac_range_free(OpenAPI_tac_range_t *tac_range) +{ + if (NULL == tac_range) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(tac_range->start); + ogs_free(tac_range->end); + ogs_free(tac_range->pattern); + ogs_free(tac_range); +} + +cJSON *OpenAPI_tac_range_convertToJSON(OpenAPI_tac_range_t *tac_range) +{ + cJSON *item = NULL; + + if (tac_range == NULL) { + ogs_error("OpenAPI_tac_range_convertToJSON() failed [TacRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (tac_range->start) { + if (cJSON_AddStringToObject(item, "start", tac_range->start) == NULL) { + ogs_error("OpenAPI_tac_range_convertToJSON() failed [start]"); + goto end; + } + } + + if (tac_range->end) { + if (cJSON_AddStringToObject(item, "end", tac_range->end) == NULL) { + ogs_error("OpenAPI_tac_range_convertToJSON() failed [end]"); + goto end; + } + } + + if (tac_range->pattern) { + if (cJSON_AddStringToObject(item, "pattern", tac_range->pattern) == NULL) { + ogs_error("OpenAPI_tac_range_convertToJSON() failed [pattern]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_tac_range_t *OpenAPI_tac_range_parseFromJSON(cJSON *tac_rangeJSON) +{ + OpenAPI_tac_range_t *tac_range_local_var = NULL; + cJSON *start = cJSON_GetObjectItemCaseSensitive(tac_rangeJSON, "start"); + + if (start) { + if (!cJSON_IsString(start)) { + ogs_error("OpenAPI_tac_range_parseFromJSON() failed [start]"); + goto end; + } + } + + cJSON *end = cJSON_GetObjectItemCaseSensitive(tac_rangeJSON, "end"); + + if (end) { + if (!cJSON_IsString(end)) { + ogs_error("OpenAPI_tac_range_parseFromJSON() failed [end]"); + goto end; + } + } + + cJSON *pattern = cJSON_GetObjectItemCaseSensitive(tac_rangeJSON, "pattern"); + + if (pattern) { + if (!cJSON_IsString(pattern)) { + ogs_error("OpenAPI_tac_range_parseFromJSON() failed [pattern]"); + goto end; + } + } + + tac_range_local_var = OpenAPI_tac_range_create ( + start ? ogs_strdup(start->valuestring) : NULL, + end ? ogs_strdup(end->valuestring) : NULL, + pattern ? ogs_strdup(pattern->valuestring) : NULL + ); + + return tac_range_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/tac_range.h b/lib/sbi/openapi/model/tac_range.h new file mode 100644 index 000000000..f71be7a6f --- /dev/null +++ b/lib/sbi/openapi/model/tac_range.h @@ -0,0 +1,41 @@ +/* + * tac_range.h + * + * + */ + +#ifndef _OpenAPI_tac_range_H_ +#define _OpenAPI_tac_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_tac_range_s OpenAPI_tac_range_t; +typedef struct OpenAPI_tac_range_s { + char *start; + char *end; + char *pattern; +} OpenAPI_tac_range_t; + +OpenAPI_tac_range_t *OpenAPI_tac_range_create( + char *start, + char *end, + char *pattern + ); +void OpenAPI_tac_range_free(OpenAPI_tac_range_t *tac_range); +OpenAPI_tac_range_t *OpenAPI_tac_range_parseFromJSON(cJSON *tac_rangeJSON); +cJSON *OpenAPI_tac_range_convertToJSON(OpenAPI_tac_range_t *tac_range); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tac_range_H_ */ + diff --git a/lib/sbi/openapi/model/tai.c b/lib/sbi/openapi/model/tai.c new file mode 100644 index 000000000..c239b0af1 --- /dev/null +++ b/lib/sbi/openapi/model/tai.c @@ -0,0 +1,105 @@ + +#include +#include +#include +#include "tai.h" + +OpenAPI_tai_t *OpenAPI_tai_create( + OpenAPI_plmn_id_t *plmn_id, + char *tac + ) +{ + OpenAPI_tai_t *tai_local_var = OpenAPI_malloc(sizeof(OpenAPI_tai_t)); + if (!tai_local_var) { + return NULL; + } + tai_local_var->plmn_id = plmn_id; + tai_local_var->tac = tac; + + return tai_local_var; +} + +void OpenAPI_tai_free(OpenAPI_tai_t *tai) +{ + if (NULL == tai) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_plmn_id_free(tai->plmn_id); + ogs_free(tai->tac); + ogs_free(tai); +} + +cJSON *OpenAPI_tai_convertToJSON(OpenAPI_tai_t *tai) +{ + cJSON *item = NULL; + + if (tai == NULL) { + ogs_error("OpenAPI_tai_convertToJSON() failed [Tai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!tai->plmn_id) { + ogs_error("OpenAPI_tai_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(tai->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_tai_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_tai_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!tai->tac) { + ogs_error("OpenAPI_tai_convertToJSON() failed [tac]"); + goto end; + } + if (cJSON_AddStringToObject(item, "tac", tai->tac) == NULL) { + ogs_error("OpenAPI_tai_convertToJSON() failed [tac]"); + goto end; + } + +end: + return item; +} + +OpenAPI_tai_t *OpenAPI_tai_parseFromJSON(cJSON *taiJSON) +{ + OpenAPI_tai_t *tai_local_var = NULL; + cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(taiJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_tai_parseFromJSON() failed [plmn_id]"); + goto end; + } + + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + cJSON *tac = cJSON_GetObjectItemCaseSensitive(taiJSON, "tac"); + if (!tac) { + ogs_error("OpenAPI_tai_parseFromJSON() failed [tac]"); + goto end; + } + + + if (!cJSON_IsString(tac)) { + ogs_error("OpenAPI_tai_parseFromJSON() failed [tac]"); + goto end; + } + + tai_local_var = OpenAPI_tai_create ( + plmn_id_local_nonprim, + ogs_strdup(tac->valuestring) + ); + + return tai_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/tai.h b/lib/sbi/openapi/model/tai.h new file mode 100644 index 000000000..6a7041e7b --- /dev/null +++ b/lib/sbi/openapi/model/tai.h @@ -0,0 +1,40 @@ +/* + * tai.h + * + * + */ + +#ifndef _OpenAPI_tai_H_ +#define _OpenAPI_tai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tai_s OpenAPI_tai_t; +typedef struct OpenAPI_tai_s { + struct OpenAPI_plmn_id_s *plmn_id; + char *tac; +} OpenAPI_tai_t; + +OpenAPI_tai_t *OpenAPI_tai_create( + OpenAPI_plmn_id_t *plmn_id, + char *tac + ); +void OpenAPI_tai_free(OpenAPI_tai_t *tai); +OpenAPI_tai_t *OpenAPI_tai_parseFromJSON(cJSON *taiJSON); +cJSON *OpenAPI_tai_convertToJSON(OpenAPI_tai_t *tai); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tai_H_ */ + diff --git a/lib/sbi/openapi/model/tai_range.c b/lib/sbi/openapi/model/tai_range.c new file mode 100644 index 000000000..96a35ffd5 --- /dev/null +++ b/lib/sbi/openapi/model/tai_range.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "tai_range.h" + +OpenAPI_tai_range_t *OpenAPI_tai_range_create( + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_list_t *tac_range_list + ) +{ + OpenAPI_tai_range_t *tai_range_local_var = OpenAPI_malloc(sizeof(OpenAPI_tai_range_t)); + if (!tai_range_local_var) { + return NULL; + } + tai_range_local_var->plmn_id = plmn_id; + tai_range_local_var->tac_range_list = tac_range_list; + + return tai_range_local_var; +} + +void OpenAPI_tai_range_free(OpenAPI_tai_range_t *tai_range) +{ + if (NULL == tai_range) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_plmn_id_free(tai_range->plmn_id); + OpenAPI_list_for_each(tai_range->tac_range_list, node) { + OpenAPI_tac_range_free(node->data); + } + OpenAPI_list_free(tai_range->tac_range_list); + ogs_free(tai_range); +} + +cJSON *OpenAPI_tai_range_convertToJSON(OpenAPI_tai_range_t *tai_range) +{ + cJSON *item = NULL; + + if (tai_range == NULL) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed [TaiRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!tai_range->plmn_id) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(tai_range->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!tai_range->tac_range_list) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed [tac_range_list]"); + goto end; + } + cJSON *tac_range_listList = cJSON_AddArrayToObject(item, "tacRangeList"); + if (tac_range_listList == NULL) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed [tac_range_list]"); + goto end; + } + + OpenAPI_lnode_t *tac_range_list_node; + if (tai_range->tac_range_list) { + OpenAPI_list_for_each(tai_range->tac_range_list, tac_range_list_node) { + cJSON *itemLocal = OpenAPI_tac_range_convertToJSON(tac_range_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_tai_range_convertToJSON() failed [tac_range_list]"); + goto end; + } + cJSON_AddItemToArray(tac_range_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_tai_range_t *OpenAPI_tai_range_parseFromJSON(cJSON *tai_rangeJSON) +{ + OpenAPI_tai_range_t *tai_range_local_var = NULL; + cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(tai_rangeJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_tai_range_parseFromJSON() failed [plmn_id]"); + goto end; + } + + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + cJSON *tac_range_list = cJSON_GetObjectItemCaseSensitive(tai_rangeJSON, "tacRangeList"); + if (!tac_range_list) { + ogs_error("OpenAPI_tai_range_parseFromJSON() failed [tac_range_list]"); + goto end; + } + + OpenAPI_list_t *tac_range_listList; + + cJSON *tac_range_list_local_nonprimitive; + if (!cJSON_IsArray(tac_range_list)) { + ogs_error("OpenAPI_tai_range_parseFromJSON() failed [tac_range_list]"); + goto end; + } + + tac_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tac_range_list_local_nonprimitive, tac_range_list ) { + if (!cJSON_IsObject(tac_range_list_local_nonprimitive)) { + ogs_error("OpenAPI_tai_range_parseFromJSON() failed [tac_range_list]"); + goto end; + } + OpenAPI_tac_range_t *tac_range_listItem = OpenAPI_tac_range_parseFromJSON(tac_range_list_local_nonprimitive); + + OpenAPI_list_add(tac_range_listList, tac_range_listItem); + } + + tai_range_local_var = OpenAPI_tai_range_create ( + plmn_id_local_nonprim, + tac_range_listList + ); + + return tai_range_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/tai_range.h b/lib/sbi/openapi/model/tai_range.h new file mode 100644 index 000000000..0aaf301c1 --- /dev/null +++ b/lib/sbi/openapi/model/tai_range.h @@ -0,0 +1,41 @@ +/* + * tai_range.h + * + * + */ + +#ifndef _OpenAPI_tai_range_H_ +#define _OpenAPI_tai_range_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" +#include "tac_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tai_range_s OpenAPI_tai_range_t; +typedef struct OpenAPI_tai_range_s { + struct OpenAPI_plmn_id_s *plmn_id; + OpenAPI_list_t *tac_range_list; +} OpenAPI_tai_range_t; + +OpenAPI_tai_range_t *OpenAPI_tai_range_create( + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_list_t *tac_range_list + ); +void OpenAPI_tai_range_free(OpenAPI_tai_range_t *tai_range); +OpenAPI_tai_range_t *OpenAPI_tai_range_parseFromJSON(cJSON *tai_rangeJSON); +cJSON *OpenAPI_tai_range_convertToJSON(OpenAPI_tai_range_t *tai_range); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tai_range_H_ */ + diff --git a/lib/sbi/openapi/model/transport_protocol.c b/lib/sbi/openapi/model/transport_protocol.c new file mode 100644 index 000000000..89ac22f10 --- /dev/null +++ b/lib/sbi/openapi/model/transport_protocol.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "transport_protocol.h" + +char* OpenAPI_transport_protocol_ToString(OpenAPI_transport_protocol_e transport_protocol) +{ + 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"; +} + +OpenAPI_transport_protocol_e OpenAPI_transport_protocol_FromString(char* transport_protocol) +{ + 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++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/transport_protocol.h b/lib/sbi/openapi/model/transport_protocol.h new file mode 100644 index 000000000..bdf488550 --- /dev/null +++ b/lib/sbi/openapi/model/transport_protocol.h @@ -0,0 +1,31 @@ +/* + * transport_protocol.h + * + * + */ + +#ifndef _OpenAPI_transport_protocol_H_ +#define _OpenAPI_transport_protocol_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_transport_protocol_NULL = 0, OpenAPI_transport_protocol_TCP } OpenAPI_transport_protocol_e; + +char* OpenAPI_transport_protocol_ToString(OpenAPI_transport_protocol_e transport_protocol); + +OpenAPI_transport_protocol_e OpenAPI_transport_protocol_FromString(char* transport_protocol); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_transport_protocol_H_ */ + diff --git a/lib/sbi/openapi/model/udm_info.c b/lib/sbi/openapi/model/udm_info.c new file mode 100644 index 000000000..b0e721481 --- /dev/null +++ b/lib/sbi/openapi/model/udm_info.c @@ -0,0 +1,264 @@ + +#include +#include +#include +#include "udm_info.h" + +OpenAPI_udm_info_t *OpenAPI_udm_info_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *routing_indicators + ) +{ + OpenAPI_udm_info_t *udm_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_udm_info_t)); + if (!udm_info_local_var) { + return NULL; + } + udm_info_local_var->group_id = group_id; + udm_info_local_var->supi_ranges = supi_ranges; + udm_info_local_var->gpsi_ranges = gpsi_ranges; + udm_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + udm_info_local_var->routing_indicators = routing_indicators; + + return udm_info_local_var; +} + +void OpenAPI_udm_info_free(OpenAPI_udm_info_t *udm_info) +{ + if (NULL == udm_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(udm_info->group_id); + OpenAPI_list_for_each(udm_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(udm_info->supi_ranges); + OpenAPI_list_for_each(udm_info->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(udm_info->gpsi_ranges); + OpenAPI_list_for_each(udm_info->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(udm_info->external_group_identifiers_ranges); + OpenAPI_list_for_each(udm_info->routing_indicators, node) { + ogs_free(node->data); + } + OpenAPI_list_free(udm_info->routing_indicators); + ogs_free(udm_info); +} + +cJSON *OpenAPI_udm_info_convertToJSON(OpenAPI_udm_info_t *udm_info) +{ + cJSON *item = NULL; + + if (udm_info == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [UdmInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (udm_info->group_id) { + if (cJSON_AddStringToObject(item, "groupId", udm_info->group_id) == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (udm_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *supi_ranges_node; + if (udm_info->supi_ranges) { + OpenAPI_list_for_each(udm_info->supi_ranges, supi_ranges_node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(supi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + } + + if (udm_info->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *gpsi_ranges_node; + if (udm_info->gpsi_ranges) { + OpenAPI_list_for_each(udm_info->gpsi_ranges, gpsi_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(gpsi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + } + + if (udm_info->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + OpenAPI_lnode_t *external_group_identifiers_ranges_node; + if (udm_info->external_group_identifiers_ranges) { + OpenAPI_list_for_each(udm_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_udm_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + } + + if (udm_info->routing_indicators) { + cJSON *routing_indicators = cJSON_AddArrayToObject(item, "routingIndicators"); + if (routing_indicators == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [routing_indicators]"); + goto end; + } + + OpenAPI_lnode_t *routing_indicators_node; + OpenAPI_list_for_each(udm_info->routing_indicators, routing_indicators_node) { + if (cJSON_AddStringToObject(routing_indicators, "", (char*)routing_indicators_node->data) == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [routing_indicators]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_udm_info_t *OpenAPI_udm_info_parseFromJSON(cJSON *udm_infoJSON) +{ + OpenAPI_udm_info_t *udm_info_local_var = NULL; + cJSON *group_id = cJSON_GetObjectItemCaseSensitive(udm_infoJSON, "groupId"); + + if (group_id) { + if (!cJSON_IsString(group_id)) { + ogs_error("OpenAPI_udm_info_parseFromJSON() failed [group_id]"); + goto end; + } + } + + cJSON *supi_ranges = cJSON_GetObjectItemCaseSensitive(udm_infoJSON, "supiRanges"); + + OpenAPI_list_t *supi_rangesList; + if (supi_ranges) { + cJSON *supi_ranges_local_nonprimitive; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_udm_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local_nonprimitive, supi_ranges ) { + if (!cJSON_IsObject(supi_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_udm_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local_nonprimitive); + + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + cJSON *gpsi_ranges = cJSON_GetObjectItemCaseSensitive(udm_infoJSON, "gpsiRanges"); + + OpenAPI_list_t *gpsi_rangesList; + if (gpsi_ranges) { + cJSON *gpsi_ranges_local_nonprimitive; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_udm_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_udm_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(udm_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_udm_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_udm_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 *routing_indicators = cJSON_GetObjectItemCaseSensitive(udm_infoJSON, "routingIndicators"); + + OpenAPI_list_t *routing_indicatorsList; + if (routing_indicators) { + cJSON *routing_indicators_local; + if (!cJSON_IsArray(routing_indicators)) { + ogs_error("OpenAPI_udm_info_parseFromJSON() failed [routing_indicators]"); + goto end; + } + routing_indicatorsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(routing_indicators_local, routing_indicators) { + if (!cJSON_IsString(routing_indicators_local)) { + ogs_error("OpenAPI_udm_info_parseFromJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_add(routing_indicatorsList, ogs_strdup(routing_indicators_local->valuestring)); + } + } + + udm_info_local_var = OpenAPI_udm_info_create ( + group_id ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + routing_indicators ? routing_indicatorsList : NULL + ); + + return udm_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/udm_info.h b/lib/sbi/openapi/model/udm_info.h new file mode 100644 index 000000000..978c2c5e5 --- /dev/null +++ b/lib/sbi/openapi/model/udm_info.h @@ -0,0 +1,47 @@ +/* + * udm_info.h + * + * + */ + +#ifndef _OpenAPI_udm_info_H_ +#define _OpenAPI_udm_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_udm_info_s OpenAPI_udm_info_t; +typedef struct OpenAPI_udm_info_s { + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + OpenAPI_list_t *routing_indicators; +} OpenAPI_udm_info_t; + +OpenAPI_udm_info_t *OpenAPI_udm_info_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *routing_indicators + ); +void OpenAPI_udm_info_free(OpenAPI_udm_info_t *udm_info); +OpenAPI_udm_info_t *OpenAPI_udm_info_parseFromJSON(cJSON *udm_infoJSON); +cJSON *OpenAPI_udm_info_convertToJSON(OpenAPI_udm_info_t *udm_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_udm_info_H_ */ + diff --git a/lib/sbi/openapi/model/udr_info.c b/lib/sbi/openapi/model/udr_info.c new file mode 100644 index 000000000..ee8503c70 --- /dev/null +++ b/lib/sbi/openapi/model/udr_info.c @@ -0,0 +1,271 @@ + +#include +#include +#include +#include "udr_info.h" + +OpenAPI_udr_info_t *OpenAPI_udr_info_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *supported_data_sets + ) +{ + OpenAPI_udr_info_t *udr_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_udr_info_t)); + if (!udr_info_local_var) { + return NULL; + } + udr_info_local_var->group_id = group_id; + udr_info_local_var->supi_ranges = supi_ranges; + udr_info_local_var->gpsi_ranges = gpsi_ranges; + udr_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + udr_info_local_var->supported_data_sets = supported_data_sets; + + return udr_info_local_var; +} + +void OpenAPI_udr_info_free(OpenAPI_udr_info_t *udr_info) +{ + if (NULL == udr_info) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(udr_info->group_id); + OpenAPI_list_for_each(udr_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(udr_info->supi_ranges); + OpenAPI_list_for_each(udr_info->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(udr_info->gpsi_ranges); + OpenAPI_list_for_each(udr_info->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(udr_info->external_group_identifiers_ranges); + OpenAPI_list_for_each(udr_info->supported_data_sets, node) { + OpenAPI_data_set_id_free(node->data); + } + OpenAPI_list_free(udr_info->supported_data_sets); + ogs_free(udr_info); +} + +cJSON *OpenAPI_udr_info_convertToJSON(OpenAPI_udr_info_t *udr_info) +{ + cJSON *item = NULL; + + if (udr_info == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [UdrInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (udr_info->group_id) { + if (cJSON_AddStringToObject(item, "groupId", udr_info->group_id) == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (udr_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *supi_ranges_node; + if (udr_info->supi_ranges) { + OpenAPI_list_for_each(udr_info->supi_ranges, supi_ranges_node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(supi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + } + + if (udr_info->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + + OpenAPI_lnode_t *gpsi_ranges_node; + if (udr_info->gpsi_ranges) { + OpenAPI_list_for_each(udr_info->gpsi_ranges, gpsi_ranges_node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(gpsi_ranges_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + } + + if (udr_info->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + OpenAPI_lnode_t *external_group_identifiers_ranges_node; + if (udr_info->external_group_identifiers_ranges) { + OpenAPI_list_for_each(udr_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_udr_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + } + + if (udr_info->supported_data_sets) { + cJSON *supported_data_setsList = cJSON_AddArrayToObject(item, "supportedDataSets"); + if (supported_data_setsList == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [supported_data_sets]"); + goto end; + } + + OpenAPI_lnode_t *supported_data_sets_node; + if (udr_info->supported_data_sets) { + OpenAPI_list_for_each(udr_info->supported_data_sets, supported_data_sets_node) { + cJSON *itemLocal = OpenAPI_data_set_id_convertToJSON(supported_data_sets_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [supported_data_sets]"); + goto end; + } + cJSON_AddItemToArray(supported_data_setsList, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_udr_info_t *OpenAPI_udr_info_parseFromJSON(cJSON *udr_infoJSON) +{ + OpenAPI_udr_info_t *udr_info_local_var = NULL; + cJSON *group_id = cJSON_GetObjectItemCaseSensitive(udr_infoJSON, "groupId"); + + if (group_id) { + if (!cJSON_IsString(group_id)) { + ogs_error("OpenAPI_udr_info_parseFromJSON() failed [group_id]"); + goto end; + } + } + + cJSON *supi_ranges = cJSON_GetObjectItemCaseSensitive(udr_infoJSON, "supiRanges"); + + OpenAPI_list_t *supi_rangesList; + if (supi_ranges) { + cJSON *supi_ranges_local_nonprimitive; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_udr_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local_nonprimitive, supi_ranges ) { + if (!cJSON_IsObject(supi_ranges_local_nonprimitive)) { + ogs_error("OpenAPI_udr_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local_nonprimitive); + + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + cJSON *gpsi_ranges = cJSON_GetObjectItemCaseSensitive(udr_infoJSON, "gpsiRanges"); + + OpenAPI_list_t *gpsi_rangesList; + if (gpsi_ranges) { + cJSON *gpsi_ranges_local_nonprimitive; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_udr_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_udr_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(udr_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_udr_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_udr_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 *supported_data_sets = cJSON_GetObjectItemCaseSensitive(udr_infoJSON, "supportedDataSets"); + + OpenAPI_list_t *supported_data_setsList; + if (supported_data_sets) { + cJSON *supported_data_sets_local_nonprimitive; + if (!cJSON_IsArray(supported_data_sets)) { + ogs_error("OpenAPI_udr_info_parseFromJSON() failed [supported_data_sets]"); + goto end; + } + + supported_data_setsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supported_data_sets_local_nonprimitive, supported_data_sets ) { + if (!cJSON_IsObject(supported_data_sets_local_nonprimitive)) { + ogs_error("OpenAPI_udr_info_parseFromJSON() failed [supported_data_sets]"); + goto end; + } + OpenAPI_data_set_id_t *supported_data_setsItem = OpenAPI_data_set_id_parseFromJSON(supported_data_sets_local_nonprimitive); + + OpenAPI_list_add(supported_data_setsList, supported_data_setsItem); + } + } + + udr_info_local_var = OpenAPI_udr_info_create ( + group_id ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + supported_data_sets ? supported_data_setsList : NULL + ); + + return udr_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/udr_info.h b/lib/sbi/openapi/model/udr_info.h new file mode 100644 index 000000000..d09a8f277 --- /dev/null +++ b/lib/sbi/openapi/model/udr_info.h @@ -0,0 +1,48 @@ +/* + * udr_info.h + * + * + */ + +#ifndef _OpenAPI_udr_info_H_ +#define _OpenAPI_udr_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "data_set_id.h" +#include "identity_range.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_udr_info_s OpenAPI_udr_info_t; +typedef struct OpenAPI_udr_info_s { + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + OpenAPI_list_t *supported_data_sets; +} OpenAPI_udr_info_t; + +OpenAPI_udr_info_t *OpenAPI_udr_info_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *supported_data_sets + ); +void OpenAPI_udr_info_free(OpenAPI_udr_info_t *udr_info); +OpenAPI_udr_info_t *OpenAPI_udr_info_parseFromJSON(cJSON *udr_infoJSON); +cJSON *OpenAPI_udr_info_convertToJSON(OpenAPI_udr_info_t *udr_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_udr_info_H_ */ + diff --git a/lib/sbi/openapi/model/up_interface_type.c b/lib/sbi/openapi/model/up_interface_type.c new file mode 100644 index 000000000..5fd6e5e4c --- /dev/null +++ b/lib/sbi/openapi/model/up_interface_type.c @@ -0,0 +1,51 @@ + +#include +#include +#include +#include "up_interface_type.h" + +OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_create( + ) +{ + OpenAPI_up_interface_type_t *up_interface_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_up_interface_type_t)); + if (!up_interface_type_local_var) { + return NULL; + } + + return up_interface_type_local_var; +} + +void OpenAPI_up_interface_type_free(OpenAPI_up_interface_type_t *up_interface_type) +{ + if (NULL == up_interface_type) { + return; + } + OpenAPI_lnode_t *node; + ogs_free(up_interface_type); +} + +cJSON *OpenAPI_up_interface_type_convertToJSON(OpenAPI_up_interface_type_t *up_interface_type) +{ + cJSON *item = NULL; + + if (up_interface_type == NULL) { + ogs_error("OpenAPI_up_interface_type_convertToJSON() failed [UPInterfaceType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_parseFromJSON(cJSON *up_interface_typeJSON) +{ + OpenAPI_up_interface_type_t *up_interface_type_local_var = NULL; + up_interface_type_local_var = OpenAPI_up_interface_type_create ( + ); + + return up_interface_type_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/up_interface_type.h b/lib/sbi/openapi/model/up_interface_type.h new file mode 100644 index 000000000..28ebd09ed --- /dev/null +++ b/lib/sbi/openapi/model/up_interface_type.h @@ -0,0 +1,35 @@ +/* + * up_interface_type.h + * + * + */ + +#ifndef _OpenAPI_up_interface_type_H_ +#define _OpenAPI_up_interface_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 struct OpenAPI_up_interface_type_s OpenAPI_up_interface_type_t; +typedef struct OpenAPI_up_interface_type_s { +} OpenAPI_up_interface_type_t; + +OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_create( + ); +void OpenAPI_up_interface_type_free(OpenAPI_up_interface_type_t *up_interface_type); +OpenAPI_up_interface_type_t *OpenAPI_up_interface_type_parseFromJSON(cJSON *up_interface_typeJSON); +cJSON *OpenAPI_up_interface_type_convertToJSON(OpenAPI_up_interface_type_t *up_interface_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_up_interface_type_H_ */ + diff --git a/lib/sbi/openapi/model/upf_info.c b/lib/sbi/openapi/model/upf_info.c new file mode 100644 index 000000000..81223fc39 --- /dev/null +++ b/lib/sbi/openapi/model/upf_info.c @@ -0,0 +1,311 @@ + +#include +#include +#include +#include "upf_info.h" + +OpenAPI_upf_info_t *OpenAPI_upf_info_create( + OpenAPI_list_t *s_nssai_upf_info_list, + OpenAPI_list_t *smf_serving_area, + OpenAPI_list_t *interface_upf_info_list, + int iwk_eps_ind, + OpenAPI_list_t *pdu_session_types, + OpenAPI_atsss_capability_t *atsss_capability, + int ue_ip_addr_ind + ) +{ + OpenAPI_upf_info_t *upf_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_upf_info_t)); + if (!upf_info_local_var) { + return NULL; + } + upf_info_local_var->s_nssai_upf_info_list = s_nssai_upf_info_list; + upf_info_local_var->smf_serving_area = smf_serving_area; + upf_info_local_var->interface_upf_info_list = interface_upf_info_list; + upf_info_local_var->iwk_eps_ind = iwk_eps_ind; + upf_info_local_var->pdu_session_types = pdu_session_types; + upf_info_local_var->atsss_capability = atsss_capability; + upf_info_local_var->ue_ip_addr_ind = ue_ip_addr_ind; + + return upf_info_local_var; +} + +void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info) +{ + if (NULL == upf_info) { + return; + } + OpenAPI_lnode_t *node; + OpenAPI_list_for_each(upf_info->s_nssai_upf_info_list, node) { + OpenAPI_snssai_upf_info_item_free(node->data); + } + OpenAPI_list_free(upf_info->s_nssai_upf_info_list); + OpenAPI_list_for_each(upf_info->smf_serving_area, node) { + ogs_free(node->data); + } + OpenAPI_list_free(upf_info->smf_serving_area); + OpenAPI_list_for_each(upf_info->interface_upf_info_list, node) { + OpenAPI_interface_upf_info_item_free(node->data); + } + OpenAPI_list_free(upf_info->interface_upf_info_list); + OpenAPI_list_for_each(upf_info->pdu_session_types, node) { + OpenAPI_pdu_session_type_free(node->data); + } + OpenAPI_list_free(upf_info->pdu_session_types); + OpenAPI_atsss_capability_free(upf_info->atsss_capability); + ogs_free(upf_info); +} + +cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) +{ + cJSON *item = NULL; + + if (upf_info == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [UpfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!upf_info->s_nssai_upf_info_list) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + cJSON *s_nssai_upf_info_listList = cJSON_AddArrayToObject(item, "sNssaiUpfInfoList"); + if (s_nssai_upf_info_listList == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + + OpenAPI_lnode_t *s_nssai_upf_info_list_node; + if (upf_info->s_nssai_upf_info_list) { + OpenAPI_list_for_each(upf_info->s_nssai_upf_info_list, s_nssai_upf_info_list_node) { + cJSON *itemLocal = OpenAPI_snssai_upf_info_item_convertToJSON(s_nssai_upf_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_upf_info_listList, itemLocal); + } + } + + if (upf_info->smf_serving_area) { + cJSON *smf_serving_area = cJSON_AddArrayToObject(item, "smfServingArea"); + if (smf_serving_area == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [smf_serving_area]"); + goto end; + } + + OpenAPI_lnode_t *smf_serving_area_node; + OpenAPI_list_for_each(upf_info->smf_serving_area, smf_serving_area_node) { + if (cJSON_AddStringToObject(smf_serving_area, "", (char*)smf_serving_area_node->data) == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [smf_serving_area]"); + goto end; + } + } + } + + if (upf_info->interface_upf_info_list) { + cJSON *interface_upf_info_listList = cJSON_AddArrayToObject(item, "interfaceUpfInfoList"); + if (interface_upf_info_listList == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [interface_upf_info_list]"); + goto end; + } + + OpenAPI_lnode_t *interface_upf_info_list_node; + if (upf_info->interface_upf_info_list) { + OpenAPI_list_for_each(upf_info->interface_upf_info_list, interface_upf_info_list_node) { + cJSON *itemLocal = OpenAPI_interface_upf_info_item_convertToJSON(interface_upf_info_list_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [interface_upf_info_list]"); + goto end; + } + cJSON_AddItemToArray(interface_upf_info_listList, itemLocal); + } + } + } + + if (upf_info->iwk_eps_ind) { + if (cJSON_AddBoolToObject(item, "iwkEpsInd", upf_info->iwk_eps_ind) == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [iwk_eps_ind]"); + goto end; + } + } + + if (upf_info->pdu_session_types) { + cJSON *pdu_session_typesList = cJSON_AddArrayToObject(item, "pduSessionTypes"); + if (pdu_session_typesList == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [pdu_session_types]"); + goto end; + } + + OpenAPI_lnode_t *pdu_session_types_node; + if (upf_info->pdu_session_types) { + OpenAPI_list_for_each(upf_info->pdu_session_types, pdu_session_types_node) { + cJSON *itemLocal = OpenAPI_pdu_session_type_convertToJSON(pdu_session_types_node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [pdu_session_types]"); + goto end; + } + cJSON_AddItemToArray(pdu_session_typesList, itemLocal); + } + } + } + + if (upf_info->atsss_capability) { + cJSON *atsss_capability_local_JSON = OpenAPI_atsss_capability_convertToJSON(upf_info->atsss_capability); + if (atsss_capability_local_JSON == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [atsss_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "atsssCapability", atsss_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [atsss_capability]"); + goto end; + } + } + + if (upf_info->ue_ip_addr_ind) { + if (cJSON_AddBoolToObject(item, "ueIpAddrInd", upf_info->ue_ip_addr_ind) == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [ue_ip_addr_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) +{ + OpenAPI_upf_info_t *upf_info_local_var = NULL; + cJSON *s_nssai_upf_info_list = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "sNssaiUpfInfoList"); + if (!s_nssai_upf_info_list) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + + OpenAPI_list_t *s_nssai_upf_info_listList; + + cJSON *s_nssai_upf_info_list_local_nonprimitive; + if (!cJSON_IsArray(s_nssai_upf_info_list)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + + s_nssai_upf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_upf_info_list_local_nonprimitive, s_nssai_upf_info_list ) { + if (!cJSON_IsObject(s_nssai_upf_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + OpenAPI_snssai_upf_info_item_t *s_nssai_upf_info_listItem = OpenAPI_snssai_upf_info_item_parseFromJSON(s_nssai_upf_info_list_local_nonprimitive); + + OpenAPI_list_add(s_nssai_upf_info_listList, s_nssai_upf_info_listItem); + } + + cJSON *smf_serving_area = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "smfServingArea"); + + OpenAPI_list_t *smf_serving_areaList; + if (smf_serving_area) { + cJSON *smf_serving_area_local; + if (!cJSON_IsArray(smf_serving_area)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [smf_serving_area]"); + goto end; + } + smf_serving_areaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(smf_serving_area_local, smf_serving_area) { + if (!cJSON_IsString(smf_serving_area_local)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [smf_serving_area]"); + goto end; + } + OpenAPI_list_add(smf_serving_areaList, ogs_strdup(smf_serving_area_local->valuestring)); + } + } + + cJSON *interface_upf_info_list = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "interfaceUpfInfoList"); + + OpenAPI_list_t *interface_upf_info_listList; + if (interface_upf_info_list) { + cJSON *interface_upf_info_list_local_nonprimitive; + if (!cJSON_IsArray(interface_upf_info_list)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [interface_upf_info_list]"); + goto end; + } + + interface_upf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(interface_upf_info_list_local_nonprimitive, interface_upf_info_list ) { + if (!cJSON_IsObject(interface_upf_info_list_local_nonprimitive)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [interface_upf_info_list]"); + goto end; + } + OpenAPI_interface_upf_info_item_t *interface_upf_info_listItem = OpenAPI_interface_upf_info_item_parseFromJSON(interface_upf_info_list_local_nonprimitive); + + OpenAPI_list_add(interface_upf_info_listList, interface_upf_info_listItem); + } + } + + cJSON *iwk_eps_ind = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "iwkEpsInd"); + + if (iwk_eps_ind) { + if (!cJSON_IsBool(iwk_eps_ind)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [iwk_eps_ind]"); + goto end; + } + } + + cJSON *pdu_session_types = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "pduSessionTypes"); + + OpenAPI_list_t *pdu_session_typesList; + if (pdu_session_types) { + cJSON *pdu_session_types_local_nonprimitive; + if (!cJSON_IsArray(pdu_session_types)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [pdu_session_types]"); + goto end; + } + + pdu_session_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_session_types_local_nonprimitive, pdu_session_types ) { + if (!cJSON_IsObject(pdu_session_types_local_nonprimitive)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [pdu_session_types]"); + goto end; + } + OpenAPI_pdu_session_type_t *pdu_session_typesItem = OpenAPI_pdu_session_type_parseFromJSON(pdu_session_types_local_nonprimitive); + + OpenAPI_list_add(pdu_session_typesList, pdu_session_typesItem); + } + } + + cJSON *atsss_capability = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "atsssCapability"); + + OpenAPI_atsss_capability_t *atsss_capability_local_nonprim = NULL; + if (atsss_capability) { + atsss_capability_local_nonprim = OpenAPI_atsss_capability_parseFromJSON(atsss_capability); + } + + cJSON *ue_ip_addr_ind = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "ueIpAddrInd"); + + if (ue_ip_addr_ind) { + if (!cJSON_IsBool(ue_ip_addr_ind)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [ue_ip_addr_ind]"); + goto end; + } + } + + upf_info_local_var = OpenAPI_upf_info_create ( + s_nssai_upf_info_listList, + smf_serving_area ? smf_serving_areaList : NULL, + interface_upf_info_list ? interface_upf_info_listList : NULL, + iwk_eps_ind ? iwk_eps_ind->valueint : 0, + pdu_session_types ? pdu_session_typesList : NULL, + atsss_capability ? atsss_capability_local_nonprim : NULL, + ue_ip_addr_ind ? ue_ip_addr_ind->valueint : 0 + ); + + return upf_info_local_var; +end: + return NULL; +} + diff --git a/lib/sbi/openapi/model/upf_info.h b/lib/sbi/openapi/model/upf_info.h new file mode 100644 index 000000000..1633f4d5f --- /dev/null +++ b/lib/sbi/openapi/model/upf_info.h @@ -0,0 +1,53 @@ +/* + * upf_info.h + * + * + */ + +#ifndef _OpenAPI_upf_info_H_ +#define _OpenAPI_upf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "atsss_capability.h" +#include "interface_upf_info_item.h" +#include "pdu_session_type.h" +#include "snssai_upf_info_item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_upf_info_s OpenAPI_upf_info_t; +typedef struct OpenAPI_upf_info_s { + OpenAPI_list_t *s_nssai_upf_info_list; + OpenAPI_list_t *smf_serving_area; + OpenAPI_list_t *interface_upf_info_list; + int iwk_eps_ind; + OpenAPI_list_t *pdu_session_types; + struct OpenAPI_atsss_capability_s *atsss_capability; + int ue_ip_addr_ind; +} OpenAPI_upf_info_t; + +OpenAPI_upf_info_t *OpenAPI_upf_info_create( + OpenAPI_list_t *s_nssai_upf_info_list, + OpenAPI_list_t *smf_serving_area, + OpenAPI_list_t *interface_upf_info_list, + int iwk_eps_ind, + OpenAPI_list_t *pdu_session_types, + OpenAPI_atsss_capability_t *atsss_capability, + int ue_ip_addr_ind + ); +void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info); +OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON); +cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_upf_info_H_ */ + diff --git a/lib/sbi/openapi/model/uri_scheme.c b/lib/sbi/openapi/model/uri_scheme.c new file mode 100644 index 000000000..516c44719 --- /dev/null +++ b/lib/sbi/openapi/model/uri_scheme.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "uri_scheme.h" + +char* OpenAPI_uri_scheme_ToString(OpenAPI_uri_scheme_e uri_scheme) +{ + const char *uri_schemeArray[] = { "NULL", "http", "https" }; + size_t sizeofArray = sizeof(uri_schemeArray) / sizeof(uri_schemeArray[0]); + if (uri_scheme < sizeofArray) + return (char *)uri_schemeArray[uri_scheme]; + else + return (char *)"Unknown"; +} + +OpenAPI_uri_scheme_e OpenAPI_uri_scheme_FromString(char* uri_scheme) +{ + int stringToReturn = 0; + const char *uri_schemeArray[] = { "NULL", "http", "https" }; + size_t sizeofArray = sizeof(uri_schemeArray) / sizeof(uri_schemeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(uri_scheme, uri_schemeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/uri_scheme.h b/lib/sbi/openapi/model/uri_scheme.h new file mode 100644 index 000000000..4d329a38d --- /dev/null +++ b/lib/sbi/openapi/model/uri_scheme.h @@ -0,0 +1,31 @@ +/* + * uri_scheme.h + * + * + */ + +#ifndef _OpenAPI_uri_scheme_H_ +#define _OpenAPI_uri_scheme_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_uri_scheme_NULL = 0, OpenAPI_uri_scheme_http, OpenAPI_uri_scheme_https } OpenAPI_uri_scheme_e; + +char* OpenAPI_uri_scheme_ToString(OpenAPI_uri_scheme_e uri_scheme); + +OpenAPI_uri_scheme_e OpenAPI_uri_scheme_FromString(char* uri_scheme); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_uri_scheme_H_ */ + diff --git a/lib/sbi/openapi/src/apiKey.c b/lib/sbi/openapi/src/apiKey.c new file mode 100644 index 000000000..d7e2a9bca --- /dev/null +++ b/lib/sbi/openapi/src/apiKey.c @@ -0,0 +1,23 @@ +#include +#include +#include "../include/keyValuePair.h" + +OpenAPI_map_t *OpenAPI_map_create(char *key, void *value) +{ + OpenAPI_map_t *OpenAPI_map = ogs_malloc(sizeof(OpenAPI_map_t)); + OpenAPI_map->key = key; + OpenAPI_map->value = value; + return OpenAPI_map; +} + +OpenAPI_map_t *OpenAPI_map_create_allocate(char *key, double value) +{ + double* boolpointer = ogs_malloc(sizeof(value)); + memcpy(boolpointer, &value, sizeof(value)); + return OpenAPI_map_create(key, boolpointer); +} + +void OpenAPI_map_free(OpenAPI_map_t *OpenAPI_map) +{ + ogs_free(OpenAPI_map); +} diff --git a/lib/sbi/openapi/src/list.c b/lib/sbi/openapi/src/list.c new file mode 100644 index 000000000..eebfb4084 --- /dev/null +++ b/lib/sbi/openapi/src/list.c @@ -0,0 +1,169 @@ +#include +#include +#include + +#include "../include/list.h" +static OpenAPI_lnode_t *listEntry_create(void *data) +{ + OpenAPI_lnode_t *created = ogs_malloc(sizeof(OpenAPI_lnode_t)); + + if (created == NULL) { + // TODO Malloc Failure + return NULL; + } + created->data = data; + + return created; +} + +void OpenAPI_lnode_free(OpenAPI_lnode_t *listEntry, void *additionalData) +{ + ogs_free(listEntry); +} + +void OpenAPI_lnode_print(OpenAPI_lnode_t *listEntry, void *additionalData) +{ + printf("%i\n", *((int *) (listEntry->data))); +} + +OpenAPI_list_t *OpenAPI_list_create(void) +{ + OpenAPI_list_t *createdList = ogs_malloc(sizeof(OpenAPI_list_t)); + + if (createdList == NULL) { + // TODO Malloc Failure + return NULL; + } + createdList->first = NULL; + createdList->last = NULL; + createdList->count = 0; + + return createdList; +} + +void OpenAPI_list_iterate_forward(OpenAPI_list_t *list, + void (*operationToPerform)( + OpenAPI_lnode_t *, void *callbackFunctionUsedData), + void *additionalDataNeededForCallbackFunction) +{ + OpenAPI_lnode_t *current = list->first; + OpenAPI_lnode_t *next; + + if (current == NULL) { + return; + } + + next = current->next; + + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + + while (current != NULL) { + next = current->next; + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + } +} + +void OpenAPI_list_iterate_backward(OpenAPI_list_t *list, + void (*operationToPerform)( + OpenAPI_lnode_t *, void *callbackFunctionUsedData), + void *additionalDataNeededForCallbackFunction) +{ + OpenAPI_lnode_t *current = list->last; + OpenAPI_lnode_t *next = current->prev; + + if (current == NULL) { + return; + } + + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + + while (current != NULL) { + next = current->prev; + operationToPerform(current, additionalDataNeededForCallbackFunction); + current = next; + } +} + +void OpenAPI_list_free(OpenAPI_list_t *list) +{ + if (list) { + OpenAPI_list_iterate_forward(list, OpenAPI_lnode_free, NULL); + ogs_free(list); + } +} + +void OpenAPI_list_add(OpenAPI_list_t *list, void *dataToAddInList) +{ + OpenAPI_lnode_t *newListEntry = listEntry_create(dataToAddInList); + if (newListEntry == NULL) { + // TODO Malloc Failure + return; + } + if (list->first == NULL) { + list->first = newListEntry; + list->last = newListEntry; + + newListEntry->prev = NULL; + newListEntry->next = NULL; + + list->count++; + + return; + } + + list->last->next = newListEntry; + newListEntry->prev = list->last; + newListEntry->next = NULL; + list->last = newListEntry; + + list->count++; +} + +void OpenAPI_list_remove(OpenAPI_list_t *list, OpenAPI_lnode_t *elementToRemove) +{ + OpenAPI_lnode_t *elementBeforeElementToRemove = elementToRemove->prev; + OpenAPI_lnode_t *elementAfterElementToRemove = elementToRemove->next; + + if (elementBeforeElementToRemove != NULL) { + elementBeforeElementToRemove->next = elementAfterElementToRemove; + } else { + list->first = elementAfterElementToRemove; + } + + if (elementAfterElementToRemove != NULL) { + elementAfterElementToRemove->prev = elementBeforeElementToRemove; + } else { + list->last = elementBeforeElementToRemove; + } + + OpenAPI_lnode_free(elementToRemove, NULL); + + list->count--; +} + +OpenAPI_lnode_t *OpenAPI_list_find(OpenAPI_list_t *list, long indexOfElement) +{ + OpenAPI_lnode_t *current; + int i; + + if ((list->count / 2) > indexOfElement) { + current = list->first; + + for(i = 0; i < indexOfElement; i++) { + current = current->next; + } + + return current; + } else { + current = list->last; + + for(i = 1; i < (list->count - indexOfElement); i++) { + current = current->prev; + } + + return current; + } +} diff --git a/lib/sbi/sbi-private.h b/lib/sbi/sbi-private.h new file mode 100644 index 000000000..ec5aaf8a5 --- /dev/null +++ b/lib/sbi/sbi-private.h @@ -0,0 +1,58 @@ +/* + * 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 OGS_SBI_PRIVATE_H +#define OGS_SBI_PRIVATE_H + +#include "ogs-core.h" +#include "yuarel.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct http_message_s { + ogs_hash_t *params; + ogs_hash_t *headers; + + char *content; + size_t content_length; +} http_message_t; + +typedef struct ogs_sbi_request_s { + ogs_sbi_header_t h; + http_message_t http; + + /* Used in microhttpd */ + bool suspended; + ogs_poll_t *poll; +} ogs_sbi_request_t; + +typedef struct ogs_sbi_response_s { + ogs_sbi_header_t h; + http_message_t http; + + int status; +} ogs_sbi_response_t; + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_PRIVATE_H */ diff --git a/lib/sbi/server.c b/lib/sbi/server.c new file mode 100644 index 000000000..a93034cb1 --- /dev/null +++ b/lib/sbi/server.c @@ -0,0 +1,623 @@ +/* + * 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 "ogs-app.h" +#include "ogs-sbi.h" + +#include "sbi-private.h" +#include "microhttpd.h" + +typedef struct ogs_sbi_session_s { + ogs_lnode_t lnode; + + struct MHD_Connection *connection; + + ogs_sbi_request_t *request; + ogs_sbi_server_t *server; + + /* + * The HTTP server(MHD) should send an HTTP response + * if an HTTP client(CURL) is requested. + * + * If the HTTP client closes the socket without sending an HTTP response, + * the CPU load of a program using MHD is 100%. This is because + * POLLIN(POLLRDHUP) is generated. So, the callback function of poll + * continues to be called. + * + * I've created the timer to check whether the user does not use + * the HTTP response. When the timer expires, an assertion occurs and + * terminates the program. + */ + ogs_timer_t *timer; +} ogs_sbi_session_t; + +static OGS_POOL(server_pool, ogs_sbi_server_t); +static OGS_POOL(session_pool, ogs_sbi_session_t); + +static void run(short when, ogs_socket_t fd, void *data); +static void notify_connection(void *cls, + struct MHD_Connection *connection, + void **socket_context, + enum MHD_ConnectionNotificationCode toe); +static int access_handler( + void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls); +static void notify_completed( + void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe); + +static void session_timer_expired(void *data); + +void ogs_sbi_server_init(int num_of_session_pool) +{ + ogs_list_init(&ogs_sbi_self()->server_list); + ogs_pool_init(&server_pool, ogs_config()->pool.sbi); + + ogs_pool_init(&session_pool, num_of_session_pool); +} +void ogs_sbi_server_final(void) +{ + ogs_sbi_server_remove_all(); + + ogs_pool_final(&server_pool); + ogs_pool_final(&session_pool); +} + +static ogs_sbi_session_t *session_add(ogs_sbi_server_t *server, + ogs_sbi_request_t *request, struct MHD_Connection *connection) +{ + ogs_sbi_session_t *session = NULL; + + ogs_assert(server); + ogs_assert(request); + ogs_assert(connection); + + ogs_pool_alloc(&session_pool, &session); + ogs_assert(session); + memset(session, 0, sizeof(ogs_sbi_session_t)); + + session->server = server; + session->request = request; + session->connection = connection; + + session->timer = ogs_timer_add( + ogs_sbi_self()->timer_mgr, session_timer_expired, session); + ogs_assert(session->timer); + + /* If User does not send http response within 1 second, + * we will assert this program. */ + ogs_timer_start(session->timer, ogs_time_from_sec(1)); + + ogs_list_add(&server->suspended_session_list, session); + + return session; +} + +static void session_remove(ogs_sbi_session_t *session) +{ + struct MHD_Connection *connection; + ogs_sbi_server_t *server = NULL; + + ogs_assert(session); + server = session->server; + ogs_assert(server); + + ogs_list_remove(&server->suspended_session_list, session); + + ogs_assert(session->timer); + ogs_timer_delete(session->timer); + + connection = session->connection; + ogs_assert(connection); + + MHD_resume_connection(connection); + + ogs_pool_free(&session_pool, session); +} + +static void session_timer_expired(void *data) +{ + ogs_sbi_session_t *session = NULL; + + session = data; + ogs_assert(session); + + ogs_fatal("An HTTP request was received, " + "but the HTTP response is missing."); + ogs_fatal("Please send the related pcap files for this case."); + + session_remove(session); + + ogs_assert_if_reached(); +} + +static void session_remove_all(ogs_sbi_server_t *server) +{ + ogs_sbi_session_t *session = NULL, *next_session = NULL; + + ogs_assert(server); + + ogs_list_for_each_safe( + &server->suspended_session_list, next_session, session) + session_remove(session); +} + +ogs_sbi_server_t *ogs_sbi_server_add(ogs_sockaddr_t *addr) +{ + ogs_sbi_server_t *server = NULL; + + ogs_assert(addr); + + ogs_pool_alloc(&server_pool, &server); + ogs_assert(server); + memset(server, 0, sizeof(ogs_sbi_server_t)); + + ogs_list_init(&server->suspended_session_list); + ogs_copyaddrinfo(&server->addr, addr); + + ogs_list_add(&ogs_sbi_self()->server_list, server); + + return server; +} + +void ogs_sbi_server_remove(ogs_sbi_server_t *server) +{ + ogs_assert(server); + + ogs_list_remove(&ogs_sbi_self()->server_list, server); + + ogs_sbi_server_stop(server); + + ogs_assert(server->addr); + ogs_freeaddrinfo(server->addr); + + ogs_pool_free(&server_pool, server); +} + +void ogs_sbi_server_remove_all(void) +{ + ogs_sbi_server_t *server = NULL, *next_server = NULL; + + ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server) + ogs_sbi_server_remove(server); +} + +void ogs_sbi_server_start(ogs_sbi_server_t *server, int (*cb)( + ogs_sbi_server_t *server, ogs_sbi_session_t *session, + ogs_sbi_request_t *request)) +{ + char buf[OGS_ADDRSTRLEN]; + ogs_sockaddr_t *addr = NULL; + + unsigned int mhd_flags = MHD_USE_ERROR_LOG; + const union MHD_DaemonInfo *mhd_info = NULL; +#define MAX_NUM_OF_MHD_OPTION_ITEM 8 + struct MHD_OptionItem mhd_ops[MAX_NUM_OF_MHD_OPTION_ITEM]; + int index = 0; + + ogs_assert(server); + +#if MHD_VERSION >= 0x00095300 + mhd_flags |= MHD_ALLOW_SUSPEND_RESUME; +#elif MHD_VERSION >= 0x00093400 + mhd_flags |= MHD_USE_SUSPEND_RESUME; +#else + mhd_flags |= MHD_USE_PIPE_FOR_SHUTDOWN; +#endif + + /* Setup callback function */ + server->cb = cb; + + mhd_ops[index].option = MHD_OPTION_NOTIFY_COMPLETED; + mhd_ops[index].value = (intptr_t)notify_completed; + mhd_ops[index].ptr_value = server; + index++; + + mhd_ops[index].option = MHD_OPTION_NOTIFY_CONNECTION; + mhd_ops[index].value = (intptr_t)¬ify_connection; + mhd_ops[index].ptr_value = NULL; + index++; + + addr = server->addr; + ogs_assert(addr); +#if MHD_VERSION >= 0x00095208 + if (addr->ogs_sa_family == AF_INET6) + mhd_flags |= MHD_USE_IPv6; +#endif + mhd_ops[index].option = MHD_OPTION_SOCK_ADDR; + mhd_ops[index].value = 0; + mhd_ops[index].ptr_value = (void *)&addr->sa; + index++; + + mhd_ops[index].option = MHD_OPTION_END; + mhd_ops[index].value = 0; + mhd_ops[index].ptr_value = NULL; + index++; + + server->mhd = MHD_start_daemon( + mhd_flags, + 0, + NULL, NULL, + access_handler, server, + MHD_OPTION_ARRAY, mhd_ops, + MHD_OPTION_END); + if (!server->mhd) { + ogs_error("Cannot start SBI server"); + return; + } + + /* Setup poll for server listening socket */ + mhd_info = MHD_get_daemon_info(server->mhd, MHD_DAEMON_INFO_LISTEN_FD); + ogs_assert(mhd_info); + + server->poll = ogs_pollset_add(ogs_sbi_self()->pollset, + OGS_POLLIN, mhd_info->listen_fd, run, server->mhd); + ogs_assert(server->poll); + + if (addr) { + char *hostname = ogs_gethostname(addr); + if (hostname) + ogs_info("sbi_server() [%s]:%d", + hostname, OGS_PORT(addr)); + else + ogs_info("sbi_server() [%s]:%d", + OGS_ADDR(addr, buf), OGS_PORT(addr)); + } else + ogs_info("sbi_server() [any]:any"); +} + +void ogs_sbi_server_start_all(int (*cb)( + ogs_sbi_server_t *server, ogs_sbi_session_t *session, + ogs_sbi_request_t *request)) +{ + ogs_sbi_server_t *server = NULL, *next_server = NULL; + + ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server) + ogs_sbi_server_start(server, cb); +} + +void ogs_sbi_server_stop(ogs_sbi_server_t *server) +{ + ogs_assert(server); + + if (server->poll) { + ogs_pollset_remove(server->poll); + server->poll = NULL; + } + + session_remove_all(server); + + if (server->mhd) { + MHD_stop_daemon(server->mhd); + server->mhd = NULL; + } +} + +void ogs_sbi_server_stop_all(void) +{ + ogs_sbi_server_t *server = NULL, *next_server = NULL; + + ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server) + ogs_sbi_server_stop(server); +} + +void ogs_sbi_server_send_response(ogs_sbi_session_t *session, + ogs_sbi_response_t *response, uint32_t status) +{ + int ret; + + struct MHD_Connection *connection = NULL; + struct MHD_Response *mhd_response; + struct MHD_Daemon *mhd_daemon = NULL; + const union MHD_ConnectionInfo *mhd_info = NULL; + MHD_socket mhd_socket = INVALID_SOCKET; + + ogs_hash_index_t *hi; + ogs_sbi_request_t *request = NULL; + + ogs_assert(response); + ogs_assert(status); + + ogs_assert(session); + connection = session->connection; + ogs_assert(connection); + + mhd_info = MHD_get_connection_info( + connection, MHD_CONNECTION_INFO_DAEMON); + ogs_assert(mhd_info); + mhd_daemon = mhd_info->daemon; + ogs_assert(mhd_daemon); + + mhd_info = MHD_get_connection_info( + connection, MHD_CONNECTION_INFO_CONNECTION_FD); + ogs_assert(mhd_info); + mhd_socket = mhd_info->connect_fd; + ogs_assert(mhd_socket != INVALID_SOCKET); + + if (response->http.content) { + mhd_response = MHD_create_response_from_buffer( + strlen(response->http.content), response->http.content, + MHD_RESPMEM_PERSISTENT); + ogs_assert(mhd_response); + } else { + mhd_response = MHD_create_response_from_buffer( + 0, NULL, MHD_RESPMEM_PERSISTENT); + ogs_assert(mhd_response); + } + + for (hi = ogs_hash_first(response->http.headers); + hi; hi = ogs_hash_next(hi)) { + const char *key = ogs_hash_this_key(hi); + char *val = ogs_hash_this_val(hi); + MHD_add_response_header(mhd_response, key, val); + } + + ogs_sbi_response_free(response); + session_remove(session); + + request = session->request; + ogs_assert(request); + request->poll = ogs_pollset_add(ogs_sbi_self()->pollset, + OGS_POLLOUT, mhd_socket, run, mhd_daemon); + ogs_assert(request->poll); + + ret = MHD_queue_response(connection, status, mhd_response); + ogs_assert(ret == MHD_YES); + MHD_destroy_response(mhd_response); +} + +void ogs_sbi_server_send_problem( + ogs_sbi_session_t *session, OpenAPI_problem_details_t *problem) +{ + ogs_sbi_message_t message; + ogs_sbi_response_t *response = NULL; + + ogs_assert(session); + ogs_assert(problem); + + memset(&message, 0, sizeof(message)); + + message.http.content_type = (char*)"application/problem+json"; + message.ProblemDetails = problem; + + response = ogs_sbi_build_response(&message); + ogs_assert(response); + + ogs_sbi_server_send_response(session, response, problem->status); +} + +void ogs_sbi_server_send_error(ogs_sbi_session_t *session, + int status, ogs_sbi_message_t *message, + const char *title, const char *detail) +{ + OpenAPI_problem_details_t problem; + + ogs_assert(session); + + memset(&problem, 0, sizeof(problem)); + + if (message) { + problem.type = ogs_msprintf("/%s/%s", + message->h.service.name, message->h.api.version); + if (message->h.resource.id) + problem.instance = ogs_msprintf("/%s/%s", + message->h.resource.name, message->h.resource.id); + else + problem.instance = ogs_msprintf("/%s", message->h.resource.name); + } + problem.status = status; + problem.title = (char*)title; + problem.detail = (char*)detail; + + ogs_sbi_server_send_problem(session, &problem); + + if (problem.type) + ogs_free(problem.type); + if (problem.instance) + ogs_free(problem.instance); +} + +static void run(short when, ogs_socket_t fd, void *data) +{ + struct MHD_Daemon *mhd_daemon = data; + + ogs_assert(mhd_daemon); + MHD_run(mhd_daemon); +} + +static void notify_connection(void *cls, + struct MHD_Connection *connection, + void **socket_context, + enum MHD_ConnectionNotificationCode toe) +{ + struct MHD_Daemon *mhd_daemon = NULL; + MHD_socket mhd_socket = INVALID_SOCKET; + + const union MHD_ConnectionInfo *mhd_info = NULL; + ogs_poll_t *poll = NULL; + + switch (toe) { + case MHD_CONNECTION_NOTIFY_STARTED: + mhd_info = MHD_get_connection_info( + connection, MHD_CONNECTION_INFO_DAEMON); + ogs_assert(mhd_info); + mhd_daemon = mhd_info->daemon; + ogs_assert(mhd_daemon); + + mhd_info = MHD_get_connection_info( + connection, MHD_CONNECTION_INFO_CONNECTION_FD); + ogs_assert(mhd_info); + mhd_socket = mhd_info->connect_fd; + ogs_assert(mhd_socket != INVALID_SOCKET); + + poll = ogs_pollset_add(ogs_sbi_self()->pollset, + OGS_POLLIN, mhd_socket, run, mhd_daemon); + ogs_assert(poll); + *socket_context = poll; + break; + case MHD_CONNECTION_NOTIFY_CLOSED: + poll = *socket_context; + ogs_pollset_remove(poll); + break; + } +} + +static int get_values(ogs_hash_t *hash, + enum MHD_ValueKind kind, const char *key, const char *value) +{ + ogs_assert(hash); + + if (!key || !value) + return MHD_YES; // Ignore connection value if invalid! + + ogs_sbi_header_set(hash, key, value); + + return MHD_YES; +} + +static int access_handler( + void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) +{ + ogs_sbi_server_t *server = NULL; + ogs_sbi_request_t *request = NULL; + ogs_sbi_session_t *session = NULL; + + server = cls; + ogs_assert(server); + + request = *con_cls; + + if (request && request->suspended) { + ogs_error("Suspended Request"); + return MHD_YES; + } + + if (!request) { + request = ogs_sbi_request_new(); + ogs_assert(request); + *con_cls = request; + + ogs_assert(request->http.params); + MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND, + (MHD_KeyValueIterator)get_values, request->http.params); + + ogs_assert(request->http.headers); + MHD_get_connection_values(connection, MHD_HEADER_KIND, + (MHD_KeyValueIterator)get_values, request->http.headers); + + request->h.method = ogs_strdup(method); + request->h.url = ogs_strdup(url); + + if (ogs_sbi_header_get(request->http.headers, "Content-Length") || + ogs_sbi_header_get(request->http.headers, "Transfer-Encoding")) { + + // FIXME : check if POST_DATA is on MHD_POSTDATA_KIND + + return MHD_YES; + } + + goto suspend; + } + + if (*upload_data_size != 0) { + size_t offset = 0; + + if (request->http.content == NULL) { + request->http.content_length = *upload_data_size; + request->http.content = + (char*)ogs_malloc(request->http.content_length + 1); + ogs_assert(request->http.content); + } else { + offset = request->http.content_length; + if ((request->http.content_length + + *upload_data_size) > OGS_HUGE_LEN) { + ogs_error("Overflow : Content-Length[%d], upload_data_size[%d]", + (int)request->http.content_length, + (int)*upload_data_size); + *upload_data_size = 0; + return MHD_YES; + } + request->http.content_length += *upload_data_size; + request->http.content = (char *)ogs_realloc( + request->http.content, request->http.content_length + 1); + ogs_assert(request->http.content); + } + + memcpy(request->http.content + offset, upload_data, *upload_data_size); + request->http.content[request->http.content_length] = '\0'; + *upload_data_size = 0; + + return MHD_YES; + } + +suspend: + MHD_suspend_connection(connection); + request->suspended = true; + + session = session_add(server, request, connection); + ogs_assert(session); + + if (server->cb) { + if (server->cb(server, session, request) != OGS_OK) { + ogs_warn("server callback error"); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, NULL, + "server callback error", NULL); + + return MHD_YES; + } + } else { + ogs_fatal("server callback is not registered"); + ogs_assert_if_reached(); + } + + return MHD_YES; +} + +static void notify_completed( + void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + ogs_sbi_request_t *request = *con_cls; + ogs_poll_t *poll = NULL; + + ogs_assert(request); + poll = request->poll; + if (poll) + ogs_pollset_remove(poll); + + ogs_sbi_request_free(request); +} diff --git a/lib/sbi/server.h b/lib/sbi/server.h new file mode 100644 index 000000000..4d6a1f5c0 --- /dev/null +++ b/lib/sbi/server.h @@ -0,0 +1,83 @@ +/* + * 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 . + */ + +#if !defined(OGS_SBI_INSIDE) && !defined(OGS_SBI_COMPILATION) +#error "This header cannot be included directly." +#endif + +#ifndef OGS_SBI_SERVER_H +#define OGS_SBI_SERVER_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ogs_sbi_server_s ogs_sbi_server_t; +typedef struct ogs_sbi_session_s ogs_sbi_session_t; + +typedef struct ogs_sbi_server_s { + ogs_lnode_t lnode; /* A node of list_t */ + + ogs_sockaddr_t *addr; /* Listen socket address */ + + struct { + const char *key; + const char *pem; + } tls; + + int (*cb)(ogs_sbi_server_t *server, ogs_sbi_session_t *session, + ogs_sbi_request_t *request); + void *data; + + ogs_list_t suspended_session_list; /* MHD suspended list */ + + void *mhd; /* MHD instance */ + ogs_poll_t *poll; /* MHD server poll */ + +} ogs_sbi_server_t; + +void ogs_sbi_server_init(int num_of_connection_pool); +void ogs_sbi_server_final(void); + +ogs_sbi_server_t *ogs_sbi_server_add(ogs_sockaddr_t *addr); +void ogs_sbi_server_remove(ogs_sbi_server_t *server); +void ogs_sbi_server_remove_all(void); + +void ogs_sbi_server_start(ogs_sbi_server_t *server, int (*cb)( + ogs_sbi_server_t *server, ogs_sbi_session_t *session, + ogs_sbi_request_t *request)); +void ogs_sbi_server_start_all(int (*cb)( + ogs_sbi_server_t *server, ogs_sbi_session_t *session, + ogs_sbi_request_t *request)); +void ogs_sbi_server_stop(ogs_sbi_server_t *server); +void ogs_sbi_server_stop_all(void); + +void ogs_sbi_server_send_response(ogs_sbi_session_t *session, + ogs_sbi_response_t *response, uint32_t status); +void ogs_sbi_server_send_error(ogs_sbi_session_t *session, + int status, ogs_sbi_message_t *message, + const char *title, const char *detail); +void ogs_sbi_server_send_problem( + ogs_sbi_session_t *session, OpenAPI_problem_details_t *problem); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_SBI_SERVER_H */ diff --git a/lib/sbi/support/3gpp-spec/TS29122_AsSessionWithQoS.yaml b/lib/sbi/support/3gpp-spec/TS29122_AsSessionWithQoS.yaml new file mode 100644 index 000000000..ead52fa59 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_AsSessionWithQoS.yaml @@ -0,0 +1,557 @@ +openapi: 3.0.0 +info: + title: 3gpp-as-session-with-qos + version: 1.1.0.alpha-2 + description: | + API for setting us an AS session with required QoS. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.5.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-as-session-with-qos/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/subscriptions: + get: + summary: read all of the active subscriptions for the SCS/AS + tags: + - AsSessionWithQoS API SCS/AS level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + responses: + '200': + description: OK. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/AsSessionWithQoSSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new subscription resource + tags: + - AsSessionWithQoS API Subscription level POST Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + requestBody: + description: Request to create a new subscription resource + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AsSessionWithQoSSubscription' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserPlaneNotificationData' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Created (Successful creation of subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/AsSessionWithQoSSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/subscriptions/{subscriptionId}: + get: + summary: read an active subscriptions for the SCS/AS and the subscription Id + tags: + - AsSessionWithQoS API Subscription level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/AsSessionWithQoSSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing subscription resource + tags: + - AsSessionWithQoS API subscription level PUT Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AsSessionWithQoSSubscription' + responses: + '200': + description: OK (Successful update of the subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/AsSessionWithQoSSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates/replaces an existing subscription resource + tags: + - AsSessionWithQoS API subscription level PATCH Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/AsSessionWithQoSSubscriptionPatch' + responses: + '200': + description: OK. The subscription was modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/AsSessionWithQoSSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing subscription + tags: + - AsSessionWithQoS API Subscription level DELETE Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + AsSessionWithQoSSubscription: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + flowInfo: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Describe the data flow which requires QoS. + ethFlowInfo: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet flows. + qosReference: + type: string + description: Identifies a pre-defined QoS information + altQoSReferences: + type: array + items: + type: string + minItems: 1 + description: Identifies an ordered list of pre-defined QoS information. The lower the index of the array for a given entry, the higher the priority. + ueIpv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + macAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + usageThreshold: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + sponsorInfo: + $ref: 'TS29122_CommonData.yaml#/components/schemas/SponsorInformation' + qosMonInfo: + $ref: '#/components/schemas/QosMonitoringInformation' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + required: + - notificationDestination + AsSessionWithQoSSubscriptionPatch: + type: object + properties: + flowInfo: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Describe the data flow which requires QoS. + ethFlowInfo: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet flows. + qosReference: + type: string + description: Pre-defined QoS reference + altQoSReferences: + type: array + items: + type: string + minItems: 1 + description: Identifies an ordered list of pre-defined QoS information. The lower the index of the array for a given entry, the higher the priority. + usageThreshold: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThresholdRm' + qosMonInfo: + $ref: '#/components/schemas/QosMonitoringInformationRm' + QosMonitoringInformation: + type: object + properties: + reqQosMonParams: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/RequestedQosMonitoringParameter' + minItems: 1 + repFreqs: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/ReportingFrequency' + minItems: 1 + repThreshDl: + type: integer + repThreshUl: + type: integer + repThreshRp: + type: integer + waitTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + repPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + QosMonitoringInformationRm: + type: object + properties: + reqQosMonParams: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/RequestedQosMonitoringParameter' + minItems: 1 + repFreqs: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/ReportingFrequency' + minItems: 1 + repThreshDl: + type: integer + nullable: true + repThreshUl: + type: integer + nullable: true + repThreshRp: + type: integer + nullable: true + waitTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + repPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' + QosMonitoringReport: + type: object + properties: + ulDelays: + type: array + items: + type: integer + minItems: 1 + dlDelays: + type: array + items: + type: integer + minItems: 1 + rtDelays: + type: array + items: + type: integer + minItems: 1 + UserPlaneNotificationData: + type: object + properties: + transaction: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + eventReports: + type: array + items: + $ref: '#/components/schemas/UserPlaneEventReport' + minItems: 1 + description: Contains the reported event and applicable information + required: + - transaction + - eventReports + UserPlaneEventReport: + type: object + properties: + event: + $ref: '#/components/schemas/UserPlaneEvent' + accumulatedUsage: + $ref: 'TS29122_CommonData.yaml#/components/schemas/AccumulatedUsage' + flowIds: + type: array + items: + type: integer + minItems: 1 + description: Identifies the IP flows that were sent during event subscription + appliedQosRef: + type: string + description: The currently applied QoS reference. Applicable for event QOS_NOT_GUARANTEED. + qosMonReports: + type: array + items: + $ref: '#/components/schemas/QosMonitoringReport' + minItems: 1 + description: Contains the QoS Monitoring Reporting information + required: + - event + UserPlaneEvent: + anyOf: + - type: string + enum: + - SESSION_TERMINATION + - LOSS_OF_BEARER + - RECOVERY_OF_BEARER + - RELEASE_OF_BEARER + - USAGE_REPORT + - FAILED_RESOURCES_ALLOCATION + - QOS_GUARANTEED + - QOS_NOT_GUARANTEED + - QOS_MONITORING + - 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 + - SESSION_TERMINATION: Indicates that Rx session is terminated. + - LOSS_OF_BEARER : Indicates a loss of a bearer. + - RECOVERY_OF_BEARER: Indicates a recovery of a bearer. + - RELEASE_OF_BEARER: Indicates a release of a bearer. + - USAGE_REPORT: Indicates the usage report event. + - FAILED_RESOURCES_ALLOCATION: Indicates the resource allocation is failed. + - QOS_GUARANTEED: The QoS targets of one or more SDFs are guaranteed again. + - QOS_NOT_GUARANTEED: The QoS targets of one or more SDFs are not being guaranteed. + - QOS_MONITORING: Indicates a QoS monitoring event. diff --git a/lib/sbi/support/3gpp-spec/TS29122_ChargeableParty.yaml b/lib/sbi/support/3gpp-spec/TS29122_ChargeableParty.yaml new file mode 100644 index 000000000..205152fc5 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_ChargeableParty.yaml @@ -0,0 +1,362 @@ +openapi: 3.0.0 +info: + title: 3gpp-chargeable-party + version: 1.1.0.alpha-1 + description: | + API for Chargeable Party management. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.3.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-chargeable-party/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/transactions: + get: + summary: Read all chargeable party transaction resources for a given SCS/AS + tags: + - Chargeable Party Transaction Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of Chargeable Party resource) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ChargeableParty' + minItems: 0 + description: individual BDT policy subscription. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Create a new chargeable party transaction resource + tags: + - Chargeable Party Transaction Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + requestBody: + description: representation of the Chargeable Party resource to be Created in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargeableParty' + callbacks: + eventNotification: + '{$request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/NotificationData' + responses: + '200': + description: OK (The successful acknowledgement of the notification with a body) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: successful creation of a chargeable party resource + content: + application/json: + schema: + $ref: '#/components/schemas/ChargeableParty' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/transactions/{transactionId}: + get: + summary: read a chargeable party resource for a given SCS/AS and a transaction Id + tags: + - Individual chargeable party resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of a chargeable party resource) + content: + application/json: + schema: + $ref: '#/components/schemas/ChargeableParty' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates a existing chargeable party resource for a given SCS/AS and transaction Id. + tags: + - Individual chargeable party resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + requestBody: + description: representation of the chargeable party resource to be udpated in the SCEF + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/ChargeablePartyPatch' + responses: + '200': + description: successful update of a chargeable party resource + content: + application/json: + schema: + $ref: '#/components/schemas/ChargeableParty' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: deletes a chargeable party resource for a given SCS/AS and a transcation Id. + tags: + - Individual chargeable party resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + responses: + '200': + description: successful deletion of an resouce of chargeable party + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + ChargeableParty: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + ipv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr : + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + macAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + flowInfo: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Describes the application flows. + ethFlowInfo: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet flows. + sponsorInformation: + $ref: 'TS29122_CommonData.yaml#/components/schemas/SponsorInformation' + sponsoringEnabled: + type: boolean + description: Indicates sponsoring status. + referenceId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + usageThreshold: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + required: + - notificationDestination + - sponsorInformation + - sponsoringEnabled + ChargeablePartyPatch: + type: object + properties: + flowInfo: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Describes the application flows. + ethFlowInfo: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet flows. + sponsoringEnabled: + type: boolean + description: Indicates sponsoring status. + referenceId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + usageThreshold: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThresholdRm' diff --git a/lib/sbi/support/3gpp-spec/TS29122_CommonData.yaml b/lib/sbi/support/3gpp-spec/TS29122_CommonData.yaml new file mode 100644 index 000000000..3a6022fc6 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_CommonData.yaml @@ -0,0 +1,505 @@ +openapi: 3.0.0 +info: + title: TS 29.122 Common Data Types + version: 1.1.0.alpha-2 + description: | + Data types applicable to several APIs. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.5.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +paths: {} +components: + schemas: + SponsorInformation: + type: object + properties: + sponsorId: + type: string + description: It indicates Sponsor ID. + aspId: + type: string + description: It indicates Application Service Provider ID. + required: + - sponsorId + - aspId + UsageThreshold: + type: object + properties: + duration: + $ref: '#/components/schemas/DurationSec' + totalVolume: + $ref: '#/components/schemas/Volume' + downlinkVolume: + $ref: '#/components/schemas/Volume' + uplinkVolume: + $ref: '#/components/schemas/Volume' + UsageThresholdRm: + type: object + properties: + duration: + $ref: '#/components/schemas/DurationSecRm' + totalVolume: + $ref: '#/components/schemas/VolumeRm' + downlinkVolume: + $ref: '#/components/schemas/VolumeRm' + uplinkVolume: + $ref: '#/components/schemas/VolumeRm' + nullable: true + TimeWindow: + type: object + properties: + startTime: + $ref: '#/components/schemas/DateTime' + stopTime: + $ref: '#/components/schemas/DateTime' + required: + - startTime + - stopTime + Acknowledgement: + type: object + properties: + details: + type: string + description: A human-readable explanation specific to this successful acknowledgement + required: + - details + NotificationData: + type: object + properties: + transaction: + $ref: '#/components/schemas/Link' + eventReports: + type: array + items: + $ref: '#/components/schemas/EventReport' + minItems: 1 + description: Contains the reported event and applicable information + required: + - transaction + - eventReports + EventReport: + type: object + properties: + event: + $ref: '#/components/schemas/Event' + accumulatedUsage: + $ref: '#/components/schemas/AccumulatedUsage' + flowIds: + type: array + items: + type: integer + minItems: 1 + description: Identifies the IP flows that were sent during event subscription + required: + - event + AccumulatedUsage: + type: object + properties: + duration: + $ref: '#/components/schemas/DurationSec' + totalVolume: + $ref: '#/components/schemas/Volume' + downlinkVolume: + $ref: '#/components/schemas/Volume' + uplinkVolume: + $ref: '#/components/schemas/Volume' + FlowInfo: + type: object + properties: + flowId: + type: integer + description: Indicates the IP flow. + flowDescriptions: + type: array + items: + type: string + description: Indicates the packet filters of the IP flow. Refer to subclause 5.3.8 of 3GPP TS 29.214 for encoding. It shall contain UL and/or DL IP flow description. + minItems: 1 + maxItems: 2 + required: + - flowId + TestNotification: + type: object + properties: + subscription: + $ref: '#/components/schemas/Link' + required: + - subscription + WebsockNotifConfig: + type: object + properties: + websocketUri: + $ref: '#/components/schemas/Link' + requestWebsocketUri: + type: boolean + description: Set by the SCS/AS to indicate that the Websocket delivery is requested. + LocationArea: + type: object + properties: + cellIds: + type: array + items: + type: string + minItems: 1 + description: Indicates a list of Cell Global Identities of the user which identifies the cell the UE is registered. + enodeBIds: + type: array + items: + type: string + minItems: 1 + description: Indicates a list of eNodeB identities in which the UE is currently located. + routingAreaIds: + type: array + items: + type: string + minItems: 1 + description: Identifies a list of Routing Area Identities of the user where the UE is located. + trackingAreaIds: + type: array + items: + type: string + minItems: 1 + description: Identifies a list of Tracking Area Identities of the user where the UE is located. + geographicAreas: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + minItems: 1 + description: Identifies a list of geographic area of the user where the UE is located. + civicAddresses: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CivicAddress' + minItems: 1 + description: Identifies a list of civic addresses of the user where the UE is located. + LocationArea5G: + type: object + properties: + geographicAreas: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + minItems: 0 + description: Identifies a list of geographic area of the user where the UE is located. + civicAddresses: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CivicAddress' + minItems: 0 + description: Identifies a list of civic addresses of the user where the UE is located. + nwAreaInfo: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + ProblemDetails: + type: object + properties: + type: + $ref: '#/components/schemas/Uri' + title: + type: string + description: A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem. + status: + type: integer + description: The HTTP status code for this occurrence of the problem. + detail: + type: string + description: A human-readable explanation specific to this occurrence of the problem. + instance: + $ref: '#/components/schemas/Uri' + cause: + type: string + description: A machine-readable application error cause specific to this occurrence of the problem. This IE should be present and provide application-related error information, if available. + invalidParams: + type: array + items: + $ref: '#/components/schemas/InvalidParam' + minItems: 1 + description: Description of invalid parameters, for a request rejected due to invalid parameters. + InvalidParam: + type: object + properties: + param: + type: string + description: Attribute's name encoded as a JSON Pointer, or header's name. + reason: + type: string + description: A human-readable reason, e.g. "must be a positive integer". + required: + - param + PlmnId: + type: object + properties: + mcc: + $ref: '#/components/schemas/Mcc' + mnc: + $ref: '#/components/schemas/Mnc' + required: + - mcc + - mnc + ConfigResult: + type: object + properties: + externalIds: + type: array + items: + $ref: '#/components/schemas/ExternalId' + minItems: 1 + description: Each element indicates an external identifier of the UE. + msisdns: + type: array + items: + $ref: '#/components/schemas/Msisdn' + minItems: 1 + description: Each element identifies the MS internal PSTN/ISDN number allocated for the UE. + resultReason: + $ref: '#/components/schemas/ResultReason' + required: + - resultReason + oneOf: + - required: [externalIds] + - required: [msisdns] + Bandwidth: + type: integer + minimum: 0 + description: integer indicating a bandwidth in bits per second. + BdtReferenceId: + type: string + description: string identifying a BDT Reference ID as defined in subclause 5.3.3 of 3GPP TS 29.154. + BdtReferenceIdRm: + type: string + description: This data type is defined in the same way as the BdtReferenceId data type, but with the nullable property set to true. + nullable: true + Binary: + type: string + description: string with format "binary" as defined in OpenAPI Specification. + Bytes: + type: string + description: String with format "byte" as defined in OpenAPI Specification, i.e, base64-encoded characters. + DayOfWeek: + type: integer + minimum: 1 + maximum: 7 + description: integer between and including 1 and 7 denoting a weekday. 1 shall indicate Monday, and the subsequent weekdays shall be indicated with the next higher numbers. 7 shall indicate Sunday. + DateTime: + type: string + description: string with format "date-time" as defined in OpenAPI. + DateTimeRm: + type: string + description: string with format "date-time" as defined in OpenAPI with "nullable=true" property. + nullable: true + DateTimeRo: + type: string + description: string with format "date-time" as defined in OpenAPI with "readOnly=true" property. + readOnly: true + DurationSec: + type: integer + minimum: 0 + description: Unsigned integer identifying a period of time in units of seconds. + DurationSecRm: + type: integer + minimum: 0 + description: Unsigned integer identifying a period of time in units of seconds with "nullable=true" property. + nullable: true + DurationSecRo: + type: integer + minimum: 0 + description: Unsigned integer identifying a period of time in units of seconds with "readOnly=true" property. + readOnly: true + DurationMin: + type: integer + format: int32 + minimum: 0 + description: Unsigned integer identifying a period of time in units of minutes. + ExternalId: + type: string + description: string containing a local identifier followed by "@" and a domain identifier. Both the local identifier and the domain identifier shall be encoded as strings that do not contain any "@" characters. See Clause 4.6.2 of 3GPP TS 23.682 for more information. + ExternalGroupId: + type: string + description: string containing a local identifier followed by "@" and a domain identifier. Both the local identifier and the domain identifier shall be encoded as strings that do not contain any "@" characters. See Clauses 4.6.2 and 4.6.3 of 3GPP TS 23.682 for more information. + Ipv4Addr: + type: string + description: string identifying a Ipv4 address formatted in the "dotted decimal" notation as defined in IETF RFC 1166. + Ipv6Addr: + type: string + description: string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. + Ipv4AddrRo: + type: string + description: string identifying a Ipv4 address formatted in the "dotted decimal" notation as defined in IETF RFC 1166, with "readOnly=true" property. + readOnly: true + Ipv6AddrRo: + type: string + description: string identifying a Ipv6 address formatted according to clause 4 in IETF RFC 5952, with "readOnly=true" property. The mixed Ipv4 Ipv6 notation according to clause 5 of IETF RFC 5952 shall not be used. + readOnly: true + Link: + type: string + description: string formatted according to IETF RFC 3986 identifying a referenced resource. + Mcc: + type: string + description: String encoding a Mobile Country Code part of the PLMN, comprising 3 digits, as defined in 3GPP TS 38.413. + Mnc: + type: string + description: String encoding a Mobile Network Code part of the PLMN, comprising 2 or 3 digits, as defined in 3GPP TS 38.413. + Msisdn: + type: string + description: string formatted according to subclause 3.3 of 3GPP TS 23.003 that describes an MSISDN. + Port: + type: integer + description: Unsigned integer with valid values between 0 and 65535. + minimum: 0 + maximum: 65535 + PortRo: + type: integer + description: Unsigned integer with valid values between 0 and 65535, with "readOnly=true" property. + minimum: 0 + maximum: 65535 + readOnly: true + ResourceId: + type: string + description: string chosen by the SCEF to serve as identifier in a resource URI. + ScsAsId: + type: string + description: string that identifies an SCS/AS. + TimeOfDay: + type: string + description: String with format partial-time or full-time as defined in subclause 5.6 of IETF RFC 3339. Examples, 20:15:00, 20:15:00-08:00 (for 8 hours behind UTC). + Uri: + type: string + description: string providing an URI formatted according to IETF RFC 3986. + Volume: + type: integer + format: int64 + minimum: 0 + description: Unsigned integer identifying a volume in units of bytes. + VolumeRm: + type: integer + format: int64 + minimum: 0 + description: Unsigned integer identifying a volume in units of bytes with "nullable=true" property. + nullable: true + Event: + anyOf: + - type: string + enum: + - SESSION_TERMINATION + - LOSS_OF_BEARER + - RECOVERY_OF_BEARER + - RELEASE_OF_BEARER + - USAGE_REPORT + - FAILED_RESOURCES_ALLOCATION + - 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 + - SESSION_TERMINATION: Indicates that Rx session is terminated. + - LOSS_OF_BEARER : Indicates a loss of a bearer. + - RECOVERY_OF_BEARER: Indicates a recovery of a bearer. + - RELEASE_OF_BEARER: Indicates a release of a bearer. + - USAGE_REPORT: Indicates the usage report event. + - FAILED_RESOURCES_ALLOCATION: Indicates the resource allocation is failed. + ResultReason: + anyOf: + - type: string + enum: + - ROAMING_NOT_ALLOWED + - OTHER_REASON + - type: string + description: > + This string provides a failure reason. + description: > + Possible values are + - ROAMING_NOT_ALLOWED: Identifies the configuration parameters are not allowed by roaming agreement. + - OTHER_REASON: Identifies the configuration parameters are not configured due to other reason. +# +# HTTP responses +# + responses: + '400': + description: Bad request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '401': + description: Unauthorized + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '406': + description: Not Acceptable + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '409': + description: Conflict + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '411': + description: Length Required + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '412': + description: Precondition Failed + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '413': + description: Payload Too Large + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '414': + description: URI Too Long + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '415': + description: Unsupported Media Type + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '429': + description: Too Many Requests + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + default: + description: Generic Error diff --git a/lib/sbi/support/3gpp-spec/TS29122_CpProvisioning.yaml b/lib/sbi/support/3gpp-spec/TS29122_CpProvisioning.yaml new file mode 100644 index 000000000..ad4c1c763 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_CpProvisioning.yaml @@ -0,0 +1,633 @@ +openapi: 3.0.0 +info: + title: 3gpp-cp-parameter-provisioning + version: 1.1.0.alpha-2 + description: | + API for provisioning communication pattern parameters. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-cp-parameter-provisioning/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/subscriptions: + get: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + responses: + '200': + description: OK. The subscription information related to the request URI is returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CpInfo' + minItems: 0 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + post: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + requestBody: + description: create new subscriptions for a given SCS/AS and the provisioning CP parameter sets. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CpInfo' + responses: + '201': + description: Created. The subscription was created successfully. The SCEF shall return the created subscription in the response payload body. + content: + application/json: + schema: + $ref: '#/components/schemas/CpInfo' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The CP parameters for all sets were not created successfully. CpReport may be included with detailed information. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CpReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/subscriptions/{subscriptionId}: + get: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. The subscription information related to the request URI is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/CpInfo' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + requestBody: + description: Modify a CP parameter provisioning subscription resource. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CpInfo' + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. The subscription was modified successfully. The SCEF shall return an updated subscription in the response payload body. + content: + application/json: + schema: + $ref: '#/components/schemas/CpInfo' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The CP parameters for all sets were not updated successfully. CpReport may be included with detailed information. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CpReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Subscription ID + required: true + schema: + type: string + responses: + '204': + description: No Content. The subscription was deleted successfully. The payload body shall be empty. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/subscriptions/{subscriptionId}/cpSets/{setId}: + get: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Subscription ID + required: true + schema: + type: string + - name: setId + in: path + description: Identifier of the CP parameter set + required: true + schema: + type: string + responses: + '200': + description: OK. The subscription information related to the request URI is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/CpParameterSet' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + requestBody: + description: Change information for a CP parameter set. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CpParameterSet' + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Subscription ID + required: true + schema: + type: string + - name: setId + in: path + description: Identifier of the CP parameter set + required: true + schema: + type: string + responses: + '200': + description: OK. The CP parameter set resource was modified successfully. The SCEF shall return an updated CP parameter set resource in the response payload body. + content: + application/json: + schema: + $ref: '#/components/schemas/CpParameterSet' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '409': + description: The CP parameters for the CP set were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/CpReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The CP parameters for the CP set were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/CpReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Subscription ID + required: true + schema: + type: string + - name: setId + in: path + description: Identifier of the CP parameter set + required: true + schema: + type: string + responses: + '204': + description: No Content. The subscription was deleted successfully. The payload body shall be empty. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + CpInfo: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + mtcProviderId: + type: string + description: Identifies the MTC Service Provider and/or MTC Application. + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + cpParameterSets: + type: object + additionalProperties: + $ref: '#/components/schemas/CpParameterSet' + minProperties: 1 + description: Identifies a set of CP parameter information that may be part of this CpInfo structure. + cpReports: + type: object + additionalProperties: + $ref: '#/components/schemas/CpReport' + minProperties: 1 + description: Supplied by the SCEF and contains the CP set identifiers for which CP parameter(s) are not added or modified successfully. The failure reason is also included. Each element provides the related information for one or more CP set identifier(s) and is identified in the map via the failure identifier as key. + readOnly: true + required: + - cpParameterSets + oneOf: + - required: [externalId] + - required: [msisdn] + - required: [externalGroupId] + CpParameterSet: + type: object + properties: + setId: + type: string + description: SCS/AS-chosen correlator provided by the SCS/AS in the request to create a resource fo CP parameter set(s). + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + validityTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + periodicCommunicationIndicator: + $ref: '#/components/schemas/CommunicationIndicator' + communicationDurationTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + periodicTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + scheduledCommunicationTime: + $ref: '#/components/schemas/ScheduledCommunicationTime' + scheduledCommunicationType: + $ref: '#/components/schemas/ScheduledCommunicationType' + stationaryIndication: + $ref: '#/components/schemas/StationaryIndication' + batteryInds: + type: array + items: + $ref: '#/components/schemas/BatteryIndication' + minItems: 1 + trafficProfile: + $ref: '#/components/schemas/TrafficProfile' + expectedUmts: + type: array + items: + $ref: '#/components/schemas/UmtLocationArea5G' + minItems: 1 + description: Identifies the UE's expected geographical movement. The attribute is only applicable in 5G. + expectedUmtDays: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DayOfWeek' + required: + - setId + ScheduledCommunicationTime: + type: object + properties: + daysOfWeek: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DayOfWeek' + minItems: 1 + maxItems: 6 + description: Identifies the day(s) of the week. If absent, it indicates every day of the week. + timeOfDayStart: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeOfDay' + timeOfDayEnd: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeOfDay' + CpReport: + type: object + properties: + setIds: + type: array + items: + type: string + minItems: 1 + description: Identifies the CP set identifier(s) which CP parameter(s) are not added or modified successfully + failureCode: + $ref: '#/components/schemas/CpFailureCode' + required: + - failureCode + UmtLocationArea5G: + allOf: + - $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + - type: object + properties: + umtTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeOfDay' + umtDuration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + CommunicationIndicator: + anyOf: + - type: string + enum: + - PERIODICALLY + - ON_DEMAND + - 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 + - PERIODICALLY: Identifies the UE communicates periodically + - ON_DEMAND: Identifies the UE communicates on demand + StationaryIndication: + anyOf: + - type: string + enum: + - STATIONARY + - MOBILE + - 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 + - STATIONARY: Identifies the UE is stationary + - MOBILE: Identifies the UE is mobile + CpFailureCode: + anyOf: + - type: string + enum: + - MALFUNCTION + - SET_ID_DUPLICATED + - OTHER_REASON + - 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 + - MALFUNCTION: This value indicates that something functions wrongly in CP parameter provisioning or the CP parameter provisioning does not function at all. + - SET_ID_DUPLICATED: The received CP set identifier(s) are already provisioned. + - OTHER_REASON: Other reason unspecified. + BatteryIndication: + anyOf: + - type: string + enum: + - BATTERY_RECHARGE + - BATTERY_REPLACE + - BATTERY_NO_RECHARGE + - BATTERY_NO_REPLACE + - NO_BATTERY + - 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 + - BATTERY_RECHARGE: UE powered with rechargeable battery. + - BATTERY_REPLACE: UE powered with replaceable battery. + - BATTERY_NO_RECHARGE: UE powered with no rechargeable battery. + - BATTERY_NO_REPLACE: UE powered with no replaceable battery. + - NO_BATTERY: UE not battery powered. + TrafficProfile: + anyOf: + - type: string + enum: + - SINGLE_TRANS_UL + - SINGLE_TRANS_DL + - DUAL_TRANS_UL_FIRST + - DUAL_TRANS_DL_FIRST + - MULTI_TRANS + - 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 + - SINGLE_TRANS_UL: Uplink single packet transmission. + - SINGLE_TRANS_DL: Downlink single packet transmission. + - DUAL_TRANS_UL_FIRST: Dual packet transmission, firstly uplink packet transmission with subsequent downlink packet transmission. + - DUAL_TRANS_DL_FIRST: Dual packet transmission, firstly downlink packet transmission with subsequent uplink packet transmission. + - MULTI_TRANS: Multiple packet transmission. + ScheduledCommunicationType: + anyOf: + - type: string + enum: + - DOWNLINK + - UPLINK + - BIDIRECTIONAL + - 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 + - DOWNLINK: Downlink only. + - UPLINK: Uplink only. + - BIDIRECTIONAL: Bi-directional. diff --git a/lib/sbi/support/3gpp-spec/TS29122_DeviceTriggering.yaml b/lib/sbi/support/3gpp-spec/TS29122_DeviceTriggering.yaml new file mode 100644 index 000000000..9916e31b9 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_DeviceTriggering.yaml @@ -0,0 +1,393 @@ +openapi: 3.0.0 +info: + title: 3gpp-device-triggering + version: 1.0.2 + description: | + API for device trigger. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-device-triggering/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/transactions: + get: + summary: read all active device triggering transactions for a given SCS/AS. + tags: + - Device Triggering API SCS/AS level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ScsAsId' + responses: + '200': + description: OK (Successful get all of the active device triggering transactions for the SCS/AS) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/DeviceTriggering' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + post: + summary: Create a long-term transaction for a device triggering. + tags: + - DeviceTriggering API Transaction level POST Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ScsAsId' + requestBody: + description: Parameters to request a device triggering delivery. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceTriggering' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceTriggeringDeliveryReportNotification' + responses: + '200': + description: OK (successful notification) + content: + application/json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Acknowledgement' + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Created (Successful creation of subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceTriggering' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/transactions/{transactionId}: + get: + summary: Read a device triggering transaction resource. + tags: + - DeviceTriggering API Transaction level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ScsAsId' + - name: transactionId + in: path + description: Identifier of the transaction resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceTriggering' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + summary: Replace an existing device triggering transaction resource and the corresponding device trigger request. + tags: + - DeviceTriggering API transaction level PUT Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ScsAsId' + - name: transactionId + in: path + description: Identifier of the transaction resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing device triggering + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceTriggering' + responses: + '200': + description: OK (Successful update of the device triggering) + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceTriggering' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes an already existing device triggering transaction. + tags: + - DeviceTriggering API Transaction level DELETE Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ScsAsId' + - name: transactionId + in: path + description: Identifier of the transaction resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '200': + description: OK (Successful deletion of the existing subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceTriggering' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + DeviceTriggering: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + validityPeriod: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + priority: + $ref: '#/components/schemas/Priority' + applicationPortId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Port' + appSrcPortId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Port' + triggerPayload: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + deliveryResult: + $ref: '#/components/schemas/DeliveryResult' + required: + - validityPeriod + - priority + - applicationPortId + - triggerPayload + - notificationDestination + oneOf: + - required: [externalId] + - required: [msisdn] + DeviceTriggeringDeliveryReportNotification: + type: object + properties: + transaction: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + result: + $ref: '#/components/schemas/DeliveryResult' + required: + - transaction + - result + DeliveryResult: + anyOf: + - type: string + enum: + - SUCCESS + - UNKNOWN + - FAILURE + - TRIGGERED + - EXPIRED + - UNCONFIRMED + - REPLACED + - TERMINATE + - 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 + - SUCCESS: This value indicates that the device action request was successfully completed. + - UNKNOWN: This value indicates any unspecified errors. + - FAILURE: This value indicates that this trigger encountered a delivery error and is deemed permanently undeliverable. + - TRIGGERED: This value indicates that device triggering request is accepted by the SCEF. + - EXPIRED: This value indicates that the validity period expired before the trigger could be delivered. + - UNCONFIRMED: This value indicates that the delivery of the device action request is not confirmed. + - REPLACED: This value indicates that the device triggering replacement request is accepted by the SCEF. + - TERMINATE: This value indicates that the delivery of the device action request is terminated by the SCS/AS. + readOnly: true + Priority: + anyOf: + - type: string + enum: + - NO_PRIORITY + - PRIORITY + - 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 + - NO_PRIORITY: This value indicates that the device trigger has no priority. + - PRIORITY: This value indicates that the device trigger has priority. diff --git a/lib/sbi/support/3gpp-spec/TS29122_ECRControl.yaml b/lib/sbi/support/3gpp-spec/TS29122_ECRControl.yaml new file mode 100644 index 000000000..9d91eb21b --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_ECRControl.yaml @@ -0,0 +1,158 @@ +openapi: 3.0.0 +info: + title: 3gpp-ecr-control + version: 1.0.1 + description: | + API for enhanced converage restriction control. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V15.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-ecr-control/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /query: + post: + summary: Query the status of enhanced converage restriction for a UE. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ECRControl' + responses: + '200': + description: The requested information was returned successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ECRData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /configure: + post: + summary: Configure the enhanced converage restriction for a UE. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ECRControl' + responses: + '200': + description: The Enhanced Coverage Restriction setting was configured successfully.. + content: + application/json: + schema: + $ref: '#/components/schemas/ECRData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + ECRControl: + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + restrictedPlmnIds: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PlmnId' + minItems: 0 + description: Indicates a complete list (and possibly empty) of serving PLMNs where Enhanced Coverage shall be restricted. This attribute shall not be present for the query custom operation. + allowedPlmnIds: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PlmnId' + minItems: 0 + description: Indicates a complete list (and possibly empty) of serving PLMNs where Enhanced Coverage shall be allowed. This attribute shall not be present for the query custom operation. + required: + - supportedFeatures + oneOf: + - required: [externalId] + - required: [msisdn] + not: + required: [restrictedPlmnIds, allowedPlmnIds] + ECRData: + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + visitedPlmnId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PlmnId' + restrictedPlmnIds: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PlmnId' + minItems: 0 + description: Indicates a complete list (and possibly empty) of serving PLMNs where Enhanced Coverage shall be restricted. + allowedPlmnIds: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PlmnId' + minItems: 0 + description: Indicates a complete list (and possibly empty) of serving PLMNs where Enhanced Coverage shall be allowed. + required: + - supportedFeatures + not: + required: [restrictedPlmnIds, allowedPlmnIds] \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29122_GMDviaMBMSbyMB2.yaml b/lib/sbi/support/3gpp-spec/TS29122_GMDviaMBMSbyMB2.yaml new file mode 100644 index 000000000..ecf8b6981 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_GMDviaMBMSbyMB2.yaml @@ -0,0 +1,771 @@ +openapi: 3.0.0 +info: + title: GMDviaMBMSbyMB2 + description: | + API for Group Message Delivery via MBMS by MB2 + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: 1.0.1 +externalDocs: + description: 3GPP TS 29.122 V15.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-group-message-delivery-mb2/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/tmgi-allocation: + get: + summary: read all TMGI Allocation resource for a given SCS/AS + tags: + - TMGI Allocatin Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of TMGI Allocation resource) + content: + application/json: + schema: + $ref: '#/components/schemas/TMGIAllocation' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: creates a new TMGI Allocation resource for a given SCS/AS + tags: + - TMGI Allocatin Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + requestBody: + description: representation of the TMGI Allocation to be created in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TMGIAllocation' + responses: + '201': + description: successful creation of an TMGI Allocation + content: + application/json: + schema: + $ref: '#/components/schemas/TMGIAllocation' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/tmgi-allocation/{tmgi}: + get: + summary: read a TMGI Allocation resource for a given SCS/AS and a TMGI + tags: + - Individual TMGI Allocatin Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of TMGI Allocation resource) + content: + application/json: + schema: + $ref: '#/components/schemas/TMGIAllocation' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates an existing TMGI Allocation resource for a given SCS/AS and a TMGI + tags: + - Individual TMGI Allocatin Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + requestBody: + description: representation of the TMGI Allocation to be updated in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TMGIAllocation' + responses: + '200': + description: successful creation of an TMGI Allocation + content: + application/json: + schema: + $ref: '#/components/schemas/TMGIAllocation' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates an existing TMGI Allocation resource for a given SCS/AS and a TMGI + tags: + - Individual TMGI Allocatin Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + requestBody: + description: representation of the TMGI Allocation to be updated in the SCEF + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/TMGIAllocationPatch' + responses: + '200': + description: successful creation of an TMGI Allocation + content: + application/json: + schema: + $ref: '#/components/schemas/TMGIAllocation' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: deletes an existing TMGI Allocation resource for a given SCS/AS and a TMGI + tags: + - Individual TMGI Allocatin Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + responses: + '204': + description: No Content, successful deletion of an TMGI Allocation + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/tmgi-allocation/{tmgi}/delivery-via-mbms/: + get: + summary: read all group message delivery via MBMS resource for a given SCS/AS and a TMGI + tags: + - Delivery via MBMS Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of Delivery via MBMS resource) + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new delivery via MBMS for a given SCS/AS and a TMGI + tags: + - Delivery via MBMS Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + requestBody: + description: representation of the GMD via MBMS by MB2 resource to be Created in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2' + callbacks: + gMDByMb2Notification: + '{$request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GMDByMb2Notification' + responses: + '200': + description: OK (The successful acknowledgement of the notification with a body) + content: + application/json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Acknowledgement' + '204': + description: successful notification + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: successful creation of an GMD via MBMS by MB2 resource + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/tmgi-allocation/{tmgi}/delivery-via-mbms/{transactionId}: + get: + summary: read all group message delivery via MBMS resource for a given SCS/AS and a TMGI + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of an Delivery via MBMS resource) + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates a existing delivery via MBMS for a given SCS/AS, a TMGI and transaction Id. + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + requestBody: + description: representation of the GMD via MBMS by MB2 resource to be udpated in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2' + responses: + '200': + description: successful update of an individual GMD via MBMS by MB2 resource + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates a existing delivery via MBMS for a given SCS/AS, a TMGI and transaction Id. + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + requestBody: + description: representation of the GMD via MBMS by MB2 resource to be udpated in the SCEF + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2Patch' + responses: + '200': + description: successful update of an individual GMD via MBMS by MB2 resource + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByMb2' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: deletes a delivery via MBMS resource for a given SCS/AS, a TMGI and a transcation Id. + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: tmgi + in: path + description: TMGI + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + responses: + '204': + description: No Content, successful deletion of an resouce of deliery via MBMS + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + TMGIAllocation: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + mbmsLocArea: + $ref: '#/components/schemas/MbmsLocArea' + tmgiExpiration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTimeRo' + GMDViaMBMSByMb2: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + mbmsLocArea: + $ref: '#/components/schemas/MbmsLocArea' + messageDeliveryStartTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + groupMessagePayload: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + scefMessageDeliveryIPv4: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4AddrRo' + scefMessageDeliveryIPv6: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6AddrRo' + scefMessageDeliveryPort: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PortRo' + required: + - notificationDestination + GMDByMb2Notification: + type: object + properties: + transaction: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + deliveryTriggerStatus: + type: boolean + description: Indicates whether delivery of group message payload corresponding to the TMGI was successful (TRUE) or not (FALSE) + required: + - transaction + - deliveryTriggerStatus + TMGIAllocationPatch: + type: object + properties: + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + mbmsLocArea: + $ref: '#/components/schemas/MbmsLocArea' + GMDViaMBMSByMb2Patch: + type: object + properties: + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + mbmsLocArea: + $ref: '#/components/schemas/MbmsLocArea' + messageDeliveryStartTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + groupMessagePayload: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + MbmsLocArea: + type: object + properties: + cellId: + type: array + items: + type: string + minItems: 1 + description: Indicates a Cell Global Identification of the user which identifies the cell the UE is registered. + enodeBId: + type: array + items: + type: string + minItems: 1 + description: Indicates an eNodeB in which the UE is currently located. + geographicArea: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + minItems: 1 + description: Identifies a geographic area of the user where the UE is located. + mbmsServiceAreaId: + type: array + items: + type: string + minItems: 1 + description: Identifies an MBMS Service Area Identity of the user where the UE is located. + civicAddress: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CivicAddress' + minItems: 1 + description: Identifies a civic address of the user where the UE is located. \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29122_GMDviaMBMSbyxMB.yaml b/lib/sbi/support/3gpp-spec/TS29122_GMDviaMBMSbyxMB.yaml new file mode 100644 index 000000000..12c3847c6 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_GMDviaMBMSbyxMB.yaml @@ -0,0 +1,705 @@ +openapi: 3.0.0 +info: + title: GMDviaMBMSbyxMB + description: | + API for Group Message Delivery via MBMS by xMB + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: 1.0.1 +externalDocs: + description: 3GPP TS 29.122 V15.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-group-message-delivery-xmb/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/services/: + get: + summary: read all service resources for a given SCS/AS + tags: + - Service Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of service creation resource) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ServiceCreation' + minItems: 0 + description: The service resource for the SCS/AS in the request URI is returned. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: creates a new service creation resource for a given SCS/AS + tags: + - Service Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + requestBody: + description: representation of the service to be created in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceCreation' + responses: + '201': + description: successful creation of a service + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceCreation' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/services/{serviceId}: + get: + summary: read a service resource for a given SCS/AS and a Service Id + tags: + - Individual Service Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of service resource) + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceCreation' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: deletes an existing service resource for a given SCS/AS and a service id + tags: + - Individual service Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + responses: + '204': + description: No Content, successful deletion of a service resource + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/services/{serviceId}/delivery-via-mbms: + get: + summary: read all group message delivery via MBMS resource for a given SCS/AS and a service id + tags: + - Delivery via MBMS Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of Delivery via MBMS resource) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/GMDViaMBMSByxMB' + minItems: 0 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new delivery via MBMS for a given SCS/AS and a service Id + tags: + - Delivery via MBMS Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + requestBody: + description: representation of the GMD via MBMS by xMB resource to be Created in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByxMB' + callbacks: + gMDByxMBNotification: + '{$request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GMDByxMBNotification' + responses: + '200': + description: OK (The successful acknowledgement of the notification with a body) + content: + application/json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Acknowledgement' + '204': + description: successful notification + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: successful creation of an GMD via MBMS by xMB resource + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByxMB' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/services/{serviceId}/delivery-via-mbms/{transactionId}: + get: + summary: read all group message delivery via MBMS resource for a given SCS/AS and a service Id + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + responses: + '200': + description: OK (successful query of an Delivery via MBMS resource) + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByxMB' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates an existing delivery via MBMS for a given SCS/AS, a service Id and transaction Id. + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + requestBody: + description: representation of the GMD via MBMS by xMB resource to be udpated in the SCEF + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByxMB' + responses: + '200': + description: successful update of an individual GMD via MBMS by xMB resource + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByxMB' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates an existing delivery via MBMS for a given SCS/AS, a service Id and transaction Id. + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + requestBody: + description: representation of the GMD via MBMS by xMB resource to be udpated in the SCEF + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByxMBPatch' + responses: + '200': + description: successful update of an individual GMD via MBMS by xMB resource + content: + application/json: + schema: + $ref: '#/components/schemas/GMDViaMBMSByxMB' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: deletes a delivery via MBMS resource for a given SCS/AS, a service Id and a transcation Id. + tags: + - Individual Delivery via MBMS resource Operation + parameters: + - name: scsAsId + in: path + description: Identifier of SCS/AS + required: true + schema: + type: string + - name: serviceId + in: path + description: Service Id + required: true + schema: + type: string + - name: transactionId + in: path + description: Identifier of transaction + required: true + schema: + type: string + responses: + '204': + description: No Content, successful deletion of an resouce of deliery via MBMS + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + ServiceCreation: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + userServiceId: + type: string + description: Identifies the MBMS User Service supplied by the SCEF. + readOnly: true + serviceClass: + type: string + description: The service class that service belongs to supplied by the SCEF. + readOnly: true + serviceLanguages: + type: array + items: + type: string + minItems: 1 + description: List of language of the service content supplied by the SCEF. + readOnly: true + serviceNames: + type: array + items: + type: string + minItems: 1 + description: List of Service Names supplied by the SCEF. + readOnly: true + receiveOnlyMode: + type: boolean + description: When set to 'true', the Content Provider indicates that the service is a Receive Only Mode service. This parameter is supplied by the SCEF. + readOnly: true + serviceAnnouncementMode: + $ref: '#/components/schemas/ServiceAnnouncementMode' + GMDViaMBMSByxMB: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + mbmsLocArea: + $ref: '#/components/schemas/MbmsLocArea' + messageDeliveryStartTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + messageDeliveryStopTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + groupMessagePayload: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + scefMessageDeliveryIPv4: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4AddrRo' + scefMessageDeliveryIPv6: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6AddrRo' + scefMessageDeliveryPort: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PortRo' + required: + - scsAsId + - notificationDestination + GMDByxMBNotification: + type: object + properties: + transaction: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + deliveryTriggerStatus: + type: boolean + description: Indicates whether delivery of group message payload was successful(TRUE) or not (FALSE) + required: + - transaction + - deliveryTriggerStatus + GMDViaMBMSByxMBPatch: + type: object + properties: + mbmsLocArea: + $ref: '#/components/schemas/MbmsLocArea' + messageDeliveryStartTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + messageDeliveryStopTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + groupMessagePayload: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + MbmsLocArea: + type: object + properties: + cellId: + type: array + items: + type: string + minItems: 1 + description: Indicates a Cell Global Identification of the user which identifies the cell the UE is registered. + enodeBId: + type: array + items: + type: string + minItems: 1 + description: Indicates an eNodeB in which the UE is currently located. + geographicArea: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + minItems: 1 + description: Identifies a geographic area of the user where the UE is located. + mbmsServiceAreaId: + type: array + items: + type: string + minItems: 1 + description: Identifies an MBMS Service Area Identity of the user where the UE is located. + civicAddress: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CivicAddress' + minItems: 1 + description: Identifies a civic address of the user where the UE is located. + ServiceAnnouncementMode: + anyOf: + - type: string + enum: + - SACH + - CONTENT_PROVIDER + - 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 + - SACH: BM-SC performs the service announcement for the current service using the SACH channel. + - CONTENT_PROVIDER: BM-SC provides the necessary service access information used by the Content Provider to create the service announcement information. + readOnly: true \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29122_MonitoringEvent.yaml b/lib/sbi/support/3gpp-spec/TS29122_MonitoringEvent.yaml new file mode 100644 index 000000000..a0282715f --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_MonitoringEvent.yaml @@ -0,0 +1,769 @@ +openapi: 3.0.0 +info: + title: 3gpp-monitoring-event + version: 1.1.0.alpha-5 + description: | + API for Monitoring Event. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.5.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-monitoring-event/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/subscriptions: + get: + summary: read all of the active subscriptions for the SCS/AS + tags: + - MonitoringEvent API SCS/AS level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get all of the active subscriptions for the SCS/AS) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/MonitoringEventSubscription' + minItems: 0 + description: Monitoring event subscriptions + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new subscription resource for monitoring event notification + tags: + - MonitoringEvent API Subscription level POST Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + requestBody: + description: Subscription for notification about monitoring event + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MonitoringEventSubscription' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MonitoringNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Created (Successful creation of subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/MonitoringEventSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '200': + description: The operation is successful and immediate report is included. + content: + application/json: + schema: + $ref: '#/components/schemas/MonitoringEventReport' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/subscriptions/{subscriptionId}: + get: + summary: read an active subscriptions for the SCS/AS and the subscription Id + tags: + - MonitoringEvent API Subscription level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/MonitoringEventSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing subscription resource + tags: + - MonitoringEvent API subscription level PUT Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MonitoringEventSubscription' + responses: + '200': + description: OK (Successful update of the subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/MonitoringEventSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing monitoring event subscription + tags: + - MonitoringEvent API Subscription level DELETE Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '200': + description: OK (Successful deletion of the existing subscription) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/MonitoringEventReport' + minItems: 1 + description: The subscription was terminated successfully, the monitoring event report(s) shall be included if received. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + MonitoringEventSubscription: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + mtcProviderId: + type: string + description: Identifies the MTC Service Provider and/or MTC Application. + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + addExtGroupId: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + minItems: 2 + ipv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr : + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + monitoringType: + $ref: '#/components/schemas/MonitoringType' + maximumNumberOfReports: + type: integer + minimum: 1 + description: Identifies the maximum number of event reports to be generated by the HSS, MME/SGSN as specified in subclause 5.6.0 of 3GPP TS 23.682 [2]. + monitorExpireTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + groupReportGuardTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + maximumDetectionTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + reachabilityType: + $ref: '#/components/schemas/ReachabilityType' + maximumLatency: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + maximumResponseTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + suggestedNumberOfDlPackets: + type: integer + minimum: 0 + description: If "monitoringType" is "UE_REACHABILITY", this parameter may be included to identify the number of packets that the serving gateway shall buffer in case that the UE is not reachable. + idleStatusIndication: + type: boolean + description: If "monitoringType" is set to "UE_REACHABILITY" or "AVAILABILITY_AFTER_DDN_FAILURE", this parameter may be included to indicate the notification of when a UE, for which PSM is enabled, transitions into idle mode. - "true" indicate enabling of notification - "false" indicate no need to notify Default "false". + locationType: + $ref: '#/components/schemas/LocationType' + accuracy: + $ref: '#/components/schemas/Accuracy' + minimumReportInterval: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + associationType: + $ref: '#/components/schemas/AssociationType' + plmnIndication: + type: boolean + description: If "monitoringType" is "ROAMING_STATUS", this parameter may be included to indicate the notification of UE's Serving PLMN ID. - "true" The value shall be used to indicate enabling of notification; - "false" The value shall be used to indicate disabling of notification. Default "false". + locationArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea' + locationArea5G: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + dddTraDescriptors: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' + minItems: 1 + dddStati: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DlDataDeliveryStatus' + minItems: 1 + apiNames: + type: array + items: + type: string + minItems: 1 + monitoringEventReport: + $ref: '#/components/schemas/MonitoringEventReport' + required: + - notificationDestination + - monitoringType + anyOf: + - required: [maximumNumberOfReports] + - required: [monitorExpireTime] + MonitoringNotification: + type: object + properties: + subscription: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + configResults: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ConfigResult' + minItems: 1 + description: Each element identifies a notification of grouping configuration result. + monitoringEventReports: + type: array + items: + $ref: '#/components/schemas/MonitoringEventReport' + minItems: 1 + description: Monitoring event reports. + cancelInd: + type: boolean + description: Indicates whether to request to cancel the corresponding monitoring subscription. Set to false or omitted otherwise. + appliedParam: + $ref: '#/components/schemas/AppliedParameterConfiguration' + required: + - subscription + MonitoringEventReport: + type: object + properties: + imeiChange: + $ref: '#/components/schemas/AssociationType' + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + idleStatusInfo: + $ref: '#/components/schemas/IdleStatusInfo' + locationInfo: + $ref: '#/components/schemas/LocationInfo' + lossOfConnectReason: + type: integer + description: If "monitoringType" is "LOSS_OF_CONNECTIVITY", this parameter shall be included if available to identify the reason why loss of connectivity is reported. Refer to 3GPP TS 29.336 [11] Subclause 8.4.58. + maxUEAvailabilityTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + monitoringType: + $ref: '#/components/schemas/MonitoringType' + uePerLocationReport: + $ref: '#/components/schemas/UePerLocationReport' + plmnId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/PlmnId' + reachabilityType: + $ref: '#/components/schemas/ReachabilityType' + roamingStatus: + type: boolean + description: If "monitoringType" is "ROAMING_STATUS", this parameter shall be set to "true" if the UE is on roaming status. Set to false or omitted otherwise. + failureCause: + $ref: '#/components/schemas/FailureCause' + eventTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + pdnConnInfo: + $ref: '#/components/schemas/PdnConnectionInformation' + dddStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DlDataDeliveryStatus' + dddTrafDescriptor: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' + maxWaitTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + apiCaps: + type: array + items: + $ref: '#/components/schemas/ApiCapabilityInfo' + required: + - monitoringType + IdleStatusInfo: + type: object + properties: + activeTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + edrxCycleLength: + format: float + type: number + minimum: 0 + suggestedNumberOfDlPackets: + type: integer + minimum: 0 + description: Identifies the number of packets shall be buffered in the serving gateway. It shall be present if the idle status indication is requested by the SCS/AS with "idleStatusIndication" in the "monitoringEventSubscription" sets to "true". + idleStatusTimestamp: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + periodicAUTimer: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + UePerLocationReport: + type: object + properties: + ueCount: + type: integer + minimum: 0 + description: Identifies the number of UEs. + externalIds: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + minItems: 1 + description: Each element uniquely identifies a user. + msisdns: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + minItems: 1 + description: Each element identifies the MS internal PSTN/ISDN number allocated for a UE. + required: + - ueCount + LocationInfo: + type: object + properties: + ageOfLocationInfo: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationMin' + cellId: + type: string + description: Indicates the Cell Global Identification of the user which identifies the cell the UE is registered. + enodeBId: + type: string + description: Indicates the eNodeB in which the UE is currently located. + routingAreaId: + type: string + description: Identifies the Routing Area Identity of the user where the UE is located. + trackingAreaId: + type: string + description: Identifies the Tracking Area Identity of the user where the UE is located. + plmnId: + type: string + description: Identifies the PLMN Identity of the user where the UE is located. + twanId: + type: string + description: Identifies the TWAN Identity of the user where the UE is located. + geographicArea: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + FailureCause: + type: object + properties: + bssgpCause: + type: integer + description: Identifies a non-transparent copy of the BSSGP cause code. Refer to 3GPP TS 29.128 [12]. + causeType: + type: integer + description: Identify the type of the S1AP-Cause. Refer to 3GPP TS 29.128 [12]. + gmmCause: + type: integer + description: Identifies a non-transparent copy of the GMM cause code. Refer to 3GPP TS 29.128 [12]. + ranapCause: + type: integer + description: Identifies a non-transparent copy of the RANAP cause code. Refer to 3GPP TS 29.128 [12]. + ranNasCause: + type: string + description: Indicates RAN and/or NAS release cause code information, TWAN release cause code information or untrusted WLAN release cause code information. Refer to 3GPP TS 29.214 [10]. + s1ApCause: + type: integer + description: Identifies a non-transparent copy of the S1AP cause code. Refer to 3GPP TS 29.128 [12]. + smCause: + type: integer + description: Identifies a non-transparent copy of the SM cause code. Refer to 3GPP TS 29.128 [12]. + PdnConnectionInformation: + type: object + properties: + status: + $ref: '#/components/schemas/PdnConnectionStatus' + apn: + type: string + description: Identify the APN, it is depending on the SCEF local configuration whether or not this attribute is sent to the SCS/AS. + pdnType: + $ref: '#/components/schemas/PdnType' + interfaceInd: + $ref: '#/components/schemas/InterfaceIndication' + ipv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addrs: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + required: + - status + - pdnType + AppliedParameterConfiguration: + type: object + properties: + externalIds: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + minItems: 1 + description: Each element uniquely identifies a user. + msisdns: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + minItems: 1 + description: Each element identifies the MS internal PSTN/ISDN number allocated for a UE. + maximumLatency: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + maximumResponseTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + maximumDetectionTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + ApiCapabilityInfo: + type: object + properties: + apiName: + type: string + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - apiName + - suppFeat + MonitoringType: + anyOf: + - type: string + enum: + - LOSS_OF_CONNECTIVITY + - UE_REACHABILITY + - LOCATION_REPORTING + - CHANGE_OF_IMSI_IMEI_ASSOCIATION + - ROAMING_STATUS + - COMMUNICATION_FAILURE + - AVAILABILITY_AFTER_DDN_FAILURE + - NUMBER_OF_UES_IN_AN_AREA + - PDN_CONNECTIVITY_STATUS + - DOWNLINK_DATA_DELIVERY_STATUS + - API_SUPPORT_CAPABILITY + - 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 + - LOSS_OF_CONNECTIVITY: The SCS/AS requests to be notified when the 3GPP network detects that the UE is no longer reachable for signalling or user plane communication + - UE_REACHABILITY: The SCS/AS requests to be notified when the UE becomes reachable for sending either SMS or downlink data to the UE + - LOCATION_REPORTING: The SCS/AS requests to be notified of the current location or the last known location of the UE + - CHANGE_OF_IMSI_IMEI_ASSOCIATION: The SCS/AS requests to be notified when the association of an ME (IMEI(SV)) that uses a specific subscription (IMSI) is changed + - ROAMING_STATUS: The SCS/AS queries the UE's current roaming status and requests to get notified when the status changes + - COMMUNICATION_FAILURE: The SCS/AS requests to be notified of communication failure events + - AVAILABILITY_AFTER_DDN_FAILURE: The SCS/AS requests to be notified when the UE has become available after a DDN failure + - NUMBER_OF_UES_IN_AN_AREA: The SCS/AS requests to be notified the number of UEs in a given geographic area + - PDN_CONNECTIVITY_STATUS: The SCS/AS requests to be notified when the 3GPP network detects that the UE's PDN connection is set up or torn down + - DOWNLINK_DATA_DELIVERY_STATUS: The AF requests to be notified when the 3GPP network detects that the downlink data delivery status is changed. + - API_SUPPORT_CAPABILITY: The SCS/AS requests to be notified of the availability of support of service APIs. + ReachabilityType: + anyOf: + - type: string + enum: + - SMS + - DATA + - 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 + - SMS : The SCS/AS requests to be notified when the UE becomes reachable for sending SMS to the UE + - DATA: The SCS/AS requests to be notified when the UE becomes reachable for sending downlink data to the UE + LocationType: + anyOf: + - type: string + enum: + - CURRENT_LOCATION + - LAST_KNOWN_LOCATION + - 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 + - CURRENT_LOCATION: The SCS/AS requests to be notified for current location + - LAST_KNOWN_LOCATION: The SCS/AS requests to be notified for last known location + AssociationType: + anyOf: + - type: string + enum: + - IMEI + - IMEISV + - 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 + - IMEI: The value shall be used when the change of IMSI-IMEI association shall be detected + - IMEISV: The value shall be used when the change of IMSI-IMEISV association shall be detected + Accuracy: + anyOf: + - type: string + enum: + - CGI_ECGI + - ENODEB + - TA_RA + - PLMN + - TWAN_ID + - GEO_AREA + - 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 + - CGI_ECGI: The SCS/AS requests to be notified at cell level location accuracy. + - ENODEB: The SCS/AS requests to be notified at eNodeB level location accuracy. + - TA_RA: The SCS/AS requests to be notified at TA/RA level location accuracy. + - PLMN: The SCS/AS requests to be notified at PLMN level location accuracy. + - TWAN_ID: The SCS/AS requests to be notified at TWAN identifier level location accuracy. + - GEO_AREA: The SCS/AS requests to be notified of the geographical area accuracy. + PdnConnectionStatus: + anyOf: + - type: string + enum: + - CREATED + - RELEASED + - 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 + - CREATED: The PDN connection is created. + - RELEASED: The PDN connection is released. + PdnType: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - IPV4V6 + - NON_IP + - ETHERNET + - 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 + - IPV4: PDN connection of IPv4 type. + - IPV6: PDN connection of IPv6 type. + - IPV4V6: PDN connection of IPv4v6 type. + - NON_IP: PDN connection of non-IP type. + - ETHERNET: PDN connection of Ethernet type. + InterfaceIndication: + anyOf: + - type: string + enum: + - EXPOSURE_FUNCTION + - PDN_GATEWAY + - 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 + - EXPOSURE_FUNCTION: SCEF is used for the PDN connection towards the SCS/AS. + - PDN_GATEWAY: PDN gateway is used for the PDN connection towards the SCS/AS. diff --git a/lib/sbi/support/3gpp-spec/TS29122_MsisdnLessMoSms.yaml b/lib/sbi/support/3gpp-spec/TS29122_MsisdnLessMoSms.yaml new file mode 100644 index 000000000..8d01eea8f --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_MsisdnLessMoSms.yaml @@ -0,0 +1,92 @@ +openapi: 3.0.0 +info: + title: 3gpp-msisdn-less-mo-sms + version: 1.0.1 + description: | + API for MSISDN-less Mobile Originated SMS. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V15.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /: + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MsisdnLessMoSmsNotification' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/MsisdnLessMoSmsNotificationReply' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + MsisdnLessMoSmsNotification: + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + sms: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + externalId: + type: string + description: External identifier has the form username@realm. + applicationPort: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Port' + required: + - supportedFeatures + - sms + - externalId + - applicationPort + MsisdnLessMoSmsNotificationReply: + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - supportedFeatures \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29122_NIDD.yaml b/lib/sbi/support/3gpp-spec/TS29122_NIDD.yaml new file mode 100644 index 000000000..c322346d0 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_NIDD.yaml @@ -0,0 +1,759 @@ +openapi: 3.0.0 +info: + title: 3gpp-nidd + version: 1.1.0.alpha-2 + description: | + API for non IP data delivery. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.5.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-nidd/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/configurations: + parameters: + - name: scsAsId + description: String identifying the SCS/AS. + in: path + required: true + schema: + type: string + get: + responses: + '200': + description: all NIDD configurations. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NiddConfiguration' + minItems: 0 + description: individual NIDD configuration. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + post: + requestBody: + description: Contains the data to create a NIDD configuration. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NiddConfiguration' + responses: + '201': + description: NIDD configuration is successfully created. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddConfiguration' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + callbacks: + niddNotifications: + '{$request.body#/notificationDestination}': + post: + requestBody: + description: Notification for NIDD configuration status, MO NIDD, MT NIDD delivery report. + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/NiddConfigurationStatusNotification' + - $ref: '#/components/schemas/NiddUplinkDataNotification' + - $ref: '#/components/schemas/NiddDownlinkDataDeliveryStatusNotification' + - $ref: '#/components/schemas/GmdNiddDownlinkDataDeliveryNotification' + responses: + '204': + description: Expected response to a successful callback processing without a body + '200': + description: Expected response to a successful callback processing with a body + content: + application/json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Acknowledgement' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/configurations/{configurationId}: + parameters: + - name: scsAsId + description: String identifying the SCS/AS. + in: path + required: true + schema: + type: string + - name: configurationId + description: String identifying the individual NIDD configuration resource in the SCEF. + in: path + required: true + schema: + type: string + get: + responses: + '200': + description: The individual NIDD configuration is successfully retrieved. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddConfiguration' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + patch: + requestBody: + description: Contains information to be applied to the individual NIDD configuration. + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/NiddConfigurationPatch' + responses: + '200': + description: The Individual NIDD configuration is modified successfully and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddConfiguration' + '204': + description: The Individual NIDD configuration is modified successfully. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + responses: + '204': + description: The Individual NIDD configuration is deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/configurations/{configurationId}/downlink-data-deliveries: + parameters: + - name: scsAsId + description: String identifying the SCS/AS. + in: path + required: true + schema: + type: string + - name: configurationId + description: String identifying the individual NIDD configuration resource in the SCEF. + in: path + required: true + schema: + type: string + get: + responses: + '200': + description: all NIDD downlink data deliveries. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + minItems: 0 + description: individual NIDD downlink data delivery. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + post: + requestBody: + description: Contains the data to create a NIDD downlink data delivery. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + responses: + '200': + description: NIDD downlink data delivery is successful. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + '201': + description: NIDD downlink data delivery is pending. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The NIDD downlink data delivery request was not successful. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataDeliveryFailure' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/configurations/{configurationId}/downlink-data-deliveries/{downlinkDataDeliveryId}: + parameters: + - name: scsAsId + description: String identifying the SCS/AS. + in: path + required: true + schema: + type: string + - name: configurationId + description: String identifying the individual NIDD configuration resource in the SCEF. + in: path + required: true + schema: + type: string + - name: downlinkDataDeliveryId + description: String identifying the individual NIDD downlink data delivery in the SCEF. + in: path + required: true + schema: + type: string + get: + responses: + '200': + description: The individual NIDD downlink data delivery is successfully retrieved. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + requestBody: + description: Contains information to be applied to the individual NIDD downlink data delivery. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + responses: + '200': + description: The pending NIDD downlink data is replaced sucessfully but delivery is pending. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '409': + $ref: 'TS29122_CommonData.yaml#/components/responses/409' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The NIDD downlink data replacement request was not successful. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataDeliveryFailure' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + responses: + '204': + description: The pending NIDD downlink data is deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '409': + $ref: 'TS29122_CommonData.yaml#/components/responses/409' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The NIDD downlink data cancellation request was not successful. + content: + application/json: + schema: + $ref: '#/components/schemas/NiddDownlinkDataDeliveryFailure' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + NiddConfiguration: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + mtcProviderId: + type: string + description: Identifies the MTC Service Provider and/or MTC Application. + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + duration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + reliableDataService: + type: boolean + description: The reliable data service (as defined in subclause 4.5.15.3 of 3GPP TS 23.682) to indicate if a reliable data service acknowledgment is enabled or not. + rdsPorts: + type: array + items: + $ref: '#/components/schemas/RdsPort' + minItems: 1 + description: Indicates the port configuration that is used for reliable data transfer between specific applications using RDS (as defined in subclause 5.2.4 and 5.2.5 of 3GPP TS 24.250). + pdnEstablishmentOption: + $ref: '#/components/schemas/PdnEstablishmentOptions' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + maximumPacketSize: + type: integer + minimum: 1 + description: The Maximum Packet Size is the maximum NIDD packet size that was transferred to the UE by the SCEF in the PCO, see subclause 4.5.14.1 of 3GPP TS 23.682. If no maximum packet size was provided to the UE by the SCEF, the SCEF sends a default configured max packet size to SCS/AS. Unit bit. + readOnly: true + niddDownlinkDataTransfers: + type: array + items: + $ref: '#/components/schemas/NiddDownlinkDataTransfer' + minItems: 1 + description: The downlink data deliveries that needed to be executed by the SCEF. The cardinality of the property shall be 0..1 in the request and 0..N in the response (i.e. response may contain multiple buffered MT NIDD). + status: + $ref: '#/components/schemas/NiddStatus' + required: + - notificationDestination + oneOf: + - required: [externalId] + - required: [msisdn] + - required: [externalGroupId] + NiddDownlinkDataTransfer: + type: object + properties: + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + data: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + reliableDataService: + type: boolean + description: The reliable data service (as defined in subclause 4.5.15.3 of 3GPP TS 23.682) to indicate if a reliable data service acknowledgment is enabled or not. + rdsPort: + $ref: '#/components/schemas/RdsPort' + maximumLatency: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + priority: + type: integer + description: It is used to indicate the priority of the non-IP data packet relative to other non-IP data packets. + pdnEstablishmentOption: + $ref: '#/components/schemas/PdnEstablishmentOptions' + deliveryStatus: + $ref: '#/components/schemas/DeliveryStatus' + requestedRetransmissionTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + required: + - data + oneOf: + - required: [externalId] + - required: [msisdn] + - required: [externalGroupId] + NiddUplinkDataNotification: + type: object + properties: + niddConfiguration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + data: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bytes' + reliableDataService: + type: boolean + description: Indicates whether the reliable data service is enabled. + rdsPort: + $ref: '#/components/schemas/RdsPort' + required: + - niddConfiguration + - data + oneOf: + - required: [externalId] + - required: [msisdn] + NiddDownlinkDataDeliveryStatusNotification: + type: object + properties: + niddDownlinkDataTransfer: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + deliveryStatus: + $ref: '#/components/schemas/DeliveryStatus' + requestedRetransmissionTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + required: + - niddDownlinkDataTransfer + - deliveryStatus + NiddConfigurationStatusNotification: + type: object + properties: + niddConfiguration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + status: + $ref: '#/components/schemas/NiddStatus' + rdsCapIndication: + type: boolean + description: It indicates whether the network capability for the reliable data service is enabled or not. + rdsPort: + $ref: '#/components/schemas/RdsPort' + required: + - niddConfiguration + - status + oneOf: + - required: [externalId] + - required: [msisdn] + GmdNiddDownlinkDataDeliveryNotification: + type: object + properties: + niddDownlinkDataTransfer: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + gmdResults: + type: array + items: + $ref: '#/components/schemas/GmdResult' + minItems: 1 + description: Indicates the group message delivery result. + required: + - niddDownlinkDataTransfer + - gmdResults + RdsPort: + type: object + properties: + portUE: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Port' + portSCEF: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Port' + required: + - portUE + - portSCEF + GmdResult: + type: object + properties: + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + deliveryStatus: + $ref: '#/components/schemas/DeliveryStatus' + requestedRetransmissionTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + required: + - deliveryStatus + oneOf: + - required: [externalId] + - required: [msisdn] + NiddDownlinkDataDeliveryFailure: + type: object + properties: + problemDetail: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + requestedRetransmissionTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + required: + - problemDetail + PdnEstablishmentOptions: + anyOf: + - type: string + enum: + - WAIT_FOR_UE + - INDICATE_ERROR + - SEND_TRIGGER + - 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 + - WAIT_FOR_UE: wait for the UE to establish the PDN connection + - INDICATE_ERROR: respond with an error cause + - SEND_TRIGGER: send a device trigger + PdnEstablishmentOptionsRm: + anyOf: + - $ref: '#/components/schemas/PdnEstablishmentOptions' + - $ref: 'TS29571_CommonData.yaml#/components/schemas/NullValue' + DeliveryStatus: + anyOf: + - type: string + enum: + - SUCCESS + - SUCCESS_NEXT_HOP_ACKNOWLEDGED + - SUCCESS_NEXT_HOP_UNACKNOWLEDGED + - SUCCESS_ACKNOWLEDGED + - SUCCESS_UNACKNOWLEDGED + - TRIGGERED + - BUFFERING + - BUFFERING_TEMPORARILY_NOT_REACHABLE + - SENDING + - FAILURE + - FAILURE_RDS_DISABLED + - FAILURE_NEXT_HOP + - FAILURE_TIMEOUT + - 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 + - SUCCESS: Success but details not provided + - SUCCESS_NEXT_HOP_ACKNOWLEDGED: Successful delivery to the next hop with acknowledgment. + - SUCCESS_NEXT_HOP_UNACKNOWLEDGED: Successful delivery to the next hop without acknowledgment + - SUCCESS_ACKNOWLEDGED: Reliable delivery was acknowledged by the UE + - SUCCESS_UNACKNOWLEDGED: Reliable delivery was not acknowledged by the UE + - TRIGGERED: The SCEF triggered the device and is buffering the data. + - BUFFERING: The SCEF is buffering the data due to no PDN connection established. + - BUFFERING_TEMPORARILY_NOT_REACHABLE: The SCEF has been informed that the UE is temporarily not reachable but is buffering the data + - SENDING: The SCEF has forwarded the data, but they may be stored elsewhere + - FAILURE: Delivery failure but details not provided + - FAILURE_RDS_DISABLED: RDS was disabled + - FAILURE_NEXT_HOP: Unsuccessful delivery to the next hop. + - FAILURE_TIMEOUT: Unsuccessful delivery due to timeout. + readOnly: true + NiddStatus: + anyOf: + - type: string + enum: + - ACTIVE + - TERMINATED_UE_NOT_AUTHORIZED + - TERMINATED + - RDS_PORT_UNKNOWN + - 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 + - ACTIVE: The NIDD configuration is active. + - TERMINATED_UE_NOT_AUTHORIZED: The NIDD configuration was terminated because the UE's authorisation was revoked. + - TERMINATED: The NIDD configuration was terminated. + - RDS_PORT_UNKNOWN: The RDS port is unknown. + readOnly: true + NiddConfigurationPatch: + type: object + properties: + duration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTimeRm' + reliableDataService: + type: boolean + description: The reliable data service (as defined in subclause 4.5.15.3 of 3GPP TS 23.682) to indicate if a reliable data service acknowledgment is enabled or not. + nullable: true + rdsPorts: + type: array + items: + $ref: '#/components/schemas/RdsPort' + minItems: 1 + description: Indicates the port configuration that is used for reliable data transfer between specific applications using RDS (as defined in subclause 5.2.4 and 5.2.5 of 3GPP TS 24.250). + pdnEstablishmentOption: + $ref: '#/components/schemas/PdnEstablishmentOptionsRm' diff --git a/lib/sbi/support/3gpp-spec/TS29122_NpConfiguration.yaml b/lib/sbi/support/3gpp-spec/TS29122_NpConfiguration.yaml new file mode 100644 index 000000000..b95459e6e --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_NpConfiguration.yaml @@ -0,0 +1,425 @@ +openapi: 3.0.0 +info: + title: 3gpp-network-parameter-configuration + version: 1.1.0.alpha-2 + description: | + API for network parameter configuration. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.3.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-network-parameter-configuration/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause of 3GPP TS 29.122. +paths: + /{scsAsId}/configurations: + get: + summary: read all of the active configurations for the SCS/AS + tags: + - NpConfiguration API SCS/AS level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get all of the active NpConfigurations for the SCS/AS) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NpConfiguration' + minItems: 0 + description: Network Parameter configurations + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new configuration resource for network parameter configuration + tags: + - NpConfiguration API Configuration level POST Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + requestBody: + description: new configuration creation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NpConfiguration' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ConfigurationNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Created (Successful creation of configuration) + content: + application/json: + schema: + $ref: '#/components/schemas/NpConfiguration' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/configurations/{configurationId}: + get: + summary: read an active configuration for the SCS/AS and the configuration Id + tags: + - NpConfiguration API Configuration level GET Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active configuration) + content: + application/json: + schema: + $ref: '#/components/schemas/NpConfiguration' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing configuration resource + tags: + - NpConfiguration API Configuration level PUT Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing configuration + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NpConfiguration' + responses: + '200': + description: OK (Successful deletion of the existing configuration) + content: + application/json: + schema: + $ref: '#/components/schemas/NpConfiguration' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates/replaces an existing configuration resource + tags: + - NpConfiguration API Configuration level PATCH Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/NpConfigurationPatch' + responses: + '200': + description: OK. The configuration was modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/NpConfiguration' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing configuration + tags: + - NpConfiguration API Configuration level DELETE Operation + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing configuration) + '200': + description: OK. (Successful deletion of the existing configuration) + content: + application/json: + schema: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ConfigResult' + minItems: 1 + description: The configuration was terminated successfully, the configuration failure information for group members shall be included if received. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + NpConfiguration: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + externalId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalId' + msisdn: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Msisdn' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + maximumLatency: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + maximumResponseTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + suggestedNumberOfDlPackets: + type: integer + minimum: 0 + description: This parameter may be included to identify the number of packets that the serving gateway shall buffer in case that the UE is not reachable. + groupReportingGuardTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + validityTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + oneOf: + - required: [externalId] + - required: [msisdn] + - required: [externalGroupId] + NpConfigurationPatch: + type: object + properties: + maximumLatency: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSecRm' + maximumResponseTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSecRm' + suggestedNumberOfDlPackets: + type: integer + minimum: 0 + description: This parameter may be included to identify the number of packets that the serving gateway shall buffer in case that the UE is not reachable. + nullable: true + groupReportGuardTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSecRm' + validityTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTimeRm' + ConfigurationNotification: + type: object + properties: + configuration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + configResults: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ConfigResult' + minItems: 1 + description: The grouping configuration result notification provided by the SCEF. + appliedParam: + $ref: 'TS29122_MonitoringEvent.yaml#/components/schemas/AppliedParameterConfiguration' + required: + - configuration diff --git a/lib/sbi/support/3gpp-spec/TS29122_PfdManagement.yaml b/lib/sbi/support/3gpp-spec/TS29122_PfdManagement.yaml new file mode 100644 index 000000000..f2637486f --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_PfdManagement.yaml @@ -0,0 +1,600 @@ +openapi: 3.0.0 +info: + title: 3gpp-pfd-management + version: 1.1.0.alpha-4 + description: | + API for PFD management. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-pfd-management/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/transactions: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + get: + responses: + '200': + description: OK. All transactions related to the request URI are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdManagement' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PfdManagement' + description: Create a new transaction for PFD management. + responses: + '201': + description: Created. The transaction was created successfully. The SCEF shall return the created transaction in the response payload body. PfdReport may be included to provide detailed failure information for some applications. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdManagement' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The PFDs for all applications were not created successfully. PfdReport is included with detailed information. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdReport' + minItems: 1 + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/transactions/{transactionId}: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: transactionId + in: path + description: Transaction ID + required: true + schema: + type: string + get: + responses: + '200': + description: OK. The transaction information related to the request URI is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdManagement' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PfdManagement' + description: Change information in PFD management transaction. + responses: + '200': + description: OK. The transaction was modified successfully. The SCEF shall return an updated transaction in the response payload body. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdManagement' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The PFDs for all applications were not updated successfully. PfdReport is included with detailed information. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + responses: + '204': + description: No Content. The transaction was deleted successfully. The payload body shall be empty. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/transactions/{transactionId}/applications/{appId}: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: transactionId + in: path + description: Transaction ID + required: true + schema: + type: string + - name: appId + in: path + description: Identifier of the application + required: true + schema: + type: string + get: + responses: + '200': + description: OK. The application information related to the request URI is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PfdData' + description: Change information in application. + responses: + '200': + description: OK. The application resource was modified successfully. The SCEF shall return an updated application resource in the response payload body. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + description: The PFDs for the application were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '409': + description: The PFDs for the application were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The PFDs for the application were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + patch: + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/PfdData' + description: Change information in PFD management transaction. + responses: + '200': + description: OK. The transaction was modified successfully. The SCEF shall return an updated transaction in the response payload body. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + description: The PFDs for the application were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '409': + description: The PFDs for the application were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The PFDs for the application were not updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdReport' + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + responses: + '204': + description: No Content. The application was deleted successfully. The payload body shall be empty. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + PfdManagement: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + pfdDatas: + type: object + additionalProperties: + $ref: '#/components/schemas/PfdData' + minProperties: 1 + description: Each element uniquely identifies the PFDs for an external application identifier. Each element is identified in the map via an external application identifier as key. The response shall include successfully provisioned PFD data of application(s). + pfdReports: + type: object + additionalProperties: + $ref: '#/components/schemas/PfdReport' + minProperties: 1 + description: Supplied by the SCEF and contains the external application identifiers for which PFD(s) are not added or modified successfully. The failure reason is also included. Each element provides the related information for one or more external application identifier(s) and is identified in the map via the failure identifier as key. + readOnly: true + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + required: + - pfdDatas + PfdData: + type: object + properties: + externalAppId: + type: string + description: Each element uniquely external application identifier + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + pfds: + type: object + additionalProperties: + $ref: '#/components/schemas/Pfd' + description: Contains the PFDs of the external application identifier. Each PFD is identified in the map via a key containing the PFD identifier. + allowedDelay: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSecRm' + cachingTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSecRo' + required: + - externalAppId + - pfds + Pfd: + type: object + properties: + pfdId: + type: string + description: Identifies a PDF of an application identifier. + flowDescriptions: + type: array + items: + type: string + minItems: 1 + description: Represents a 3-tuple with protocol, server ip and server port for UL/DL application traffic. The content of the string has the same encoding as the IPFilterRule AVP value as defined in IETF RFC 6733. + urls: + type: array + items: + type: string + minItems: 1 + description: Indicates a URL or a regular expression which is used to match the significant parts of the URL. + domainNames: + type: array + items: + type: string + minItems: 1 + description: Indicates an FQDN or a regular expression as a domain name matching criteria. + dnProtocol: + $ref: '#/components/schemas/DomainNameProtocol' + required: + - pfdId + PfdReport: + type: object + properties: + externalAppIds: + type: array + items: + type: string + minItems: 1 + description: Identifies the external application identifier(s) which PFD(s) are not added or modified successfully + failureCode: + $ref: '#/components/schemas/FailureCode' + cachingTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + locationArea: + $ref: '#/components/schemas/UserPlaneLocationArea' + required: + - externalAppIds + - failureCode + UserPlaneLocationArea: + type: object + properties: + locationArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea' + locationArea5G: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + dnais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 0 + description: Identifies a list of DNAI which the user plane functions support. + FailureCode: + anyOf: + - type: string + enum: + - MALFUNCTION + - RESOURCE_LIMITATION + - SHORT_DELAY + - APP_ID_DUPLICATED + - PARTIAL_FAILURE + - OTHER_REASON + - 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 + - MALFUNCTION: This value indicates that something functions wrongly in PFD provisioning or the PFD provisioning does not function at all. + - RESOURCE_LIMITATION: This value indicates there is resource limitation for PFD storage. + - SHORT_DELAY: This value indicates that the allowed delay is too short and PFD(s) are not stored. + - APP_ID_DUPLICATED: The received external application identifier(s) are already provisioned. + - PARTIAL_FAILURE: The PFD(s) are not provisioned to all PCEFs/TDFs/SMFs. + - OTHER_REASON: Other reason unspecified. + DomainNameProtocol: + anyOf: + - type: string + enum: + - DNS_QNAME + - TLS_SNI + - TLS_SAN + - TSL_SCN + - 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 + - DNS_QNAME: Identifies the DNS protocol and the question name in DNS query. + - TLS_SNI: Identifies the Server Name Indication in TLS ClientHello message. + - TLS_SAN: Identifies the Subject Alternative Name in TLS ServerCertificate message. + - TLS_SCN: Identifies the Subject Common Name in TLS ServerCertificate message. diff --git a/lib/sbi/support/3gpp-spec/TS29122_RacsParameterProvisioning.yaml b/lib/sbi/support/3gpp-spec/TS29122_RacsParameterProvisioning.yaml new file mode 100644 index 000000000..9f3311d81 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_RacsParameterProvisioning.yaml @@ -0,0 +1,352 @@ +openapi: 3.0.0 +info: + title: 3gpp-racs-parameter-provisioning + version: 1.0.0.alpha-1 + description: | + API for provisioning UE radio capability parameters. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-racs-pp/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/provisionings: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + get: + responses: + '200': + description: OK. The provisioning information related to the request URI is returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/RacsProvisioningData' + minItems: 0 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + post: + requestBody: + description: create new provisionings for a given SCS/AS. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RacsProvisioningData' + responses: + '201': + description: Created. The provisioning was created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsProvisioningData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The RACS data for all RACS IDs were not provisioned successfully. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/RacsFailureReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/provisionings/{provisioningId}: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS as defined in subclause subclause 5.2.4 of 3GPP TS 29.122. + required: true + schema: + type: string + - name: provisioningId + in: path + description: Provisioning ID + required: true + schema: + type: string + get: + responses: + '200': + description: OK. The provisioning information related to the request URI is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsProvisioningData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + patch: + requestBody: + description: update an existing parameter provisioning. + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/RacsProvisioningDataPatch' + responses: + '200': + description: OK. The provisioning data was updated successfully. The SCEF shall return an updated provisioning information in the response. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsProvisioningData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The RACS data for all RACS IDs were not provisioned successfully. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/RacsFailureReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + requestBody: + description: update an existing parameter provisioning. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RacsProvisioningData' + responses: + '200': + description: OK. The provisioning data was updated successfully. The SCEF shall return an updated provisioning information in the response. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsProvisioningData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The RACS data for all RACS IDs were not provisioned successfully. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/RacsFailureReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + responses: + '204': + description: No Content. The provisioning was terminated successfully. The payload body shall be empty. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + RacsProvisioningData: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + racsConfigs: + type: object + additionalProperties: + $ref: '#/components/schemas/RacsConfigurationRm' + minProperties: 1 + description: Identifies the configuration related to manufactuer specific UE radio capability. Each element uniquely identifies an RACS configuration for an RACS ID and is identified in the map via the RACS ID as key. The response shall include successfully provisioned RACS data. + racsReports: + type: object + additionalProperties: + $ref: '#/components/schemas/RacsFailureReport' + minProperties: 1 + description: Supplied by the SCEF. Contains the RACS IDs for which the RACS data are not provisioned successfully. + readOnly: true + required: + - racsConfigs + RacsFailureReport: + type: object + properties: + racsIds: + type: array + items: + type: string + minItems: 1 + description: Identifies the RACS ID(s) for which the RACS data are not provisioned successfully. + failureCode: + $ref: '#/components/schemas/RacsFailureCode' + required: + - racsIds + - failureCode + RacsConfigurationRm: + type: object + properties: + racsId: + type: string + description: The UE radio capability ID provided by the SCS/AS to identify the UE radio capability data. See 3GPP TS 23.003 for the encoding. + racsParam: + type: string + description: The UE radio capability data, depending on the device type (4G or 5G capable), its encoding shall comply with the UE-CapabilityRAT-ContainerList as defined in subclause 6.3.6 of 3GPP TS 36.331 or UE-CapabilityRAT-ContainerList as defined in subclause 6.3.3 of 3GPP TS 38.331. + required: + - racsId + - racsParam + nullable: true + RacsProvisioningDataPatch: + type: object + properties: + racsConfigs: + type: object + additionalProperties: + $ref: '#/components/schemas/RacsConfigurationRm' + minProperties: 1 + description: Identifies the configuration related to manufactuer specific UE radio capability. Each element uniquely identifies an RACS configuration for an RACS ID and is identified in the map via the RACS ID as key. + RacsFailureCode: + anyOf: + - type: string + enum: + - MALFUNCTION + - RESOURCE_LIMITATION + - RACS_ID_DUPLICATED + - OTHER_REASON + - 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 + - MALFUNCTION: This value indicates that something functions wrongly in RACS provisioning or the RACS provisioning does not function at all. + - RESOURCE_LIMITATION: The received RACS identifier(s) are already provisioned. + - RACS_ID_DUPLICATED: This value indicates there is resource limitation for RACS data storage. + - OTHER_REASON: Other reason unspecified. + diff --git a/lib/sbi/support/3gpp-spec/TS29122_ReportingNetworkStatus.yaml b/lib/sbi/support/3gpp-spec/TS29122_ReportingNetworkStatus.yaml new file mode 100644 index 000000000..048764668 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_ReportingNetworkStatus.yaml @@ -0,0 +1,317 @@ +openapi: 3.0.0 +info: + title: 3gpp-network-status-reporting + version: 1.0.1 + description: | + API for reporting network status. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V15.4.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-net-stat-report/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/subscriptions: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ScsAsId' + get: + summary: Read all network status reporting subscription resources for a given SCS/AS. + responses: + '200': + description: The requested information was returned successfully. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NetworkStatusReportingSubscription' + minItems: 0 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Create a new network status reporting subscription resource. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkStatusReportingSubscription' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkStatusReportingNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: The subscription was created successfully. The URI of the created resource shall be returned in the "Location" HTTP header. + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkStatusReportingSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{scsAsId}/subscriptions/{subscriptionId}: + parameters: + - name: scsAsId + in: path + description: Identifier of the SCS/AS + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ScsAsId' + - name: subscriptionId + in: path + description: Identifier of the subscription resource of type string + required: true + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ResourceId' + get: + summary: Read an active network status reporting subscription resource. + responses: + '200': + description: The requested information was returned successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkStatusReportingSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + summary: Modify an existing subscription resource to update a subscription. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkStatusReportingSubscription' + responses: + '200': + description: The subscription was updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/NetworkStatusReportingSubscription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + summary: Delete an existing continuous network status reporting subscription resource. + responses: + '204': + description: The subscription was updated successfully. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + NetworkStatusReportingSubscription: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the SCEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + locationArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea' + timeDuration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + thresholdValues: + type: array + items: + $ref: '#/components/schemas/CongestionValue' + minItems: 1 + description: Identifies a list of congestion level(s) with exact value that the SCS/AS requests to be informed of when reached. + thresholdTypes: + type: array + items: + $ref: '#/components/schemas/CongestionType' + minItems: 1 + description: Identifies a list of congestion level(s) with abstracted value that the SCS/AS requests to be informed of when reached. + required: + - notificationDestination + - locationArea + not: + required: [thresholdValues, thresholdTypes] + NetworkStatusReportingNotification: + type: object + properties: + subscription: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + nsiValue: + $ref: '#/components/schemas/CongestionValue' + nsiType: + $ref: '#/components/schemas/CongestionType' + required: + - subscription + not: + required: [nsiValue, nsiType] + CongestionValue: + type: integer + minimum: 0 + maximum: 31 + description: Unsigned integer with valid values between 0 and 31. The value 0 indicates that there is no congestion. The value 1 is the lowest congestion level and value 31 is the highest congestion level. + CongestionType: + anyOf: + - type: string + enum: + - HIGH + - MEDIUM + - LOW + - 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 + - HIGH: The congestion status is high. + - MEDIUM: The congestion status is medium. + - LOW: The congestion status is low. \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29122_ResourceManagementOfBdt.yaml b/lib/sbi/support/3gpp-spec/TS29122_ResourceManagementOfBdt.yaml new file mode 100644 index 000000000..0a4f76ec9 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29122_ResourceManagementOfBdt.yaml @@ -0,0 +1,374 @@ +openapi: 3.0.0 +info: + title: 3gpp-bdt + version: 1.1.0.alpha-4 + description: | + API for BDT resouce management. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.122 V16.5.0 T8 reference point for Northbound APIs + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.122/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-bdt/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{scsAsId}/subscriptions: + parameters: + - name: scsAsId + description: String identifying the SCS/AS. + in: path + required: true + schema: + type: string + get: + responses: + '200': + description: all BDT policy subscriptions. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Bdt' + minItems: 0 + description: individual BDT policy subscription. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + post: + requestBody: + description: Contains the data to create a BDT subscription. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Bdt' + callbacks: + bDTWarningNotification: + '{$request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ExNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Background data transfer policies offered to the SCS/AS. + content: + application/json: + schema: + $ref: '#/components/schemas/Bdt' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '409': + $ref: 'TS29122_CommonData.yaml#/components/responses/409' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{scsAsId}/subscriptions/{subscriptionId}: + parameters: + - name: scsAsId + description: String identifying the SCS/AS. + in: path + required: true + schema: + type: string + - name: subscriptionId + description: String identifying the individual BDT policy resource in the SCEF. + in: path + required: true + schema: + type: string + get: + responses: + '200': + description: Background data transfer policies offered to and selected by the SCEF. + content: + application/json: + schema: + $ref: '#/components/schemas/Bdt' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + requestBody: + description: Parameters to update/replace the existing BDT subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Bdt' + responses: + '200': + description: OK (Successful update of the BDT subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/Bdt' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + patch: + requestBody: + description: Contains information to be performed on the Bdt data structure to select a transfer policy. + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/BdtPatch' + responses: + '200': + description: The Individual BDT Policy resource is modified with a selected policy and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/Bdt' + '204': + description: The Individual BDT Policy resource is modified with a selected policy. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + responses: + '204': + description: The Individual BDT Policy resource is deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + Bdt: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + volumePerUE: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + numberOfUEs: + type: integer + minimum: 1 + description: Identifies the number of UEs. + desiredTimeWindow: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + locationArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea' + locationArea5G: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + referenceId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + transferPolicies: + type: array + items: + $ref: '#/components/schemas/TransferPolicy' + minItems: 1 + description: Identifies an offered transfer policy. + readOnly: true + selectedPolicy: + type: integer + description: Identity of the selected background data transfer policy. Shall not be present in initial message exchange, can be provided by NF service consumer in a subsequent message exchange. + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + warnNotifEnabled: + type: boolean + description: Indicates whether the BDT warning notification is enabled or not. + required: + - volumePerUE + - numberOfUEs + - desiredTimeWindow + BdtPatch: + type: object + properties: + selectedPolicy: + type: integer + description: Identity of the selected background data transfer policy. + warnNotifEnabled: + type: boolean + description: Indicates whether the BDT warning notification is enabled or not. + required: + - selectedPolicy + TransferPolicy: + type: object + properties: + bdtPolicyId: + type: integer + description: Identifier for the transfer policy + maxUplinkBandwidth: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bandwidth' + maxDownlinkBandwidth: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Bandwidth' + ratingGroup: + type: integer + minimum: 0 + description: Indicates the rating group during the time window. + timeWindow: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + required: + - bdtPolicyId + - ratingGroup + - timeWindow + ExNotification: + type: object + properties: + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + locationArea5G: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + timeWindow: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + candPolicies: + type: array + items: + $ref: '#/components/schemas/TransferPolicy' + minItems: 1 + description: This IE indicates a list of the candidate transfer policies from which the AF may select a new transfer policy due to network performance degradation. + required: + - bdtRefId diff --git a/lib/sbi/support/3gpp-spec/TS29222_AEF_Security_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_AEF_Security_API.yaml new file mode 100644 index 000000000..7fd3eff85 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_AEF_Security_API.yaml @@ -0,0 +1,133 @@ +openapi: 3.0.0 +info: + title: AEF_Security_API + description: | + API for AEF security management. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.1" +externalDocs: + description: 3GPP TS 29.222 V15.4.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/aef-security/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222. +paths: + /check-authentication: + post: + summary: Check authentication. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CheckAuthenticationReq' + responses: + '200': + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/CheckAuthenticationRsp' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /revoke-authorization: + post: + summary: Revoke authorization. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RevokeAuthorizationReq' + responses: + '200': + description: The request was successful. + content: + application/json: + schema: + $ref: '#/components/schemas/RevokeAuthorizationRsp' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + schemas: + CheckAuthenticationReq: + type: object + properties: + apiInvokerId: + type: string + description: API invoker ID assigned by the CAPIF core function to the API invoker while on-boarding the API invoker. + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - apiInvokerId + - supportedFeatures + CheckAuthenticationRsp: + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - supportedFeatures + RevokeAuthorizationReq: + type: object + properties: + revokeInfo: + $ref: 'TS29222_CAPIF_Security_API.yaml#/components/schemas/SecurityNotification' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - revokeInfo + - supportedFeatures + RevokeAuthorizationRsp: + type: object + properties: + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - supportedFeatures \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_API_Invoker_Management_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_API_Invoker_Management_API.yaml new file mode 100644 index 000000000..0452fcb9d --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_API_Invoker_Management_API.yaml @@ -0,0 +1,277 @@ +openapi: 3.0.0 +info: + title: CAPIF_API_Invoker_Management_API + description: | + API for API invoker management. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.1.0.alpha-1" +externalDocs: + description: 3GPP TS 29.222 V16.1.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/api-invoker-management/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222 + +paths: + /onboardedInvokers: + post: + description: Creates a new individual API Invoker profile. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/APIInvokerEnrolmentDetails' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + description: Notify the API Invoker about the onboarding completion + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingNotification' + responses: + '204': + description: No Content (successful onboarding notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: API invoker on-boarded successfully + content: + application/json: + schema: + $ref: '#/components/schemas/APIInvokerEnrolmentDetails' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/api-invoker-management/v1/onboardedInvokers/{onboardingId}' + required: true + schema: + type: string + '202': + description: The CAPIF core has accepted the Onboarding request and is processing it. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /onboardedInvokers/{onboardingId}: + delete: + description: Deletes an individual API Invoker. + parameters: + - name: onboardingId + in: path + description: String identifying an individual on-boarded API invoker resource + required: true + schema: + type: string + responses: + '204': + description: The individual API Invoker matching onboardingId was offboarded. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + description: Updates an individual API invoker details. + parameters: + - name: onboardingId + in: path + description: String identifying an individual on-boarded API invoker resource + required: true + schema: + type: string + requestBody: + description: representation of the API invoker details to be updated in CAPIF core function + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/APIInvokerEnrolmentDetails' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + description: Notify the API Invoker about the API invoker update completion + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingNotification' + responses: + '204': + description: No Content (successful API invoker update notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '200': + description: API invoker details updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/APIInvokerEnrolmentDetails' + '202': + description: The CAPIF core has accepted the API invoker update details request and is processing it. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + schemas: + OnboardingInformation: + type: object + properties: + apiInvokerPublicKey: + type: string + description: The API Invoker's public key + apiInvokerCertificate: + type: string + description: The API Invoker's generic client certificate, provided by the CAPIF core function. + onboardingSecret: + type: string + description: The API Invoker's onboarding secret, provided by the CAPIF core function. + required: + - apiInvokerPublicKey + APIList: + type: array + items: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/ServiceAPIDescription' + minItems: 1 + description: The list of service APIs that the API Invoker is allowed to invoke + APIInvokerEnrolmentDetails: + type: object + properties: + apiInvokerId: + type: string + description: API invoker ID assigned by the CAPIF core function to the API invoker while on-boarding the API invoker. Shall not be present in the HTTP POST request from the API invoker to the CAPIF core function, to on-board itself. Shall be present in all other HTTP requests and responses. + readOnly: true + onboardingInformation: + $ref: '#/components/schemas/OnboardingInformation' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri' + requestTestNotification: + type: boolean + description: Set to true by Subscriber to request the CAPIF core function to send a test notification as defined in in subclause 7.6. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + apiList: + $ref: '#/components/schemas/APIList' + apiInvokerInformation: + type: string + description: Generic information related to the API invoker such as details of the device or the application. + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - onboardingInformation + - notificationDestination + description: Information about the API Invoker that requested to onboard + OnboardingNotification: + type: object + properties: + result: + type: boolean + description: Set to "true" indicate successful on-boarding. Otherwise set to "false" + resourceLocation: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri' + apiInvokerEnrolmentDetails: + $ref: '#/components/schemas/APIInvokerEnrolmentDetails' + apiList: + $ref: '#/components/schemas/APIList' + required: + - result \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_API_Provider_Management_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_API_Provider_Management_API.yaml new file mode 100644 index 000000000..fdd9b1da8 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_API_Provider_Management_API.yaml @@ -0,0 +1,208 @@ +openapi: 3.0.0 +info: + title: CAPIF_API_Provider_Management_API + description: | + API for API provider domain functions management. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.0.alpha-1" +externalDocs: + description: 3GPP TS 29.222 V16.2.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/api-provider-management/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222 + +paths: + /registrations: + post: + description: Registers a new API Provider domainwith API provider domain functions profiles. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/APIProviderEnrolmentDetails' + responses: + '201': + description: API provider domain registered successfully + content: + application/json: + schema: + $ref: '#/components/schemas/APIProviderEnrolmentDetails' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/api-provider-management/v1/registrations/{registrationId}' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /registrations/{registrationId}: + delete: + description: Deregisters API provider domain by deleting API provider domain and functions. + parameters: + - name: registrationId + in: path + description: String identifying an registered API provider domain resource + required: true + schema: + type: string + responses: + '204': + description: The API provider domain matching registrationId is deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + description: Updates an API provider domain's registration details. + parameters: + - name: registrationId + in: path + description: String identifying an registered API provider domain resource + required: true + schema: + type: string + requestBody: + description: representation of the API provider domain registration details to be updated in CAPIF core function + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/APIProviderEnrolmentDetails' + responses: + '200': + description: API provider domain registration details updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/APIProviderEnrolmentDetails' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + schemas: + APIProviderEnrolmentDetails: + type: object + properties: + apiProviderDomainId: + type: string + description: API provider domain ID assigned by the CAPIF core function to the API management function while registering the API provider domain. Shall not be present in the HTTP POST request from the API Management function to the CAPIF core function, to on-board itself. Shall be present in all other HTTP requests and responses. + readOnly: true + registrationSecret: + type: string + description: Security information necessary for the CAPIF core function to validate the registration of the API provider domain. Shall be present in HTTP POST request from API management function to CAPIF core function for API provider domain registration. + apiProviderFunctionsList: + type: array + items: + $ref: '#/components/schemas/APIProviderFunctionDetails' + minItems: 1 + description: A list of individual API provider domain functions details. When included by the API management function in the HTTP request message, it lists the API provider domain functions that the API management function intends to register/update in registration or update registration procedure. When included by the CAPIF core function in the HTTP response message, it lists the API domain functions details that are registered or updated successfully. + apiProviderDomainInformation: + type: string + description: Generic information related to the API provider domain such as details of the API provider applications. + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + failureReason: + type: string + description: Registration or update specific failure information of failed API provider domain function registrations.Shall be present in the HTTP response body if atleast one of the API provider domain function registration or update registration fails. + required: + - registrationSecret + APIProviderFunctionDetails: + type: object + properties: + apiProviderFuncId: + type: string + description: API provider domain functionID assigned by the CAPIF core function to the API provider domain function while registering/updating the API provider domain. Shall not be present in the HTTP POST request from the API management function to the CAPIF core function, to register itself. Shall be present in all other HTTP requests and responses. + registrationInformation: + $ref: '#/components/schemas/RegistrationInformation' + apiProviderFuncRole: + $ref: '#/components/schemas/ApiProviderFuncRole' + apiProviderFunctionInformation: + type: string + description: Generic information related to the API provider domain function such as details of the API provider applications. + required: + - registrationInformation + - apiProviderFuncRole + RegistrationInformation: + type: object + properties: + apiProviderPublicKey: + type: string + description: Public Key of API Provider domain function. + apiProviderCertificate: + type: string + description: API provider domain function's client certificate + required: + - apiProviderPublicKey + ApiProviderFuncRole: + anyOf: + - type: string + enum: + - AEF + - APF + - AMF + - type: string + description: > + This string provides forward-compatiblity 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 + - AEF: API provider function is API Exposing Function. + - APF: API provider function is API Publishing Function. + - AMF: API Provider function is API Management Function. diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Access_Control_Policy_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Access_Control_Policy_API.yaml new file mode 100644 index 000000000..b7ad93183 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Access_Control_Policy_API.yaml @@ -0,0 +1,111 @@ +openapi: 3.0.0 +info: + title: CAPIF_Access_Control_Policy_API + description: | + API for access control policy. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.2" +externalDocs: + description: 3GPP TS 29.222 V16.1.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/access-control-policy/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222 + +paths: + /accessControlPolicyList/{serviceApiId}: + get: + description: Retrieves the access control policy list. + parameters: + - name: serviceApiId + in: path + description: Identifier of a published service API + required: true + schema: + type: string + - name: aef-id + in: query + required: true + description: Identifier of the AEF + schema: + type: string + - name: api-invoker-id + in: query + description: Identifier of the API invoker + schema: + type: string + - name: supported-features + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: OK. + content: + application/json: + schema: + $ref: '#/components/schemas/AccessControlPolicyList' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29122_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + schemas: + AccessControlPolicyList: + type: object + properties: + apiInvokerPolicies: + type: array + items: + $ref: '#/components/schemas/ApiInvokerPolicy' + minItems: 0 + description: Policy of each API invoker. + ApiInvokerPolicy: + type: object + properties: + apiInvokerId: + type: string + description: API invoker ID assigned by the CAPIF core function + allowedTotalInvocations: + type: integer + description: Total number of invocations allowed on the service API by the API invoker. + allowedInvocationsPerSecond: + type: integer + description: Invocations per second allowed on the service API by the API invoker. + allowedInvocationTimeRangeList: + type: array + items: + $ref: '#/components/schemas/TimeRangeList' + minItems: 0 + description: The time ranges during which the invocations are allowed on the service API by the API invoker. + required: + - apiInvokerID + TimeRangeList: + type: object + properties: + startTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + stopTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Auditing_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Auditing_API.yaml new file mode 100644 index 000000000..77de9bf75 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Auditing_API.yaml @@ -0,0 +1,123 @@ +openapi: 3.0.0 +info: + title: CAPIF_Auditing_API + description: | + API for auditing. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.1" +externalDocs: + description: 3GPP TS 29.222 V15.4.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/logs/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222. +paths: + /apiInvocationLogs: + get: + description: Query and retrieve service API invocation logs stored on the CAPIF core function. + parameters: + - name: aef-id + in: query + description: String identifying the API exposing function. + schema: + type: string + - name: api-invoker-id + in: query + description: String identifying the API invoker which invoked the service API. + schema: + type: string + - name: time-range-start + in: query + description: Start time of the invocation time range. + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + - name: time-range-end + in: query + description: End time of the invocation time range. + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + - name: api-id + in: query + description: String identifying the API invoked. + schema: + type: string + - name: api-name + in: query + description: API name, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501. + schema: + type: string + - name: api-version + in: query + description: Version of the API which was invoked. + schema: + type: string + - name: protocol + in: query + description: Protocol invoked. + schema: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/Protocol' + - name: operation + in: query + description: Operation that was invoked on the API. + schema: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/Operation' + - name: result + in: query + description: Result or output of the invocation. + schema: + type: string + - name: resource-name + in: query + description: Name of the specific resource invoked. + schema: + type: string + - name: src-interface + in: query + description: Interface description of the API invoker. + content: + application/json: + schema: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/InterfaceDescription' + - name: dest-interface + in: query + description: Interface description of the API invoked. + content: + application/json: + schema: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/InterfaceDescription' + - name: supported-features + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Result of the query operation along with fetched service API invocation log data. + content: + application/json: + schema: + $ref: 'TS29222_CAPIF_Logging_API_Invocation_API.yaml#/components/schemas/InvocationLog' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29122_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Discover_Service_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Discover_Service_API.yaml new file mode 100644 index 000000000..6a217aac0 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Discover_Service_API.yaml @@ -0,0 +1,121 @@ +openapi: 3.0.0 +info: + title: CAPIF_Discover_Service_API + description: | + API for discovering service APIs. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.1.0.alpha-2" +externalDocs: + description: 3GPP TS 29.222 V16.2.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/service-apis/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222. +paths: + /allServiceAPIs: + get: + description: Discover published service APIs and retrieve a collection of APIs according to certain filter criteria. + parameters: + - name: api-invoker-id + in: query + description: String identifying the API invoker assigned by the CAPIF core function. It also represents the CCF identifier in the CAPIF-6/6e interface. + required: true + schema: + type: string + - name: api-name + in: query + description: API name, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501 [18]. + schema: + type: string + - name: api-version + in: query + description: API major version the URI (e.g. v1). + schema: + type: string + - name: comm-type + in: query + description: Communication type used by the API (e.g. REQUEST_RESPONSE). + schema: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/CommunicationType' + - name: protocol + in: query + description: Protocol used by the API. + schema: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/Protocol' + - name: aef-id + in: query + description: AEF identifer. + schema: + type: string + - name: data-format + in: query + description: Data formats used by the API (e.g. serialization protocol JSON used). + schema: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/DataFormat' + - name: supported-features + in: query + description: Features supported by the NF consumer for the CAPIF Discover Service API. + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: api-supported-features + in: query + description: Features supported by the discovered service API indicated by api-name parameter. This may only be present if api-name query parameter is present. + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: The response body contains the result of the search over the list of registered APIs. + content: + application/json: + schema: + $ref: '#/components/schemas/DiscoveredAPIs' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29122_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + schemas: + DiscoveredAPIs: + type: object + properties: + serviceAPIDescriptions: + type: array + items: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/ServiceAPIDescription' + minItems: 1 + description: Description of the service API as published by the service. Each service API description shall include AEF profiles matching the filter criteria. + ccfServiceCategories: + type: array + items: + $ref: '#/components/schemas/CCFServiceCategory' + minItems: 1 + CCFServiceCategory: + type: object + properties: + serviceAPICategory: + type: string + ccfId: + type: string + required: + - serviceAPICategory + - ccfId diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Events_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Events_API.yaml new file mode 100644 index 000000000..b5d4385d2 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Events_API.yaml @@ -0,0 +1,277 @@ +openapi: 3.0.0 +info: + title: CAPIF_Events_API + description: | + API for event subscription management. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.1.0.alpha-2" +externalDocs: + description: 3GPP TS 29.222 V16.2.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/capif-events/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222 + +paths: + /{subscriberId}/subscriptions: + post: + description: Creates a new individual CAPIF Event Subscription. + parameters: + - name: subscriberId + in: path + description: Identifier of the Subscriber + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/EventSubscription' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/EventNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Created (Successful creation of subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/EventSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/capif-events/v1/{subscriberId}/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{subscriberId}/subscriptions/{subscriptionId}: + delete: + description: Deletes an individual CAPIF Event Subscription. + parameters: + - name: subscriberId + in: path + description: Identifier of the Subscriber + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of an individual Events Subscription + required: true + schema: + type: string + responses: + '204': + description: The individual CAPIF Events Subscription matching the subscriptionId is deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + schemas: + EventSubscription: + type: object + properties: + events: + type: array + items: + $ref: '#/components/schemas/CAPIFEvent' + minItems: 1 + description: Subscribed events + eventFilters: + type: array + items: + $ref: '#/components/schemas/CAPIFEventFilter' + minItems: 1 + description: Subscribed event filters + eventReq: + $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri' + requestTestNotification: + type: boolean + description: Set to true by Subscriber to request the CAPIF core function to send a test notification as defined in in subclause 7.6. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - events + - notificationDestination + EventNotification: + type: object + properties: + subscriptionId: + type: string + description: Identifier of the subscription resource to which the notification is related - CAPIF resource identifier + events: + $ref: '#/components/schemas/CAPIFEvent' + eventDetail: + $ref: '#/components/schemas/CAPIFEventDetail' + required: + - subscriptionId + - events + CAPIFEventFilter: + type: object + properties: + apiIds: + type: array + items: + type: string + minItems: 1 + description: Identifier of the service API + apiInvokerIds: + type: array + items: + type: string + minItems: 1 + description: Identity of the API invoker + aefIds: + type: array + items: + type: string + minItems: 1 + description: Identifier of the API exposing function + CAPIFEventDetail: + type: object + properties: + serviceAPIDescriptions: + type: array + items: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/ServiceAPIDescription' + minItems: 1 + description: Description of the service API as published by the APF. + apiIds: + type: array + items: + type: string + minItems: 1 + description: Identifier of the service API + apiInvokerIds: + type: array + items: + type: string + minItems: 1 + description: Identity of the API invoker + accCtrlPolList: + $ref: '#/components/schemas/AccessControlPolicyListExt' + invocationLogs: + type: array + items: + $ref: 'TS29222_CAPIF_Logging_API_Invocation_API.yaml#/components/schemas/InvocationLog' + minItems: 1 + description: Invocation logs. + AccessControlPolicyListExt: + allOf: + - $ref: 'TS29222_CAPIF_Access_Control_Policy_API.yaml#/components/schemas/AccessControlPolicyList' + - type: object + properties: + apiId: + type: string + required: + - apiId + CAPIFEvent: + anyOf: + - type: string + enum: + - SERVICE_API_AVAILABLE + - SERVICE_API_UNAVAILABLE + - SERVICE_API_UPDATE + - API_INVOKER_ONBOARDED + - API_INVOKER_OFFBOARDED + - SERVICE_API_INVOCATION_SUCCESS + - SERVICE_API_INVOCATION_FAILURE + - ACCESS_CONTROL_POLICY_UPDATE + - ACCESS_CONTROL_POLICY_UNAVAILABLE + - API_INVOKER_AUTHORIZATION_REVOKED + - API_INVOKER_UPDATED + - 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 + - SERVICE_API_AVAILABLE: Events related to the availability of service APIs after the service APIs are published. + - SERVICE_API_UNAVAILABLE: Events related to the unavailability of service APIs after the service APIs are unpublished. + - SERVICE_API_UPDATE: Events related to change in service API information. + - API_INVOKER_ONBOARDED: Events related to API invoker onboarded to CAPIF. + - API_INVOKER_OFFBOARDED: Events related to API invoker offboarded from CAPIF. + - SERVICE_API_INVOCATION_SUCCESS: Events related to the successful invocation of service APIs. + - SERVICE_API_INVOCATION_FAILURE: Events related to the failed invocation of service APIs. + - ACCESS_CONTROL_POLICY_UPDATE: Events related to the update for the access control policy related to the service APIs. - ACCESS_CONTROL_POLICY_UNAVAILABLE: Events related to the unavailability of the access control policy related to the service APIs. + - API_INVOKER_AUTHORIZATION_REVOKED: Events related to the revocation of the authorization of API invokers to access the service APIs. + - API_INVOKER_UPDATED: Events related to API invoker profile updated to CAPIF. diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Logging_API_Invocation_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Logging_API_Invocation_API.yaml new file mode 100644 index 000000000..08227857e --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Logging_API_Invocation_API.yaml @@ -0,0 +1,157 @@ +openapi: 3.0.0 +info: + title: CAPIF_Logging_API_Invocation_API + description: | + API for invocation logs. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.1" +externalDocs: + description: 3GPP TS 29.222 V15.4.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/api-invocation-logs/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222 +paths: + /{aefId}/logs: + post: + description: Creates a new log entry for service API invocations. + parameters: + - name: aefId + in: path + description: Identifier of the API exposing function + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/InvocationLog' + responses: + '201': + description: Log of service API invocations provided by API exposing function successfully stored on the CAPIF core function. + content: + application/json: + schema: + $ref: '#/components/schemas/InvocationLog' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/api-invocation-logs/v1/{aefId}/logs/{logId}' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /{aefId}/logs/{logId}: + description: Creates a new log entry for service API invocations. + parameters: + - name: aefId + in: path + description: Identifier of the API exposing function + required: true + schema: + type: string + - name: logId + in: path + description: Identifier of individual log entry + required: true + schema: + type: string +components: + schemas: + InvocationLog: + type: object + properties: + aefId: + type: string + description: Identity information of the API exposing function requesting logging of service API invocations + apiInvokerId: + type: string + description: Identity of the API invoker which invoked the service API + logs: + type: array + items: + $ref: '#/components/schemas/Log' + minItems: 1 + description: Service API invocation log + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - aefId + - apiInvokerId + - log + Log: + type: object + properties: + apiId: + type: string + description: String identifying the API invoked. + apiName: + type: string + description: Name of the API which was invoked, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501. + apiVersion: + type: string + description: Version of the API which was invoked + resourceName: + type: string + description: Name of the specific resource invoked + uri: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri' + protocol: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/Protocol' + operation: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/Operation' + result: + type: string + description: For HTTP protocol, it contains HTTP status code of the invocation + invocationTime: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + invocationLatency: + $ref: '#/components/schemas/DurationMs' + inputParameters: + description: List of input parameters. Can be any value - string, number, boolean, array or object. + outputParameters: + description: List of output parameters. Can be any value - string, number, boolean, array or object. + srcInterface: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/InterfaceDescription' + destInterface: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/InterfaceDescription' + fwdInterface: + type: string + description: It includes the node identifier (as defined in IETF RFC 7239 of all forwarding entities between the API invoker and the AEF, concatenated with comma and space, e.g. 192.0.2.43:80, unknown:_OBFport, 203.0.113.60 + required: + - apiId + - apiName + - apiVersion + - resourceName + - protocol + - result + DurationMs: + type: integer + description: Unsigned integer identifying a period of time in units of milliseconds. + minimum: 0 \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Publish_Service_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Publish_Service_API.yaml new file mode 100644 index 000000000..7baa8bc2a --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Publish_Service_API.yaml @@ -0,0 +1,495 @@ +openapi: 3.0.0 +info: + title: CAPIF_Publish_Service_API + description: | + API for publishing service APIs. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.1.0.alpha-2" +externalDocs: + description: 3GPP TS 29.222 V16.2.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/published-apis/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222. +paths: + +# APF published API + + /{apfId}/service-apis: + post: + description: Publish a new API. + parameters: + - name: apfId + in: path + required: true + schema: + $ref: '#/components/schemas/apfId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceAPIDescription' + responses: + '201': + description: Service API published successfully The URI of the created resource shall be returned in the "Location" HTTP header. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceAPIDescription' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + get: + description: Retrieve all published APIs. + parameters: + - name: apfId + in: path + required: true + schema: + $ref: '#/components/schemas/apfId' + responses: + '200': + description: Definition of all service API(s) published by the API publishing function. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceAPIDescription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +# Individual APF published API + + /{apfId}/service-apis/{serviceApiId}: + get: + description: Retrieve a published service API. + parameters: + - name: serviceApiId + in: path + required: true + schema: + $ref: '#/components/schemas/serviceApiId' + - name: apfId + in: path + required: true + schema: + $ref: '#/components/schemas/apfId' + responses: + '200': + description: Definition of all service API published by the API publishing function. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceAPIDescription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + description: Update a published service API. + parameters: + - name: serviceApiId + in: path + required: true + schema: + $ref: '#/components/schemas/serviceApiId' + - name: apfId + in: path + required: true + schema: + $ref: '#/components/schemas/apfId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceAPIDescription' + responses: + '200': + description: Definition of service API updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceAPIDescription' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + description: Unpublish a published service API. + parameters: + - name: serviceApiId + in: path + required: true + schema: + $ref: '#/components/schemas/serviceApiId' + - name: apfId + in: path + required: true + schema: + $ref: '#/components/schemas/apfId' + responses: + '204': + description: The individual published service API matching the serviceAPiId is deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +# Components + +components: + schemas: +# Data types uses as path variables + apfId: + type: string + description: Identification of the API publishing function. + serviceApiId: + type: string + description: String identifying an individual published service API. +# Data Type for representations + ServiceAPIDescription: + type: object + properties: + apiName: + type: string + description: API name, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501. + apiId: + type: string + description: API identifier assigned by the CAPIF core function to the published service API. Shall not be present in the HTTP POST request from the API publishing function to the CAPIF core function. Shall be present in the HTTP POST response from the CAPIF core function to the API publishing function and in the HTTP GET response from the CAPIF core function to the API invoker (discovery API). + aefProfiles: + type: array + items: + $ref: '#/components/schemas/AefProfile' + minItems: 1 + description: AEF profile information, which includes the exposed API details (e.g. protocol). + description: + type: string + description: Text description of the API + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + shareableInfo: + $ref: '#/components/schemas/ShareableInformation' + serviceAPICategory: + type: string + apiSuppFeats: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + pubApiPath: + $ref: '#/components/schemas/PublishedApiPath' + required: + - apiName + InterfaceDescription: + type: object + properties: + ipv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + port: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Port' + securityMethods: + type: array + items: + $ref: '#/components/schemas/SecurityMethod' + minItems: 1 + description: Security methods supported by the interface, it take precedence over the security methods provided in AefProfile, for this specific interface. + oneOf: + - required: [ipv4Addr] + - required: [ipv6Addr] + AefProfile: + type: object + properties: + aefId: + type: string + description: Identifier of the API exposing function + versions: + type: array + items: + $ref: '#/components/schemas/Version' + minItems: 1 + description: API version + protocol: + $ref: '#/components/schemas/Protocol' + dataFormat: + $ref: '#/components/schemas/DataFormat' + securityMethods: + type: array + items: + $ref: '#/components/schemas/SecurityMethod' + minItems: 1 + description: Security methods supported by the AEF + domainName: + type: string + description: Domain to which API belongs to + interfaceDescriptions: + type: array + items: + $ref: '#/components/schemas/InterfaceDescription' + minItems: 1 + description: Interface details + required: + - aefId + - versions + oneOf: + - required: [domainName] + - required: [interfaceDescriptions] + Resource: + type: object + properties: + resourceName: + type: string + description: Resource name + commType: + $ref: '#/components/schemas/CommunicationType' + uri: + type: string + description: Relative URI of the API resource, it is set as {apiSpecificResourceUriPart} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501. + custOpName: + type: string + description: it is set as {custOpName} part of the URI structure for a custom operation associated with a resource as defined in subclause 4.4 of 3GPP TS 29.501. + operations: + type: array + items: + $ref: '#/components/schemas/Operation' + minItems: 1 + description: Supported HTTP methods for the API resource. Only applicable when the protocol in AefProfile indicates HTTP. + description: + type: string + description: Text description of the API resource + required: + - resourceName + - commType + - uri + CustomOperation: + type: object + properties: + commType: + $ref: '#/components/schemas/CommunicationType' + custOpName: + type: string + description: it is set as {custOpName} part of the URI structure for a custom operation without resource association as defined in subclause 4.4 of 3GPP TS 29.501. + operations: + type: array + items: + $ref: '#/components/schemas/Operation' + minItems: 1 + description: Supported HTTP methods for the API resource. Only applicable when the protocol in AefProfile indicates HTTP. + description: + type: string + description: Text description of the custom operation + required: + - commType + - custOpName + Version: + type: object + properties: + apiVersion: + type: string + description: API major version in URI (e.g. v1) + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + resources: + type: array + items: + $ref: '#/components/schemas/Resource' + minItems: 1 + description: Resources supported by the API. + custOperations: + type: array + items: + $ref: '#/components/schemas/CustomOperation' + minItems: 1 + description: Custom operations without resource association. + required: + - apiVersion + ShareableInformation: + type: object + properties: + isShareable: + type: boolean + ccfProviderDomains: + type: array + items: + type: string + minItems: 1 + required: + - isShareable + PublishedApiPath: + type: object + properties: + ccfIds: + type: array + items: + type: string + minItems: 1 + description: A list of CCF identifiers where the service API is already published. + Protocol: + anyOf: + - type: string + enum: + - HTTP_1_1 + - HTTP_2 + - 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 + - HTTP_1_1: HTTP version 1.1 + - HTTP_2: HTTP version 2 + CommunicationType: + anyOf: + - type: string + enum: + - REQUEST_RESPONSE + - SUBSCRIBE_NOTIFY + - 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 + - REQUEST_RESPONSE: The communication is of the type request-response + - SUBSCRIBE_NOTIFY: The communication is of the type subscribe-notify + DataFormat: + anyOf: + - type: string + enum: + - JSON + - 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 + - JSON: JavaScript Object Notation + SecurityMethod: + anyOf: + - type: string + enum: + - PSK + - PKI + - OAUTH + - 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 + - PSK: Security method 1 (Using TLS-PSK) as described in 3GPP TS 33.122 + - PKI: Security method 2 (Using PKI) as described in 3GPP TS 33.122 + - OAUTH: Security method 3 (TLS with OAuth token) as described in 3GPP TS 33.122 + Operation: + anyOf: + - type: string + enum: + - GET + - POST + - PUT + - PATCH + - DELETE + - 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 + - GET: HTTP GET method + - POST: HTTP POST method + - PUT: HTTP PUT method + - PATCH: HTTP PATCH method + - DELETE: HTTP DELETE method diff --git a/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Security_API.yaml b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Security_API.yaml new file mode 100644 index 000000000..e9cdf3eee --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29222_CAPIF_Security_API.yaml @@ -0,0 +1,444 @@ +openapi: 3.0.0 +info: + title: CAPIF_Security_API + description: | + API for CAPIF security management. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.2" +externalDocs: + description: 3GPP TS 29.222 V16.1.0 Common API Framework for 3GPP Northbound APIs + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.222/ +servers: + - url: '{apiRoot}/capif-security/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 7.5 of 3GPP TS 29.222. +paths: + + /trustedInvokers/{apiInvokerId}: + get: + parameters: + - name: apiInvokerId + in: path + description: Identifier of an individual API invoker + required: true + schema: + type: string + - name: authenticationInfo + in: query + description: When set to 'true', it indicates the CAPIF core function to send the authentication information of the API invoker. Set to false or omitted otherwise. + schema: + type: boolean + - name: authorizationInfo + in: query + description: When set to 'true', it indicates the CAPIF core function to send the authorization information of the API invoker. Set to false or omitted otherwise. + schema: + type: boolean + responses: + '200': + description: The security related information of the API Invoker based on the request from the API exposing function. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceSecurity' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29122_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + parameters: + - name: apiInvokerId + in: path + description: Identifier of an individual API invoker + required: true + schema: + type: string + requestBody: + description: create a security context for an API invoker + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceSecurity' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SecurityNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Successful created. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceSecurity' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/capif-security/v1/trustedInvokers/{apiInvokerId}' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '414': + $ref: 'TS29122_CommonData.yaml#/components/responses/414' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + parameters: + - name: apiInvokerId + in: path + description: Identifier of an individual API invoker + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /trustedInvokers/{apiInvokerId}/update: + post: + parameters: + - name: apiInvokerId + in: path + description: Identifier of an individual API invoker + required: true + schema: + type: string + requestBody: + description: Update the security context (e.g. re-negotiate the security methods). + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceSecurity' + responses: + '200': + description: Successful updated. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceSecurity' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /trustedInvokers/{apiInvokerId}/delete: + post: + parameters: + - name: apiInvokerId + in: path + description: Identifier of an individual API invoker + required: true + schema: + type: string + requestBody: + description: Revoke the authorization of the API invoker for APIs. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SecurityNotification' + responses: + '204': + description: Successful revoked. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /securities/{securityId}/token: + post: + parameters: + - name: securityId + in: path + description: Identifier of an individual security instance + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/AccessTokenReq' + responses: + '200': + description: Successful Access Token Request + content: + application/json: + schema: + $ref: '#/components/schemas/AccessTokenRsp' + '400': + description: Error in the Access Token Request + content: + application/json: + schema: + $ref: '#/components/schemas/AccessTokenErr' + +components: + schemas: + ServiceSecurity: + type: object + properties: + securityInfo: + type: array + items: + $ref: '#/components/schemas/SecurityInformation' + minimum: 1 + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri' + requestTestNotification: + type: boolean + description: Set to true by API invoker to request the CAPIF core function to send a test notification as defined in in subclause 7.6. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - securityInfo + - notificationDestination + SecurityInformation: + type: object + properties: + interfaceDetails: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/InterfaceDescription' + aefId: + type: string + description: Identifier of the API exposing function + prefSecurityMethods: + type: array + items: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/SecurityMethod' + minItems: 1 + description: Security methods preferred by the API invoker for the API interface. + selSecurityMethod: + $ref: 'TS29222_CAPIF_Publish_Service_API.yaml#/components/schemas/SecurityMethod' + authenticationInfo: + type: string + description: Authentication related information + authorizationInfo: + type: string + description: Authorization related information + required: + - prefSecurityMethods + oneOf: + - required: [interfaceDetails] + - required: [aefId] + SecurityNotification: + type: object + properties: + apiInvokerId: + type: string + description: String identifying the API invoker assigned by the CAPIF core function + aefId: + type: string + description: String identifying the AEF. + apiIds: + type: array + items: + type: string + minItems: 1 + description: Identifier of the service API + cause: + $ref: '#/components/schemas/Cause' + required: + - apiInvokerId + - apiIds + - cause + AccessTokenReq: + format: x-www-form-urlencoded + properties: + grant_type: + type: string + enum: + - client_credentials + client_id: + type: string + client_secret: + type: string + scope: + type: string + required: + - grant_type + - client_id + AccessTokenRsp: + type: object + properties: + access_token: + type: string + description: JWS Compact Serialized representation of JWS signed JSON object (AccessTokenClaims) + token_type: + type: string + enum: + - Bearer + expires_in: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + scope: + type: string + required: + - access_token + - token_type + - expires_in + AccessTokenClaims: + type: object + properties: + iss: + type: string + scope: + type: string + exp: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + required: + - iss + - scope + - exp + AccessTokenErr: + type: object + properties: + error: + type: string + enum: + - invalid_request + - invalid_client + - invalid_grant + - unauthorized_client + - unsupported_grant_type + - invalid_scope + error_description: + type: string + error_uri: + type: string + required: + - error + Cause: + anyOf: + - type: string + enum: + - OVERLIMIT_USAGE + - UNEXPECTED_REASON + - 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 + - OVERLIMIT_USAGE: The revocation of the authorization of the API invoker is due to the overlimit usage of the service API + - UNEXPECTED_REASON: The revocation of the authorization of the API invoker is due to unexpected reason. \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29486_VAE_ApplicationRequirement.yaml b/lib/sbi/support/3gpp-spec/TS29486_VAE_ApplicationRequirement.yaml new file mode 100644 index 000000000..431447813 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29486_VAE_ApplicationRequirement.yaml @@ -0,0 +1,237 @@ +openapi: 3.0.0 +info: + version: 1.0.0.alpha-2 + title: VAE_ApplicationRequirement + description: | + API for VAE Application Requirement Service + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.486 V16.0.0 V2X Application Enabler (VAE) Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.486/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/vae-app-req/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +paths: + /application-requirements: + post: + summary: VAE_Application_Requirements resource create service Operation + tags: + - application requirements collection (Document) + operationId: CreateApplicationRequirement + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationRequirementData' + required: true + responses: + '201': + description: Application Requirement Resource Created + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/vae-app-req/v1/application-requirements/{requirementId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationRequirementData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + NotifyNetworkResource: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AppReqNotification' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-requirement/{requirementId}: + get: + summary: VAE Application Requirement resource read service Operation + tags: + - Individual application requirement (Document) + operationId: ReadApplicationRequirement + parameters: + - name: requirementId + in: path + description: Identifier of an application requirement resource + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationRequirementData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: VAE Application Requirement resource delete service Operation + tags: + - Individual application requirement (Document) + operationId: DeleteApplicationRequirement + parameters: + - name: requirementId + in: path + required: true + description: Unique ID of the application requirement to be deleted + schema: + type: string + responses: + '204': + description: The subscription was terminated successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + ApplicationRequirementData: + type: object + properties: + ueId: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xUeId' + groupId: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xGroupId' + duration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + serviceId: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xServiceId' + appRequirement: + $ref: '#/components/schemas/ApplicationRequirement' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + requestTestNotification: + type: boolean + description: Set to true by the NF service consumer to request the VAE server to send a test notification as defined in subclause 6.3.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - serviceId + - appRequirement + - notifUri + ApplicationRequirement: + type: object + properties: + serviceLevel: + $ref: '#/components/schemas/ServiceLevel' + AppReqNotification: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + result: + $ref: '#/components/schemas/ReservationResult' + required: + - resourceUri + - result + ServiceLevel: + anyOf: + - type: string + enum: + - HIGH + - MEDIUM + - LOW + - type: string + ReservationResult: + anyOf: + - type: string + enum: + - SUCCESSFUL + - FAILURE + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29486_VAE_DynamicGroup.yaml b/lib/sbi/support/3gpp-spec/TS29486_VAE_DynamicGroup.yaml new file mode 100644 index 000000000..16d61d453 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29486_VAE_DynamicGroup.yaml @@ -0,0 +1,223 @@ +openapi: 3.0.0 +info: + version: 1.0.0.alpha-1 + title: VAE_DynamicGroup + description: | + VAE_Dynamic_Group Service + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.486 V16.0.0 V2X Application Enabler (VAE) Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.486/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/vae-dynamic-group/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause clause 4.4 of 3GPP TS 29.501 +paths: + /group-configurations: + post: + summary: VAE_Dynamice_Group resource create service Operation + tags: + - application requirements collection (Document) + operationId: CreateGroupConfiguration + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupConfigurationData' + required: true + responses: + '201': + description: Application Requirement Resource Created + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/vae-group-configuration/v1/group-configurations/{configId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/GroupConfigurationData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + NotifyDynamicGroup: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DynamicGroupNotification' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /group-configuration/{configId}: + get: + summary: VAE Group Configuration resource read service Operation + tags: + - Individual Group Configuration(Document) + operationId: ReadDynamicGroupConfiguration + parameters: + - name: configId + in: path + description: Identifier of an group configuration resource + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/GroupConfigurationData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: VAE Group Configuration resource delete service Operation + tags: + - Individual group configuration (Document) + operationId: DeleteGroupConfiguration + parameters: + - name: configId + in: path + required: true + description: Unique ID of the group configuration to be deleted + schema: + type: string + responses: + '204': + description: The subscription was terminated successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + GroupConfigurationData: + type: object + properties: + groupId: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xGroupId' + definition: + type: string + leaderId: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xUeId' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + duration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + requestTestNotification: + type: boolean + description: Set to true by the NF service consumer to request the VAE server to send a test notification as defined in clause 6.4.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - groupId + - definition + - leaderId + - notifUri + DynamicGroupNotification: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + joinedUeIds: + type: array + items: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xUeId' + minItems: 1 + leftUeIds: + type: array + items: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xUeId' + minItems: 1 + required: + - resourceUri diff --git a/lib/sbi/support/3gpp-spec/TS29486_VAE_FileDistribution.yaml b/lib/sbi/support/3gpp-spec/TS29486_VAE_FileDistribution.yaml new file mode 100644 index 000000000..1ffd8f813 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29486_VAE_FileDistribution.yaml @@ -0,0 +1,213 @@ +openapi: 3.0.0 +info: + version: 1.0.0.alpha-3 + title: VAE_FileDistribution + description: | + API for VAE File Distribution Service + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.486 V16.0.0 V2X Application Enabler (VAE) Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.486/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/vae-file-distribution/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +paths: + /file-distributions: + post: + summary: VAE File Distributions resource create service Operation + tags: + - file distributions collection (Document) + operationId: CreateFileDistributions + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileDistributionData' + required: true + responses: + '201': + description: File Distribution Resource Created + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/vae-file-distribution/v1/file-distributions/{distributionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/FileDistributionData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_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' + default: + description: Unexpected error + /file-distributions/{distributionId}: + get: + summary: Get an existing individual file distribution resource + operationId: ReadIndividualFileDistribution + tags: + - Individual File Distribution (Document) + parameters: + - name: distributionId + in: path + description: Identifier of a file distribution resource + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/FileDistributionData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: VAE File Distribution resource delete service Operation + tags: + - Individual file distribution (Document) + operationId: DeleteFileDistribution + parameters: + - name: distributionId + in: path + required: true + description: Unique ID of the file distribution to be deleted + schema: + type: string + responses: + '204': + description: The subscription was terminated successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + FileDistributionData: + type: object + properties: + groupId: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xGroupId' + fileLists: + type: array + items: + $ref: '#/components/schemas/FileList' + minItems: 1 + serviceClass: + type: string + geoArea: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + maxBitrate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxDelay: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - fileLists + - geoArea + - maxBitrate + - maxDelay + FileList: + type: object + properties: + fileUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + fileDisplayUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + fileEarFetchTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + fileLatFetchTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + fileSize: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + fileStatus: + $ref: '#/components/schemas/FileStatus' + completionTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + keepUpdateInterval: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + uniAvailability: + type: boolean + fileRepetition: + type: integer + required: + - fileUri + - fileDisplayUri + - fileEarFetchTime + - fileLatFetchTime + - fileStatus + - completionTime + - keepUpdateInterval + + FileStatus: + anyOf: + - type: string + enum: + - PENDING + - FETCHED + - PREPARED + - TRANSMITTING + - SENT + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29486_VAE_MessageDelivery.yaml b/lib/sbi/support/3gpp-spec/TS29486_VAE_MessageDelivery.yaml new file mode 100644 index 000000000..16c88f519 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29486_VAE_MessageDelivery.yaml @@ -0,0 +1,383 @@ +openapi: 3.0.0 +info: + version: 1.0.0.alpha-4 + title: VAE_MessageDelivery + description: | + API for VAE Message Delivery Service + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.486 V16.0.0 V2X Application Enabler (VAE) Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.486/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/vae-message-delivery/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +paths: + /subscriptions: + post: + summary: Create a new Individual Message Delivery Data Subscription resource + operationId: CreateIndividualMessageDeliveryDataSubscription + tags: + - Message Delivery Data Subscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MessageDeliverySubscriptionData' + responses: + '201': + description: The subscription was created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/MessageDeliverySubscriptionData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + uplinkMessageDelivery: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UplinkMessageDeliveryData' + responses: + '204': + description: No Content, Notification was successful + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /subscriptions/{subscriptionId}: + get: + summary: Get an existing individual Message Delivery Subscription resource + operationId: ReadIndividualMessageDeliverySubscription + tags: + - Individual Message Delivery Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Message Delivery Subscription + required: true + schema: + type: string + responses: + '200': + description: The subscription information is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/MessageDeliverySubscriptionData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete an individual Message Delivery Subscription resource + operationId: DeleteMessageDeliverySubscription + tags: + - Individual Message Delivery Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Message Delivery Subscription + required: true + schema: + type: string + responses: + '204': + description: The subscription was terminated successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + /subscriptions/{subscriptionId}/message-deliveries: + post: + summary: VAE Message delivery resource create service Operation + tags: + - message deliveries collection (Collection) + operationId: CreateDownlinkMessageDelivery + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Message Delivery Subscription + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DownlinkMessageDeliveryData' + required: true + responses: + '201': + description: Downlink Message Delivery Resource Created + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/vae-message-delivery/v1/subscriptions/{subscriptionId}/message-deliveries/{dlDeliveryId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/DownlinkMessageDeliveryData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + description: Unexpected error + /subscriptions/{subscriptionId}/message-deliveries/{dlDeliveryId}: + get: + summary: VAE Message delivery resource Read service Operation + tags: + - Individual downlink message delivery (Document) + operationId: ReadIndividualDownlinkMessageDelivery + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Message Delivery Subscription + required: true + schema: + type: string + - name: dlDeliveryId + in: path + description: Identifier of a downlink messge delivery resource + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/DownlinkMessageDeliveryData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: VAE Message delivery resource delete service Operation + tags: + - Individual message delivery (Document) + operationId: DeleteMessageDelivery + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Message Delivery Subscription + required: true + schema: + type: string + - name: dlDeliveryId + in: path + required: true + description: Unique ID of the message delivery to be deleted + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + DownlinkMessageDeliveryData: + type: object + properties: + ueId: + $ref: '#/components/schemas/V2xUeId' + groupId: + $ref: '#/components/schemas/V2xGroupId' + duration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + geoId: + $ref: '#/components/schemas/GeoId' + payload: + $ref: '#/components/schemas/V2xMessagePayload' + required: + - payload + MessageDeliverySubscriptionData: + type: object + properties: + appSerId: + $ref: '#/components/schemas/AppServerId' + serviceId: + $ref: '#/components/schemas/V2xServiceId' + geoId: + $ref: '#/components/schemas/GeoId' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + requestTestNotification: + type: boolean + description: Set to true by the NF service consumer to request the VAE server to send a test notification as defined in clause 6.1.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - appSerId + - serviceId + - notifUri + UplinkMessageDeliveryData: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + ueId: + $ref: '#/components/schemas/V2xUeId' + geoId: + $ref: '#/components/schemas/GeoId' + payload: + $ref: '#/components/schemas/V2xMessagePayload' + required: + - resourceUri + - ueId + - payload + AppServerId: + type: string + V2xUeId: + type: string + V2xGroupId: + type: string + V2xServiceId: + type: string + GeoId: + type: string + V2xMessagePayload: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' diff --git a/lib/sbi/support/3gpp-spec/TS29486_VAE_ServiceContinuity.yaml b/lib/sbi/support/3gpp-spec/TS29486_VAE_ServiceContinuity.yaml new file mode 100644 index 000000000..b2b3e4e03 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29486_VAE_ServiceContinuity.yaml @@ -0,0 +1,91 @@ +openapi: 3.0.0 +info: + version: 1.0.0.alpha-1 + title: VAE_Service Continuity + description: | + API for VAE Service Continuity Service + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.486 V16.0.0 V2X Application Enabler (VAE) Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.486/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/vae-service-continuity/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +paths: + /geo-areas/{geoId}: + get: + summary: VAE service continuity query service operation + tags: + - Individual geographical area (Document) + operationId: QueryServiceContinuity + parameters: + - name: geoId + in: path + description: Identifier of a geographical area + required: true + schema: + type: string + - name: service-id + in: query + description: Identifier of a V2X service + required: true + schema: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xServiceId' + - name: supp-feat + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/V2xServiceInfo' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + V2xServiceInfo: + type: object + properties: + serviceIds: + type: array + items: + $ref: 'TS29486_VAE_MessageDelivery.yaml#/components/schemas/V2xServiceId' + minItems: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - serviceIds diff --git a/lib/sbi/support/3gpp-spec/TS29502_Nsmf_PDUSession.yaml b/lib/sbi/support/3gpp-spec/TS29502_Nsmf_PDUSession.yaml new file mode 100644 index 000000000..1d60f1cc1 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29502_Nsmf_PDUSession.yaml @@ -0,0 +1,2620 @@ +openapi: 3.0.0 + +info: + version: '1.1.0.alpha-1' + title: 'Nsmf_PDUSession' + description: | + SMF PDU Session Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +externalDocs: + description: 3GPP TS 29.502 V15.3.0; 5G System; Session Management Services; Stage 3 + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.502/ + +servers: + - url: '{apiRoot}/nsmf-pdusession/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. The sm-contexts and pdu-sessions resources can be distributed on different processing instances or hosts. Thus the authority and/or deployment-specific string of the apiRoot of the created individual sm context and pdu-session resources' URIs may differ from the authority and/or deployment-specific string of the apiRoot of the sm-contexts and pdu-sessions collections' URIs. + +security: + - {} + - oAuth2ClientCredentials: + - nsmf-pdusession + +paths: + /sm-contexts: + post: + summary: Create SM Context + tags: + - SM contexts collection + operationId: PostSmContexts + requestBody: + description: representation of the SM context to be created in the SMF + required: true + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + callbacks: + smContextStatusNotification: + '{$request.body#/smContextStatusUri}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextStatusNotification' + responses: + '204': + description: successful notification + '307': + description: temporary redirect + 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 + '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' + + responses: + '201': + description: successful creation of an SM context + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreatedData' + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmf-pdusession/{apiVersion}/sm-contexts/{smContextRef}' + required: true + schema: + type: string + + '307': + description: temporary 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' + required: true + 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' + required: true + schema: + type: string + '400': + description: unsuccessful creation of an SM context - bad request + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '403': + description: unsuccessful creation of an SM context - forbidden + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '404': + description: unsuccessful creation of an SM context - not found + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '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': + description: unsuccessful creation of an SM context - internal server error + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '503': + description: unsuccessful creation of an SM context - service unavailable + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + '504': + description: unsuccessful creation of an SM context - gateway timeout + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextCreateError' + binaryDataN1SmMessage: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + /sm-contexts/{smContextRef}/retrieve: + post: + summary: Retrieve SM Context + tags: + - Individual SM context + operationId: RetrieveSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: parameters used to retrieve the SM context + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextRetrieveData' + responses: + '200': + description: successful retrieval of an SM context + content: + application/json: + schema: + $ref: '#/components/schemas/SmContextRetrievedData' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/modify: + post: + summary: Update SM Context + tags: + - Individual SM context + operationId: UpdateSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the updates to apply to the SM context + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + binaryDataN2SmInformationExt1: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + responses: + '200': + description: successful update of an SM context with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdatedData' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '204': + description: successful update of an SM context without content in the response + '400': + description: unsuccessful update of an SM context - bad request + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '403': + description: unsuccessful update of an SM context - forbidden + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '404': + description: unsuccessful update of an SM context - not found + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + 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' + '415': + $ref: 'TS29571_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + description: unsuccessful update of an SM context - Internal server error + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '503': + description: unsuccessful update of an SM context - Service Unavailable + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextUpdateError' + binaryDataN1SmMessage: + type: string + format: binary + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmMessage: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /sm-contexts/{smContextRef}/release: + post: + summary: Release SM Context + tags: + - Individual SM context + operationId: ReleaseSmContext + parameters: + - name: smContextRef + in: path + description: SM context reference + required: true + schema: + type: string + requestBody: + description: representation of the data to be sent to the SMF when releasing the SM context + required: false + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/SmContextReleaseData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/SmContextReleaseData' + binaryDataN2SmInformation: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2SmInformation: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + + responses: + '204': + description: successful release of an SM context without content in the response + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + /pdu-sessions: + post: + summary: Create + tags: + - PDU sessions collection + operationId: PostPduSessions + requestBody: + description: representation of the PDU session to be created in the H-SMF + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreateData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + callbacks: + statusNotification: + '{$request.body#/vsmfPduSessionUri}': + post: + summary: Notify Status + tags: + - Individual PDU session (V-SMF) + operationId: NotifyStatus + requestBody: + description: representation of the status notification + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/StatusNotification' + responses: + '204': + description: successful notificationof the status change + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + + update: + '{$request.body#/vsmfPduSessionUri}/modify': + post: + summary: Update (initiated by H-SMF) + tags: + - Individual PDU session (V-SMF) + operationId: ModifyPduSession + requestBody: + description: representation of updates to apply to the PDU session + required: true + content: + application/+json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdateData' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '200': + description: successful update of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdatedData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/VsmfUpdateError' + '403': + $ref: '#/components/responses/VsmfUpdateError' + '404': + $ref: '#/components/responses/VsmfUpdateError' + '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: '#/components/responses/VsmfUpdateError' + '503': + $ref: '#/components/responses/VsmfUpdateError' + '504': + $ref: '#/components/responses/VsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + responses: + '201': + description: successful creation of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreatedData' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmf-pdusession/{apiVersion}/pdu-sessions/{pduSessionRef}' + required: true + schema: + type: string + '307': + description: temporary 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' + required: true + 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' + required: true + schema: + type: string + '400': + $ref: '#/components/responses/PduSessionCreateError' + '403': + $ref: '#/components/responses/PduSessionCreateError' + '404': + $ref: '#/components/responses/PduSessionCreateError' + '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: '#/components/responses/PduSessionCreateError' + '503': + $ref: '#/components/responses/PduSessionCreateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/modify: + post: + summary: Update (initiated by V-SMF) + tags: + - Individual PDU session (H-SMF) + operationId: UpdatePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the updates to apply to the PDU session + required: true + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdateData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdateData' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '200': + description: successful update of a PDU session with content in the response + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdatedData' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + '204': + description: successful update of a PDU session without content in the response + '400': + $ref: '#/components/responses/HsmfUpdateError' + '403': + $ref: '#/components/responses/HsmfUpdateError' + '404': + $ref: '#/components/responses/HsmfUpdateError' + '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: '#/components/responses/HsmfUpdateError' + '503': + $ref: '#/components/responses/HsmfUpdateError' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /pdu-sessions/{pduSessionRef}/release: + post: + summary: Release + tags: + - Individual PDU session (H-SMF) + operationId: ReleasePduSession + parameters: + - name: pduSessionRef + in: path + description: PDU session reference + required: true + schema: + type: string + requestBody: + description: representation of the data to be sent to H-SMF when releasing the PDU session + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/ReleaseData' + responses: + '204': + description: successful release of a PDU session + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nsmf-pdusession: Access to the nsmf-pdusession API + + schemas: +# +# STRUCTURED DATA TYPES +# + SmContextCreateData: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hplmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviceName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + requestType: + $ref: '#/components/schemas/RequestType' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + secondAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + smContextStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + additionalHsmfUri: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + oldPduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + pduSessionsActivateList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + minItems: 1 + ueEpsPdnConnection: + $ref: '#/components/schemas/EpsPdnCnxContainer' + hoState: + $ref: '#/components/schemas/HoState' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nrfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + backupAmfInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BackupAmfInfo' + minItems: 1 + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + indirectForwardingFlag: + type: boolean + targetId: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' + epsBearerCtxStatus: + $ref: '#/components/schemas/EpsBearerContextStatus' + cpCiotEnabled: + type: boolean + default: false + invokeNef: + type: boolean + default: false + maPduIndication: + type: boolean + default: false + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + smContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + required: + - servingNfId + - servingNetwork + - anType + - smContextStatusUri + + SmContextCreatedData: + type: object + properties: + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + allocatedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + hoState: + $ref: '#/components/schemas/HoState' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + smfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + + SmContextUpdateData: + type: object + properties: + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + backupAmfInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BackupAmfInfo' + minItems: 1 + nullable: true + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + secondAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceInLadn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + hoState: + $ref: '#/components/schemas/HoState' + toBeSwitched: + type: boolean + default: false + failedToBeSwitched: + type: boolean + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + targetId: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/NgRanTargetId' + targetServingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + smContextStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + dataForwarding: + type: boolean + default: false + epsBearerSetup: + type: array + items: + $ref: '#/components/schemas/EpsBearerContainer' + minItems: 0 + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + release: + type: boolean + default: false + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + anTypeCanBeChanged: + type: boolean + default: false + n2SmInfoExt1: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoTypeExt1: + $ref: '#/components/schemas/N2SmInfoType' + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + exemptionInd: + $ref: '#/components/schemas/ExemptionInd' + + SmContextUpdatedData: + type: object + properties: + upCnxState: + $ref: '#/components/schemas/UpCnxState' + hoState: + $ref: '#/components/schemas/HoState' + releaseEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + allocatedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + modifiedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + epsBearerSetup: + type: array + items: + $ref: '#/components/schemas/EpsBearerContainer' + minItems: 1 + dataForwarding: + type: boolean + cause: + $ref: '#/components/schemas/Cause' + + SmContextReleaseData: + type: object + properties: + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + vsmfReleaseOnly: + type: boolean + default: false + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + ismfReleaseOnly: + type: boolean + default: false + + SmContextStatusNotification: + type: object + properties: + statusInfo : + $ref: '#/components/schemas/StatusInfo' + required: + - statusInfo + + PduSessionCreateData: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + vsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + requestType: + $ref: '#/components/schemas/RequestType' + epsBearerId: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + pgwS8cFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + vsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + vcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + secondAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + hPcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + hoPreparationIndication: + type: boolean + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + alwaysOnRequested: + type: boolean + default: false + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + vSmfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + chargingId: + type: string + oldPduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + epsBearerCtxStatus: + $ref: '#/components/schemas/EpsBearerContextStatus' + amfNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + cpCiotEnabled: + type: boolean + default: false + invokeNef: + type: boolean + default: false + maPduIndication: + type: boolean + default: false + required: + - dnn + - vsmfId + - servingNetwork + - vsmfPduSessionUri + - anType + + PduSessionCreatedData: + type: object + properties: + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + type: string + pattern: '^[0-7]$' + hcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsSetupList: + type: array + items: + $ref: '#/components/schemas/QosFlowSetupItem' + minItems: 1 + hSmfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + enablePauseCharging: + type: boolean + default: false + ueIpv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + epsPdnCnxInfo: + $ref: '#/components/schemas/EpsPdnCnxInfo' + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + maxIntegrityProtectedDataRate: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + alwaysOnGranted: + type: boolean + default: false + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + roamingChargingProfile: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/RoamingChargingProfile' + hSmfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - pduSessionType + - sscMode + - hSmfInstanceId + + HsmfUpdateData: + type: object + properties: + requestIndication: + $ref: '#/components/schemas/RequestIndication' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + vcnTunnelInfo: + $ref: '#/components/schemas/TunnelInfo' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + secondAnType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + pauseCharging: + type: boolean + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + qosFlowsRelNotifyList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsNotifyList: + type: array + items: + $ref: '#/components/schemas/QosFlowNotifyItem' + minItems: 1 + NotifyList: + type: array + items: + $ref: '#/components/schemas/PduSessionNotifyItem' + minItems: 1 + epsBearerId: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 0 + hoPreparationIndication: + type: boolean + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + alwaysOnRequested: + type: boolean + default: false + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + anTypeCanBeChanged: + type: boolean + default: false + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + required: + - requestIndication + + HsmfUpdatedData: + type: object + properties: + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + + ReleaseData: + type: object + properties: + cause: + $ref: '#/components/schemas/Cause' + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + + + VsmfUpdateData: + type: object + properties: + requestIndication: + $ref: '#/components/schemas/RequestIndication' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsAddModRequestList: + type: array + items: + $ref: '#/components/schemas/QosFlowAddModifyRequestItem' + minItems: 1 + qosFlowsRelRequestList: + type: array + items: + $ref: '#/components/schemas/QosFlowReleaseRequestItem' + minItems: 1 + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + assignEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + revokeEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + modifiedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + alwaysOnGranted: + type: boolean + default: false + hsmfPduSessionUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + cause: + $ref: '#/components/schemas/Cause' + n1smCause: + type: string + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + maReleaseInd: + $ref: '#/components/schemas/MaReleaseIndication' + required: + - requestIndication + + VsmfUpdatedData: + type: object + properties: + qosFlowsAddModList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsRelList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsFailedtoAddModList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + qosFlowsFailedtoRelList: + type: array + items: + $ref: '#/components/schemas/QosFlowItem' + minItems: 1 + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + addUeLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + assignedEbiList: + type: array + items: + $ref: '#/components/schemas/EbiArpMapping' + minItems: 1 + failedToAssignEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + releasedEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + secondaryRatUsageReport: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageReport' + minItems: 1 + secondaryRatUsageInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SecondaryRatUsageInfo' + minItems: 1 + + StatusNotification: + type: object + properties: + statusInfo : + $ref: '#/components/schemas/StatusInfo' + required: + - statusInfo + + QosFlowItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + cause: + $ref: '#/components/schemas/Cause' + required: + - qfi + + QosFlowSetupItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + ebi: + $ref: '#/components/schemas/EpsBearerId' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowProfile: + $ref: '#/components/schemas/QosFlowProfile' + required: + - qfi + - qosRules + + QosFlowAddModifyRequestItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + ebi: + $ref: '#/components/schemas/EpsBearerId' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowProfile: + $ref: '#/components/schemas/QosFlowProfile' + required: + - qfi + + QosFlowReleaseRequestItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + qosRules: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + qosFlowDescription: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + required: + - qfi + + QosFlowProfile: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + nonDynamic5Qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NonDynamic5Qi' + dynamic5Qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dynamic5Qi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + gbrQosFlowInfo: + $ref: '#/components/schemas/GbrQosFlowInformation' + rqa: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ReflectiveQoSAttribute' + additionalQosFlowInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AdditionalQosFlowInfo' + required: + - 5qi + + GbrQosFlowInformation: + type: object + properties: + maxFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + guaFbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + notifControl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NotificationControl' + maxPacketLossRateDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + maxPacketLossRateUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRate' + required: + - maxFbrDl + - maxFbrUl + - guaFbrDl + - guaFbrUl + + QosFlowNotifyItem: + type: object + properties: + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + notificationCause: + $ref: '#/components/schemas/NotificationCause' + required: + - qfi + - notificationCause + + + SmContextRetrieveData: + type: object + properties: + targetMmeCap: + $ref: '#/components/schemas/MmeCapabilities' + smContextType: + $ref: '#/components/schemas/SmContextType' + + SmContextRetrievedData: + type: object + properties: + ueEpsPdnConnection: + $ref: '#/components/schemas/EpsPdnCnxContainer' + smContext: + $ref: '#/components/schemas/SmContext' + required: + - ueEpsPdnConnection + + MmeCapabilities: + type: object + properties: + nonIpSupported: + type: boolean + default: false + + TunnelInfo: + type: object + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + gtpTeid: + $ref: '#/components/schemas/Teid' + required: + - gtpTeid + + StatusInfo: + type: object + properties: + resourceStatus: + $ref: '#/components/schemas/ResourceStatus' + cause: + $ref: '#/components/schemas/Cause' + required: + - resourceStatus + + + EpsPdnCnxInfo: + type: object + properties: + pgwS8cFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + pgwNodeName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + required: + - pgwS8cFteid + + EpsBearerInfo: + type: object + properties: + ebi: + $ref: '#/components/schemas/EpsBearerId' + pgwS8uFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + bearerLevelQoS: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + required: + - ebi + - pgwS8uFteid + - bearerLevelQoS + + PduSessionNotifyItem: + type: object + properties: + notificationCause: + $ref: '#/components/schemas/NotificationCause' + required: + - notificationCause + + EbiArpMapping: + type: object + properties: + epsBearerId: + $ref: '#/components/schemas/EpsBearerId' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + required: + - epsBearerId + - arp + + SmContextCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + SmContextUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1SmMsg: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + n2SmInfoType: + $ref: '#/components/schemas/N2SmInfoType' + upCnxState: + $ref: '#/components/schemas/UpCnxState' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + PduSessionCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + HsmfUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoToUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + backOffTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + VsmfUpdateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pti: + $ref: '#/components/schemas/ProcedureTransactionId' + n1smCause: + type: string + pattern: '^[A-F0-9]{2}$' + n1SmInfoFromUe: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + unknownN1SmInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + failedToAssignEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCauseValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - error + + SmContext: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hplmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviceName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + smContextStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + hSmfUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + selMode: + $ref: '#/components/schemas/DnnSelectionMode' + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + epsInterworkingInd: + $ref: '#/components/schemas/EpsInterworkingIndication' + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + type: string + pattern: '^[0-7]$' + sessionAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + qosFlowsSetupList: + type: array + items: + $ref: '#/components/schemas/QosFlowSetupItem' + minItems: 1 + hSmfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + enablePauseCharging: + type: boolean + default: false + ueIpv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + epsPdnCnxInfo: + $ref: '#/components/schemas/EpsPdnCnxInfo' + epsBearerInfo: + type: array + items: + $ref: '#/components/schemas/EpsBearerInfo' + minItems: 1 + maxIntegrityProtectedDataRate: + $ref: '#/components/schemas/MaxIntegrityProtectedDataRate' + alwaysOnGranted: + type: boolean + default: false + upSecurity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UpSecurity' + hSmfServiceInstanceId: + type: string + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - pduSessionId + - dnn + - sNssai + - servingNfId + - servingNetwork + - anType + - smContextStatusUri + - pduSessionType + - sscMode + - sessionAmbr + - qosFlowsSetupList + + ExemptionInd: + type: object + properties: + dnnCongestion: + type: boolean + default: false + snssaiOnlyCongestion: + type: boolean + default: false + snssaiDnnCongestion: + type: boolean + default: false + +# +# SIMPLE DATA TYPES +# + ProcedureTransactionId: + type: integer + minimum: 0 + maximum: 255 + + EpsBearerId: + type: integer + minimum: 0 + maximum: 15 + + EpsPdnCnxContainer: + type: string + + EpsBearerContainer: + type: string + + Teid: + type: string + pattern: '^[A-F0-9]{8}$' + + EpsBearerContextStatus: + type: string + pattern: '^[A-Fa-f0-9]{4}$' +# +# ENUMERATIONS +# + UpCnxState: + anyOf: + - type: string + enum: + - ACTIVATED + - DEACTIVATED + - ACTIVATING + - 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 + - ACTIVATED + - DEACTIVATED + - ACTIVATING + + HoState: + anyOf: + - type: string + enum: + - NONE + - PREPARING + - PREPARED + - COMPLETED + - CANCELLED + - 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 + - NONE + - PREPARING + - PREPARED + - COMPLETED + - CANCELLED + + RequestType: + anyOf: + - type: string + enum: + - INITIAL_REQUEST + - EXISTING_PDU_SESSION + - INITIAL_EMERGENCY_REQUEST + - EXISTING_EMERGENCY_PDU_SESSION + - 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 + - INITIAL_REQUEST + - EXISTING_PDU_SESSION + - INITIAL_EMERGENCY_REQUEST + - EXISTING_EMERGENCY_PDU_SESSION + + RequestIndication: + anyOf: + - type: string + enum: + - 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 + - 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 + - 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 + + NotificationCause: + anyOf: + - type: string + enum: + - QOS_FULFILLED + - QOS_NOT_FULFILLED + - UP_SEC_FULFILLED + - UP_SEC_NOT_FULFILLED + - 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 + - QOS_FULFILLED + - QOS_NOT_FULFILLED + - UP_SEC_FULFILLED + - UP_SEC_NOT_FULFILLED + + Cause: + anyOf: + - type: string + enum: + - 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 + - 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 + - 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 + + ResourceStatus: + anyOf: + - type: string + enum: + - RELEASED + - 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 + - RELEASED + + DnnSelectionMode: + anyOf: + - type: string + enum: + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + - 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 + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + + EpsInterworkingIndication: + anyOf: + - type: string + enum: + - NONE + - WITH_N26 + - WITHOUT_N26 + - IWK_NON_3GPP + - 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 + - NONE + - WITH_N26 + - WITHOUT_N26 + - IWK_NON_3GPP + + N2SmInfoType: + anyOf: + - type: string + enum: + - 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 + - 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 + - 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 + + MaxIntegrityProtectedDataRate: + anyOf: + - type: string + enum: + - 64_KBPS + - MAX_UE_RATE + - 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 + - 64_KBPS + - MAX_UE_RATE + + MaReleaseIndication: + anyOf: + - type: string + enum: + - REL_MAPDU_OVER_3GPP + - REL_MAPDU_OVER_N3GPP + - 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 + - REL_MAPDU_OVER_3GPP + - REL_MAPDU_OVER_N3GPP + + SmContextType: + anyOf: + - type: string + enum: + - EPS_PDN_CONNECTION + - SM_CONTEXT + - 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 + - EPS_PDN_CONNECTION + - SM_CONTEXT + +# +# HTTP responses +# + responses: + 'PduSessionCreateError': + description: unsuccessful creation of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/PduSessionCreateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/PduSessionCreateError' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + 'HsmfUpdateError': + description: unsuccessful update of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/HsmfUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/HsmfUpdateError' + binaryDataN1SmInfoToUe: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoToUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + + 'VsmfUpdateError': + description: unsuccessful update of a PDU session + content: + application/json: # message without binary body part + schema: + $ref: '#/components/schemas/VsmfUpdateError' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/VsmfUpdateError' + binaryDataN1SmInfoFromUe: + type: string + format: binary + binaryDataUnknownN1SmInfo: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1SmInfoFromUe: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataUnknownN1SmInfo: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string diff --git a/lib/sbi/support/3gpp-spec/TS29503_Nudm_EE.yaml b/lib/sbi/support/3gpp-spec/TS29503_Nudm_EE.yaml new file mode 100644 index 000000000..0274ead74 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29503_Nudm_EE.yaml @@ -0,0 +1,8 @@ +openapi: 3.0.0 + +info: + version: '1.1.0.alpha-1' + title: 'Nudm_EE' + description: | + Nudm Event Exposure Service. + \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29503_Nudm_NIDDAU.yaml b/lib/sbi/support/3gpp-spec/TS29503_Nudm_NIDDAU.yaml new file mode 100644 index 000000000..5efdc40ec --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29503_Nudm_NIDDAU.yaml @@ -0,0 +1,120 @@ +openapi: 3.0.0 + +info: + version: '1.0.0.alpha-1' + title: 'Nudm_NIDDAU' + description: 'Nudm NIDD Authorization Service' + +externalDocs: + description: 3GPP TS 29.503 Unified Data Management Services, version 16.0.0 + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.503/' + +servers: + - url: '{apiRoot}/nudm-niddau/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501. + +security: + - oAuth2ClientCredentials: + - nudm-niddau + - {} + +paths: + /{ueIdentity}/authorization: + get: + summary: retrieve multiple data sets + operationId: GetAuthorizationData + tags: + - Retrieval of multiple data sets + parameters: + - name: ueIdentity + in: path + description: Represents the scope of the UE for which the NIDD Authorizations are retrieved. Contains the GPSI of the user or the external group ID. + required: true + schema: + type: string + pattern: '^(msisdn-[0-9]{5,15}|.+|extid-[^@]+@[^@]+|extgroupid-[^@]+@[^@]+)$' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: nssai + in: query + content: + application/json: + schema: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/Nssai' + - name: dnn + in: query + description: DNN + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + - name: mtcProviderInformation + in: query + description: mtcProviderInformation + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MtcProviderInformation' + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in RFC 7232, 3.2 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizationData' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + default: + description: Unexpected error + + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nudm-niddau: Access to the nudm-niddau API + + schemas: + +# COMPLEX TYPES: +# + AuthorizationData: + type: array + items: + $ref: '#/components/schemas/UserIdentifier' + minItems: 1 + uniqueItems: true + + UserIdentifier: + type: object + required: + - supi + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + + + + +# SIMPLE TYPES: + + + +# ENUMS: + + diff --git a/lib/sbi/support/3gpp-spec/TS29503_Nudm_PP.yaml b/lib/sbi/support/3gpp-spec/TS29503_Nudm_PP.yaml new file mode 100644 index 000000000..2b1ee1a67 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29503_Nudm_PP.yaml @@ -0,0 +1,8 @@ +openapi: 3.0.0 + +info: + version: '1.0.1' + title: 'Nudm_PP' + description: | + Nudm Parameter Provision Service. + \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29503_Nudm_SDM.yaml b/lib/sbi/support/3gpp-spec/TS29503_Nudm_SDM.yaml new file mode 100644 index 000000000..a34ec3bcc --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29503_Nudm_SDM.yaml @@ -0,0 +1,8 @@ +openapi: 3.0.0 + +info: + version: '2.1.0.alpha-1' + title: 'Nudm_SDM' + description: | + Nudm Subscriber Data Management Service. + \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29503_Nudm_UEAU.yaml b/lib/sbi/support/3gpp-spec/TS29503_Nudm_UEAU.yaml new file mode 100644 index 000000000..637714f4f --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29503_Nudm_UEAU.yaml @@ -0,0 +1,7 @@ +openapi: 3.0.0 +info: + version: '1.0.1' + title: 'NudmUEAU' + description: | + UDM UE Authentication Service. + \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29503_Nudm_UECM.yaml b/lib/sbi/support/3gpp-spec/TS29503_Nudm_UECM.yaml new file mode 100644 index 000000000..a9cba6a00 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29503_Nudm_UECM.yaml @@ -0,0 +1,8 @@ +openapi: 3.0.0 + +info: + version: '1.0.2' + title: 'Nudm_UECM' + description: | + Nudm Context Management Service. + \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29504_Nudr_DR.yaml b/lib/sbi/support/3gpp-spec/TS29504_Nudr_DR.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/lib/sbi/support/3gpp-spec/TS29507_Npcf_AMPolicyControl.yaml b/lib/sbi/support/3gpp-spec/TS29507_Npcf_AMPolicyControl.yaml new file mode 100644 index 000000000..4333ea606 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29507_Npcf_AMPolicyControl.yaml @@ -0,0 +1,586 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-4 + title: Npcf_AMPolicyControl + description: | + Access and Mobility Policy Control Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.507 V16.3.0; 5G System; Access and Mobility Policy Control Service. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.507/' +servers: + - url: '{apiRoot}/npcf-am-policy-control/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - npcf-am-policy-control +paths: + /policies: + post: + operationId: CreateIndividualAMPolicyAssociation + summary: Create individual AM policy association. + tags: + - AM Policy Associations (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociationRequest' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociation' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/npcf-am-policy-control/v1/policies/{polAssoId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + policyUpdateNotification: + '{$request.body#/notificationUri}/update': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyUpdate' + responses: + '204': + description: No Content, Notification was succesfull + '307': + description: temporary redirect + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + policyAssocitionTerminationRequestNotification: + '{$request.body#/notificationUri}/terminate': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TerminationNotification' + responses: + '204': + description: No Content, Notification was succesfull + '307': + description: temporary redirect + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /policies/{polAssoId}: + get: + operationId: ReadIndividualAMPolicyAssociation + summary: Read individual AM policy association. + tags: + - Individual AM Policy Association (Document) + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociation' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + operationId: DeleteIndividualAMPolicyAssociation + summary: Delete individual AM policy association. + tags: + - Individual AM Policy Association (Document) + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /policies/{polAssoId}/update: + post: + operationId: ReportObservedEventTriggersForIndividualAMPolicyAssociation + summary: Report obeserved event triggers and obtain updated policies for an individual AM policy association. + tags: + - Individual AM Policy Association (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociationUpdateRequest' + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Updated policies are returned + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyUpdate' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + npcf-am-policy-control: Access to the Npcf_AMPolicyControl API + schemas: + PolicyAssociation: + type: object + properties: + request: + $ref: '#/components/schemas/PolicyAssociationRequest' + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + description: Request Triggers that the PCF subscribes. Only values "LOC_CH" and "PRA_CH" are permitted. + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + smfSelInfo: + $ref: '#/components/schemas/SmfSelectionData' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + pras: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - suppFeat + PolicyAssociationRequest: + description: Information which the NF service consumer provides when requesting the creation of a policy association. The serviveName property corresponds to the serviceName in the main body of the specification. + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + altNotifIpv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + description: Alternate or backup IPv4 Address(es) where to send Notifications. + altNotifIpv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + description: Alternate or backup IPv6 Address(es) where to send Notifications. + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + accessTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + userLoc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + timeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + servingPlmn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ratTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 1 + groupIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + minItems: 1 + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + allowedSnssais: + description: array of allowed S-NSSAIs for the 3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + mappingSnssais: + description: mapping of each S-NSSAI of the Allowed NSSAI to the corresponding S-NSSAI of the HPLMN. + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/MappingOfSnssai' + minItems: 1 + n3gAllowedSnssais: + description: array of allowed S-NSSAIs for the Non-3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviveName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + traceReq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notificationUri + - suppFeat + - supi + PolicyAssociationUpdateRequest: + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + altNotifIpv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + description: Alternate or backup IPv4 Address(es) where to send Notifications. + altNotifIpv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + description: Alternate or backup IPv6 Address(es) where to send Notifications. + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + description: Request Triggers that the NF service consumer observes. + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + smfSelInfo: + $ref: '#/components/schemas/SmfSelectionData' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + praStatuses: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + description: Map of PRA status information. + userLoc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + allowedSnssais: + description: array of allowed S-NSSAIs for the 3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + mappingSnssais: + description: mapping of each S-NSSAI of the Allowed NSSAI to the corresponding S-NSSAI of the HPLMN. + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/MappingOfSnssai' + minItems: 1 + accessTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + ratTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 1 + n3gAllowedSnssais: + description: array of allowed S-NSSAIs for the Non-3GPP access. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + traceReq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + PolicyUpdate: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + nullable: true + description: Request Triggers that the PCF subscribes. Only values "LOC_CH" and "PRA_CH" are permitted. + servAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + wlServAreaRes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/WirelineServiceAreaRestriction' + rfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + smfSelInfo: + $ref: '#/components/schemas/SmfSelectionData' + ueAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + rgTmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + pras: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfoRm' + description: Map of PRA information. + minProperties: 1 + nullable: true + required: + - resourceUri + TerminationNotification: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + cause: + $ref: '#/components/schemas/PolicyAssociationReleaseCause' + required: + - resourceUri + - cause + SmfSelectionData: + type: object + properties: + unsuppDnn: + type: boolean + candidates: + type: object + additionalProperties: + $ref: '#/components/schemas/CandidateForReplacement' + minProperties: 1 + nullable: true + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + mappingSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + nullable: true + CandidateForReplacement: + type: object + properties: + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + nullable: true + required: + - snssai + nullable: true + RequestTrigger: + anyOf: + - type: string + enum: + - LOC_CH + - PRA_CH + - SERV_AREA_CH + - RFSP_CH + - ALLOWED_NSSAI_CH + - UE_AMBR_CH + - SMF_SELECT_CH + - ACCESS_TYPE_CH + - RG_TMBR_CH + - 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 + - LOC_CH: Location change (tracking area). The tracking area of the UE has changed. + - PRA_CH: Change of UE presence in PRA. The UE is entering/leaving a Presence Reporting Area. + - SERV_AREA_CH: Service Area Restriction change. The UDM notifies the AMF that the subscribed service area restriction information has changed. + - RFSP_CH: RFSP index change. The UDM notifies the AMF that the subscribed RFSP index has changed. + - ALLOWED_NSSAI_CH: Allowed NSSAI change. The AMF notifies that the set of UE allowed S-NSSAIs has changed. + - UE_AMBR_CH: UE-AMBR change. The UDM notifies the AMF that the subscribed UE-AMBR has changed. + - SMF_SELECT_CH: SMF selection information change. The UE requested for an unsupported DNN or UE requested for a DNN within the list of DNN candidates for replacement per S-NSSAI. + - ACCESS_TYPE_CH: Access Type change. The the AMF notifies that the access type and the RAT type combinations available in the AMF for a UE with simultaneous 3GPP and non-3GPP connectivity has changed. + - RG_TMBR_CH: Subscribed RG-TMBR change. The UDM notifies the AMF that the subscribed RG-TMBR has changed. + PolicyAssociationReleaseCause: + anyOf: + - type: string + enum: + - UNSPECIFIED + - UE_SUBSCRIPTION + - INSUFFICIENT_RES + - 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 + - UNSPECIFIED: This value is used for unspecified reasons. + - UE_SUBSCRIPTION: This value is used to indicate that the session needs to be terminated because the subscription of UE has changed (e.g. was removed). + - INSUFFICIENT_RES: This value is used to indicate that the server is overloaded and needs to abort the session. diff --git a/lib/sbi/support/3gpp-spec/TS29508_Nsmf_EventExposure.yaml b/lib/sbi/support/3gpp-spec/TS29508_Nsmf_EventExposure.yaml new file mode 100644 index 000000000..a0b9302af --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29508_Nsmf_EventExposure.yaml @@ -0,0 +1,545 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-4 + title: Nsmf_EventExposure + description: | + Session Management Event Exposure Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.508 V16.3.0; 5G System; Session Management Event Exposure Service. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.508/ +servers: + - url: '{apiRoot}/nsmf_event-exposure/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nsmf-event-exposure +paths: + /subscriptions: + post: + operationId: CreateIndividualSubcription + summary: Create an individual subscription for event notifications from the SMF + tags: + - Subscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NsmfEventExposure' + responses: + '201': + description: Success + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmf-event-exposure/v1/subscriptions/{subId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/NsmfEventExposure' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + myNotification: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NsmfEventExposureNotification' + responses: + '204': + description: No Content, Notification was succesfull + '307': + description: temporary redirect + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + afAcknowledgement: + '{request.body#/ackUri}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AckOfNotify' + responses: + '204': + description: No Content (successful acknowledgement) + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subId}: + get: + operationId: GetIndividualSubcription + summary: Read an individual subscription for event notifications from the SMF + tags: + - IndividualSubscription (Document) + parameters: + - name: subId + in: path + description: Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/NsmfEventExposure' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + operationId: ReplaceIndividualSubcription + summary: Replace an individual subscription for event notifications from the SMF + tags: + - IndividualSubscription (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NsmfEventExposure' + parameters: + - name: subId + in: path + description: Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource was succesfully modified and representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/NsmfEventExposure' + '204': + description: No Content. Resource was succesfully modified + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + operationId: DeleteIndividualSubcription + summary: Delete an individual subscription for event notifications from the SMF + tags: + - IndividualSubscription (Document) + parameters: + - name: subId + in: path + description: Event Subscription ID + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nsmf-event-exposure: Access to the Nsmf_EventExposure API + schemas: + NsmfEventExposure: + description: Represents an Individual SMF Notification Subscription resource. The serviveName property corresponds to the serviceName in the main body of the specification. + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + anyUeInd: + type: boolean + description: Any UE indication. This IE shall be present if the event subscription is applicable to any UE. Default value "FALSE" is used, if not present. + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + pduSeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + subId: + $ref: '#/components/schemas/SubId' + notifId: + type: string + description: Notification Correlation ID assigned by the NF service consumer. + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + altNotifIpv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + description: Alternate or backup IPv4 Addess(es) where to send Notifications. + minItems: 1 + altNotifIpv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + description: Alternate or backup IPv6 Addess(es) where to send Notifications. + minItems: 1 + eventSubs: + type: array + items: + $ref: '#/components/schemas/EventSubscription' + minItems: 1 + description: Subscribed events + ImmeRep: + type: boolean + notifMethod: + $ref: '#/components/schemas/NotificationMethod' + maxReportNbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + repPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviveName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + sampRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + grpRepTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + required: + - notifId + - notifUri + - eventSubs + NsmfEventExposureNotification: + type: object + properties: + notifId: + type: string + description: Notification correlation ID + eventNotifs: + type: array + items: + $ref: '#/components/schemas/EventNotification' + minItems: 1 + description: Notifications about Individual Events + ackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + required: + - notifId + - eventNotifs + EventSubscription: + type: object + properties: + event: + $ref: '#/components/schemas/SmfEvent' + dnaiChgType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DnaiChangeType' + dddTraDescriptors: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' + minItems: 1 + dddStati: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DlDataDeliveryStatus' + minItems: 1 + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + required: + - event + EventNotification: + type: object + properties: + event: + $ref: '#/components/schemas/SmfEvent' + timeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + sourceDnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + targetDnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + dnaiChgType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DnaiChangeType' + sourceUeIpv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + sourceUeIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + targetUeIpv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + targetUeIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + sourceTraRouting: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + targetTraRouting: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + ueMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + adIpv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + adIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + reIpv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + reIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + accType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + pduSeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + dddStatus: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DlDataDeliveryStatus' + dddTraDescriptor: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DddTrafficDescriptor' + maxWaitTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + commFailure: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/CommunicationFailure' + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Prefixes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + minItems: 1 + ipv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + pduSessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + qfi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + ethfDescs: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + maxItems: 2 + fDescs: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/FlowDescription' + minItems: 1 + maxItems: 2 + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + ulDelays: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + minItems: 1 + dlDelays: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + minItems: 1 + rtDelays: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + minItems: 1 + required: + - event + - timeStamp + SubId: + type: string + format: SubId + description: Identifies an Individual SMF Notification Subscription. To enable that the value is used as part of a URI, the string shall only contain characters allowed according to the "lower-with-hyphen" naming convention defined in 3GPP TS 29.501 [2]. In an OpenAPI [10] schema, the format shall be designated as "SubId". + AckOfNotify: + type: object + properties: + notifId: + type: string + ackResult: + $ref: 'TS29522_TrafficInfluence.yaml#/components/schemas/AfResultInfo' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + required: + - notifId + - ackResult + SmfEvent: + anyOf: + - type: string + enum: + - AC_TY_CH + - UP_PATH_CH + - PDU_SES_REL + - PLMN_CH + - UE_IP_CH + - DDDS + - COMM_FAIL + - PDU_SES_EST + - QFI_ALLOC + - QOS_MON + - 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 + - AC_TY_CH: Access Type Change + - UP_PATH_CH: UP Path Change + - PDU_SES_REL: PDU Session Release + - PLMN_CH: PLMN Change + - UE_IP_CH: UE IP address change + - DDDS: Downlink data delivery status + - COMM_FAIL: Communication Failure + - PDU_SES_EST: PDU Session Establishment + - QFI_ALLOC: QFI allocation + - QOS_MON: QoS Monitoring + NotificationMethod: + anyOf: + - type: string + enum: + - PERIODIC + - ONE_TIME + - ON_EVENT_DETECTION + - 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 + - PERIODIC + - ONE_TIME + - ON_EVENT_DETECTION diff --git a/lib/sbi/support/3gpp-spec/TS29509_Nausf_SoRProtection.yaml b/lib/sbi/support/3gpp-spec/TS29509_Nausf_SoRProtection.yaml new file mode 100644 index 000000000..a80064a00 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29509_Nausf_SoRProtection.yaml @@ -0,0 +1,128 @@ +openapi: 3.0.0 +info: + version: 1.0.2 + title: Nausf_SoRProtection Service + description: | + AUSF SoR Protection Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +servers: + - url: '{apiRoot}/nausf-sorprotection/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nausf-sorprotection +paths: + /{supi}/ue-sor: + post: + parameters: + - name: supi + 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/SorInfo' + required: true + responses: + '200': + description: SorSecurityInfo + content: + application/json: + schema: + $ref: '#/components/schemas/SorSecurityInfo' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nausf-sorprotection: Access to the Nausf_SoRProtection API + schemas: + SorInfo: + type: object + properties: + steeringContainer: + $ref: '#/components/schemas/SteeringContainer' + ackInd: + $ref: '#/components/schemas/AckInd' + required: + - ackInd + SorSecurityInfo: + type: object + properties: + sorMacIausf: + $ref: '#/components/schemas/SorMac' + counterSor: + $ref: '#/components/schemas/CounterSor' + sorXmacIue: + $ref: '#/components/schemas/SorMac' + required: + - sorMacIausf + - counterSor + SteeringContainer: + oneOf: + - type: array + items: + $ref: 'TS29509_Nausf_SoRProtection.yaml#/components/schemas/SteeringInfo' + minItems: 1 + - $ref: '#/components/schemas/SecuredPacket' + SteeringInfo: + type: object + properties: + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + accessTechList: + type: array + items: + $ref: '#/components/schemas/AccessTech' + minItems: 1 + required: + - plmnId + SorMac: + type: string + pattern: '^[A-Fa-f0-9]{32}$' + CounterSor: + type: string + pattern: '^[A-Fa-f0-9]{4}$' + AckInd: + type: boolean + SecuredPacket: + type: string + format: base64 + AccessTech: + anyOf: + - type: string + enum: + - NR + - EUTRAN_IN_WBS1_MODE_AND_NBS1_MODE + - EUTRAN_IN_NBS1_MODE_ONLY + - EUTRAN_IN_WBS1_MODE_ONLY + - UTRAN + - GSM_AND_ECGSM_IoT + - GSM_WITHOUT_ECGSM_IoT + - ECGSM_IoT_ONLY + - CDMA_1xRTT + - CDMA_HRPD + - GSM_COMPACT + - type: string +externalDocs: + description: 3GPP TS 29.509 V15.3.0; 5G System; Authentication Server Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.509' diff --git a/lib/sbi/support/3gpp-spec/TS29509_Nausf_UEAuthentication.yaml b/lib/sbi/support/3gpp-spec/TS29509_Nausf_UEAuthentication.yaml new file mode 100644 index 000000000..98faf2e46 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29509_Nausf_UEAuthentication.yaml @@ -0,0 +1,275 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-1 + title: AUSF API + description: | + AUSF UE Authentication Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +servers: + - url: '{apiRoot}/nausf-auth/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501. + +security: + - {} + - oAuth2ClientCredentials: + - nausf-auth +paths: + /ue-authentications: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthenticationInfo' + required: true + responses: + '201': + description: UEAuthenticationCtx + content: + application/3gppHal+json: + schema: + $ref: '#/components/schemas/UEAuthenticationCtx' + headers: + Location: + description: 'Contains the URI of the newly created resource according to the structure: {apiRoot}/nausf-auth/v1/ue-authentications/{authCtxId}' + required: true + schema: + type: string + + '400': + description: Bad Request from the AMF + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Forbidden due to serving network not authorized + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + /ue-authentications/{authCtxId}/5g-aka-confirmation: + put: + parameters: + - name: authCtxId + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConfirmationData' + responses: + '200': + description: Request processed (EAP success or Failure) + content: + application/json: + schema: + $ref: '#/components/schemas/ConfirmationDataResponse' + + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + /ue-authentications/{authCtxId}/eap-session: + post: + operationId: EapAuthMethod + parameters: + - name: authCtxId + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EapSession' + responses: + '200': + description: Use to handle or close the EAP session + content: + application/json: + schema: + $ref: '#/components/schemas/EapSession' + + application/3gppHal+json: + schema: + type: object + properties: + eapPayload: + $ref: '#/components/schemas/EapPayload' + _links: + type: object + description: 'URI : /{eapSessionUri}' + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/LinksValueSchema' + minProperties: 1 + required: + - eapPayload + - _links + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nausf-auth: Access to Nausf_UEAuthentication API + schemas: + AuthenticationInfo: + type: object + properties: + supiOrSuci: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/SupiOrSuci' + servingNetworkName: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + resynchronizationInfo: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ResynchronizationInfo' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + pattern: '^[0-9]{1,4}$' + required: + - supiOrSuci + - servingNetworkName + UEAuthenticationCtx: + type: object + properties: + authType: + $ref: '#/components/schemas/AuthType' + 5gAuthData: + oneOf: + - $ref: '#/components/schemas/Av5gAka' + - $ref: '#/components/schemas/EapPayload' + _links: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/LinksValueSchema' + servingNetworkName: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/ServingNetworkName' + required: + - authType + - 5gAuthData + - _links + + Av5gAka: + type: object + required: + - rand + - hxresStar + - autn + properties: + rand: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/Rand' + hxresStar: + $ref: '#/components/schemas/HxresStar' + autn: + $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/Autn' + ConfirmationData: + type: object + required: + - resStar + properties: + resStar: + $ref: '#/components/schemas/ResStar' + ConfirmationDataResponse: + type: object + properties: + authResult: + $ref: '#/components/schemas/AuthResult' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + kseaf: + $ref: '#/components/schemas/Kseaf' + + required: + - authResult + EapSession: + type: object + properties: + eapPayload: + $ref: '#/components/schemas/EapPayload' + kSeaf: + $ref: '#/components/schemas/Kseaf' + _links: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/LinksValueSchema' + authResult: + $ref: '#/components/schemas/AuthResult' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + required: + - eapPayload + + AuthResult: + type: string + enum: + - AUTHENTICATION_SUCCESS + - AUTHENTICATION_FAILURE + - AUTHENTICATION_ONGOING + EapPayload: + type: string + format: base64 + description: contains an EAP packet + Kseaf: + type: string + pattern: '[A-Fa-f0-9]{64}' + ResStar: + type: string + pattern: '[A-Fa-f0-9]{32}' + nullable: true + HxresStar: + type: string + pattern: "[A-Fa-f0-9]{32}" + AuthType: + anyOf: + - type: string + enum: + - 5G_AKA + - EAP_AKA_PRIME + - EAP_TLS + - type: string +externalDocs: + description: 3GPP TS 29.509 V15.3.0; 5G System; 3GPP TS Authentication Server services. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.509 diff --git a/lib/sbi/support/3gpp-spec/TS29509_Nausf_UPUProtection.yaml b/lib/sbi/support/3gpp-spec/TS29509_Nausf_UPUProtection.yaml new file mode 100644 index 000000000..9709e991e --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29509_Nausf_UPUProtection.yaml @@ -0,0 +1,109 @@ +openapi: 3.0.0 +info: + version: 1.0.1 + title: Nausf_UPUProtection Service + description: | + AUSF UPU Protection Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +servers: + - url: '{apiRoot}/nausf-upuprotection/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nausf-upuprotection +paths: + /{supi}/ue-upu: + post: + parameters: + - name: supi + 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/UpuInfo' + required: true + responses: + '200': + description: UpuSecurityInfo + content: + application/json: + schema: + $ref: '#/components/schemas/UpuSecurityInfo' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nausf-upuprotection: Access to the Nausf_UPUProtection API + schemas: + UpuInfo: + type: object + properties: + upuDataList: + type: array + items: + $ref: '#/components/schemas/UpuData' + minItems: 1 + upuAckInd: + $ref: '#/components/schemas/UpuAckInd' + required: + - upuDataList + - upuAckInd + UpuSecurityInfo: + type: object + properties: + upuMacIausf: + $ref: '#/components/schemas/UpuMac' + counterUpu: + $ref: '#/components/schemas/CounterUpu' + upuXmacIue: + $ref: '#/components/schemas/UpuMac' + required: + - upuMacIausf + - counterUpu + UpuData: + type: object + properties: + secPacket: + $ref: 'TS29509_Nausf_SoRProtection.yaml#/components/schemas/SecuredPacket' + defaultConfNssai: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + oneOf: + - required: [secPacket] + - required: [defaultConfNssai] + UpuMac: + type: string + pattern: '^[A-Fa-f0-9]{32}$' + CounterUpu: + type: string + pattern: '^[A-Fa-f0-9]{4}$' + UpuAckInd: + type: boolean + +externalDocs: + description: 3GPP TS 29.509 V15.3.0; 5G System; Authentication Server Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.509' diff --git a/lib/sbi/support/3gpp-spec/TS29510_Nnrf_AccessToken.yaml b/lib/sbi/support/3gpp-spec/TS29510_Nnrf_AccessToken.yaml new file mode 100644 index 000000000..ef9561a10 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29510_Nnrf_AccessToken.yaml @@ -0,0 +1,177 @@ +openapi: 3.0.0 +info: + version: '1.0.2' + title: 'NRF OAuth2' + description: | + NRF OAuth2 Authorization. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +paths: + /oauth2/token: + post: + summary: Access Token Request + operationId: AccessTokenRequest + tags: + - Access Token Request + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/AccessTokenReq' + required: true + responses: + '200': + description: Successful Access Token Request + content: + application/json: + schema: + $ref: '#/components/schemas/AccessTokenRsp' + headers: + Cache-Control: + $ref: '#/components/headers/cache-control' + Pragma: + $ref: '#/components/headers/pragma' + '307': + description: Temporary Redirect + '400': + description: Error in the Access Token Request + content: + application/json: + schema: + $ref: '#/components/schemas/AccessTokenErr' + headers: + Cache-Control: + $ref: '#/components/headers/cache-control' + Pragma: + $ref: '#/components/headers/pragma' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + headers: + cache-control: + required: true + schema: + type: string + enum: + - no-store + pragma: + required: true + schema: + type: string + enum: + - no-cache + schemas: + AccessTokenReq: + type: object + required: + - grant_type + - nfInstanceId + - scope + properties: + grant_type: + type: string + enum: + - client_credentials + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + targetNfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + scope: + type: string + 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' + targetPlmn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + AccessTokenRsp: + type: object + required: + - access_token + - token_type + properties: + access_token: + type: string + description: JWS Compact Serialized representation of JWS signed JSON object (AccessTokenClaims) + token_type: + type: string + enum: + - Bearer + expires_in: + type: integer + scope: + type: string + pattern: '^([a-zA-Z0-9_-]+)( [a-zA-Z0-9_-]+)*$' + AccessTokenClaims: + type: object + required: + - iss + - sub + - aud + - scope + - exp + properties: + iss: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + sub: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + aud: + anyOf: + - $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + - type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + scope: + type: string + pattern: '^([a-zA-Z0-9_-]+)( [a-zA-Z0-9_-]+)*$' + exp: + type: integer + consumerPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + producerPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + AccessTokenErr: + type: object + required: + - error + properties: + error: + type: string + enum: + - invalid_request + - invalid_client + - invalid_grant + - unauthorized_client + - unsupported_grant_type + - invalid_scope + error_description: + type: string + error_uri: + type: string +externalDocs: + description: 3GPP TS 29.510 V15.3.0; 5G System; Network Function Repository Services; Stage 3 + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' diff --git a/lib/sbi/support/3gpp-spec/TS29510_Nnrf_NFDiscovery.yaml b/lib/sbi/support/3gpp-spec/TS29510_Nnrf_NFDiscovery.yaml new file mode 100644 index 000000000..377e9fbe7 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29510_Nnrf_NFDiscovery.yaml @@ -0,0 +1,691 @@ +openapi: 3.0.0 +info: + version: '1.1.0.alpha-1' + title: 'NRF NFDiscovery Service' + description: | + NRF NFDiscovery Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +servers: + - url: '{apiRoot}/nnrf-disc/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nnrf-disc +paths: + /nf-instances: + get: + summary: Search a collection of NF Instances + operationId: SearchNFInstances + tags: + - NF Instances (Store) + parameters: + - name: target-nf-type + in: query + description: Type of the target NF + required: true + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + - name: requester-nf-type + in: query + description: Type of the requester NF + required: true + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + - name: requester-nf-instance-id + in: query + description: NfInstanceId of the requester NF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: service-names + in: query + description: Names of the services offered by the NF + schema: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + minItems: 1 + uniqueItems: true + style: form + explode: false + - name: requester-nf-instance-fqdn + in: query + description: FQDN of the requester NF + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: target-plmn-list + in: query + description: Id of the PLMN of the target NF + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + - name: requester-plmn-list + in: query + description: Id of the PLMN where the NF issuing the Discovery request is located + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + - name: target-nf-instance-id + in: query + description: Identity of the NF instance being discovered + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: target-nf-fqdn + in: query + description: FQDN of the NF instance being discovered + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: hnrf-uri + in: query + description: Uri of the home NRF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + - name: snssais + in: query + description: Slice info of the target NF + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + - name: requester-snssais + in: query + description: Slice info of the requester NF + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + - name: plmn-specific-snssai-list + in: query + description: PLMN specific Slice info of the target NF + 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 + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + - name: nsi-list + in: query + description: NSI IDs that are served by the services being discovered + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: smf-serving-area + in: query + schema: + type: string + - name: tai + in: query + description: Tracking Area Identity + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + - name: amf-region-id + in: query + description: AMF Region Identity + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfRegionId' + - name: amf-set-id + in: query + description: AMF Set Identity + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfSetId' + - name: guami + in: query + description: Guami used to search for an appropriate AMF + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + - name: supi + in: query + description: SUPI of the user + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: ue-ipv4-address + in: query + description: IPv4 address of the UE + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + - name: ip-domain + in: query + description: IP domain of the UE, which supported by BSF + schema: + type: string + - name: ue-ipv6-prefix + in: query + description: IPv6 prefix of the UE + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + - name: pgw-ind + in: query + description: Combined PGW-C and SMF or a standalone SMF + schema: + type: boolean + - name: pgw + in: query + description: PGW FQDN of a combined PGW-C and SMF + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: gpsi + in: query + description: GPSI of the user + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + - name: external-group-identity + in: query + description: external group identifier of the user + schema: + type: string + - name: data-set + in: query + description: data set supported by the NF + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DataSetId' + - name: routing-indicator + in: query + description: routing indicator in SUCI + schema: + type: string + pattern: '^[0-9]{1,4}$' + - name: group-id-list + in: query + description: Group IDs of the NFs being discovered + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + minItems: 1 + style: form + explode: false + - name: dnai-list + in: query + description: Data network access identifiers of the NFs being discovered + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + style: form + explode: false + - name: pdu-session-types + in: query + description: list of PDU Session Type required to be supported by the target NF + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + minItems: 1 + style: form + explode: false + - name: event-id-list + in: query + description: Analytics event(s) requested to be supported by the Nnwdaf_AnalyticsInfo service + schema: + type: array + items: + $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/EventId' + minItems: 1 + style: form + explode: false + - name: nwdaf-event-list + in: query + description: Analytics event(s) requested to be supported by the Nnwdaf_EventsSubscription service. + schema: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NwdafEvent' + minItems: 1 + style: form + explode: false + - name: supported-features + in: query + description: Features required to be supported by the target NF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: upf-iwk-eps-ind + in: query + description: UPF supporting interworking with EPS or not + schema: + type: boolean + - name: chf-supported-plmn + in: query + description: PLMN ID supported by a CHF + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: preferred-locality + in: query + description: preferred target NF location + schema: + type: string + - name: access-type + in: query + description: AccessType supported by the target NF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + - name: limit + in: query + description: Maximum number of NFProfiles to return in the response + required: false + schema: + type: integer + minimum: 1 + - name: required-features + in: query + description: Features required to be supported by the target NF + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + minItems: 1 + style: form + explode: false + - name: complex-query + in: query + description: the complex query condition expression + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ComplexQuery' + - name: max-payload-size + in: query + description: Maximum payload size of the response expressed in kilo octets + required: false + schema: + type: integer + maximum: 2000 + default: 124 + - name: atsss-capability + in: query + description: ATSSS Capability + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AtsssCapability' + - name: upf-ue-ip-addr-ind + in: query + description: UPF supporting allocating UE IP addresses/prefixes + schema: + type: boolean + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in IETF RFC 7232, 3.2 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/SearchResult' + links: + search: + operationId: RetrieveStoredSearch + parameters: + searchId: $response.body#/searchId + description: > + The 'searchId' parameter returned in the response can be used as the + 'searchId' parameter in the GET request to '/searches/{searchId}' + completeSearch: + operationId: RetrieveCompleteSearch + parameters: + searchId: $response.body#/searchId + description: > + The 'searchId' parameter returned in the response can be used as the + 'searchId' parameter in the GET request to '/searches/{searchId}/complete' + headers: + Cache-Control: + description: Cache-Control containing max-age, described in IETF RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag containing a strong validator, described in IETF RFC 7232, 2.3 + schema: + type: string + '307': + description: Temporary Redirect + 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': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /searches/{searchId}: + get: + operationId: RetrieveStoredSearch + tags: + - Stored Search (Document) + parameters: + - $ref: '#/components/parameters/searchId' + responses: + '200': + $ref: '#/components/responses/200' + + /searches/{searchId}/complete: + get: + operationId: RetrieveCompleteSearch + tags: + - Complete Stored Search (Document) + parameters: + - $ref: '#/components/parameters/searchId' + responses: + '200': + $ref: '#/components/responses/200' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '/oauth2/token' + scopes: + nnrf-disc: Access to the Nnrf_NFDiscovery API + parameters: + searchId: + name: searchId + in: path + description: Id of a stored search + required: true + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/StoredSearchResult' + headers: + Cache-Control: + description: Cache-Control containing max-age, described in IETF RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag containing a strong validator, described in IETF RFC 7232, 2.3 + schema: + type: string + schemas: + SearchResult: + type: object + required: + - nfInstances + properties: + validityPeriod: + type: integer + nfInstances: + type: array + items: + $ref: '#/components/schemas/NFProfile' + searchId: + type: string + numNfInstComplete: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + nrfSupportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + StoredSearchResult: + type: object + required: + - nfInstances + properties: + nfInstances: + type: array + items: + $ref: '#/components/schemas/NFProfile' + NFProfile: + type: object + required: + - nfInstanceId + - nfType + - nfStatus + properties: + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nfInstanceName: + type: string + nfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + nfStatus: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFStatus' + plmnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + sNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + perPlmnSnssaiList: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' + minItems: 1 + nsiList: + type: array + items: + type: string + minItems: 1 + fqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + ipv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + locality: + type: string + priority: + type: integer + minimum: 0 + maximum: 65535 + udrInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' + udrInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' + minItems: 1 + udmInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' + udmInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' + minItems: 1 + ausfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' + ausfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' + minItems: 1 + amfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' + amfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' + minItems: 1 + smfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' + smfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' + minItems: 1 + upfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' + upfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' + minItems: 1 + pcfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' + pcfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' + minItems: 1 + bsfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' + bsfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' + minItems: 1 + chfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' + chfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' + minItems: 1 + nwdafInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NwdafInfo' + customInfo: + type: object + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + nfServicePersistence: + type: boolean + default: false + nfServices: + type: array + items: + $ref: '#/components/schemas/NFService' + minItems: 1 + defaultNotificationSubscriptions: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DefaultNotificationSubscription' + NFService: + type: object + required: + - serviceInstanceId + - serviceName + - versions + - scheme + - nfServiceStatus + properties: + serviceInstanceId: + type: string + serviceName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + versions: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceVersion' + minItems: 1 + scheme: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UriScheme' + nfServiceStatus: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceStatus' + fqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + ipEndPoints: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/IpEndPoint' + minItems: 1 + apiPrefix: + type: string + defaultNotificationSubscriptions: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DefaultNotificationSubscription' + minItems: 1 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + priority: + type: integer + minimum: 0 + maximum: 65535 + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + chfServiceInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfServiceInfo' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' +externalDocs: + description: 3GPP TS 29.510 V15.3.0; 5G System; Network Function Repository Services; Stage 3 + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' diff --git a/lib/sbi/support/3gpp-spec/TS29510_Nnrf_NFManagement.yaml b/lib/sbi/support/3gpp-spec/TS29510_Nnrf_NFManagement.yaml new file mode 100644 index 000000000..7a6c3c1ea --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29510_Nnrf_NFManagement.yaml @@ -0,0 +1,1616 @@ +openapi: 3.0.0 +info: + version: '1.1.0.alpha-1' + title: 'NRF NFManagement Service' + description: | + NRF NFManagement Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +servers: + - url: '{apiRoot}/nnrf-nfm/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nnrf-nfm +paths: + /nf-instances: + get: + summary: Retrieves a collection of NF Instances + operationId: GetNFInstances + tags: + - NF Instances (Store) + parameters: + - name: nf-type + in: query + description: Type of NF + required: false + schema: + $ref: '#/components/schemas/NFType' + - name: limit + in: query + description: How many items to return at one time + required: false + schema: + type: integer + responses: + '200': + description: Expected response to a valid request + content: + application/3gppHal+json: + schema: + type: object + properties: + _links: + type: object + description: 'List of the URI of NF instances. It has two members whose names are item and self. The item one contains an array of URIs.' + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/LinksValueSchema' + minProperties: 1 + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + options: + summary: Discover communication options supported by NRF for NF Instances + operationId: OptionsNFInstances + tags: + - NF Instances (Store) + responses: + '200': + description: OK + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '405': + $ref: 'TS29571_CommonData.yaml#/components/responses/405' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /nf-instances/{nfInstanceID}: + get: + summary: Read the profile of a given NF Instance + operationId: GetNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + description: Unique ID of the NF Instance + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Register a new NF Instance + operationId: RegisterNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + required: true + description: Unique ID of the NF Instance to register + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: Content-Encoding + in: header + description: Content-Encoding, described in IETF RFC 7231 + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + required: true + responses: + '200': + description: OK (Profile Replacement) + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '201': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnrf-nfm/v1/nf-instances/{nfInstanceId}' + required: true + schema: + type: string + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Update NF Instance profile + operationId: UpdateNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + required: true + description: Unique ID of the NF Instance to update + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + minItems: 1 + required: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + '204': + description: Expected response with empty body + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deregisters a given NF Instance + operationId: DeregisterNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + required: true + description: Unique ID of the NF Instance to deregister + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + responses: + '204': + description: Expected response to a successful deregistration + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions: + post: + summary: Create a new subscription + operationId: CreateSubscription + tags: + - Subscriptions (Collection) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + required: true + responses: + '201': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnrf-nfm/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + onNFStatusEvent: + '{$request.body#/nfStatusNotificationUri}': + post: + requestBody: + description: Notification Payload + content: + application/json: + schema: + $ref: '#/components/schemas/NotificationData' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionID}: + patch: + summary: Updates a subscription + operationId: UpdateSubscription + tags: + - Subscription ID (Document) + parameters: + - name: subscriptionID + in: path + required: true + description: Unique ID of the subscription to update + schema: + type: string + pattern: '^([0-9]{5,6}-)?[^-]+$' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + required: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + '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' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes a subscription + operationId: RemoveSubscription + tags: + - Subscription ID (Document) + parameters: + - name: subscriptionID + in: path + required: true + description: Unique ID of the subscription to remove + schema: + type: string + pattern: '^([0-9]{5,6}-)?[^-]+$' + responses: + '204': + description: Expected response to a successful subscription removal + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '/oauth2/token' + scopes: + nnrf-nfm: Access to the Nnrf_NFManagement API + schemas: + NFProfile: + type: object + required: + - nfInstanceId + - nfType + - nfStatus + anyOf: + - required: [ fqdn ] + - required: [ ipv4Addresses ] + - required: [ ipv6Addresses ] + properties: + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nfInstanceName: + type: string + nfType: + $ref: '#/components/schemas/NFType' + nfStatus: + $ref: '#/components/schemas/NFStatus' + heartBeatTimer: + type: integer + plmnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + sNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + perPlmnSnssaiList: + type: array + items: + $ref: '#/components/schemas/PlmnSnssai' + minItems: 1 + nsiList: + type: array + items: + type: string + minItems: 1 + fqdn: + $ref: '#/components/schemas/Fqdn' + interPlmnFqdn: + $ref: '#/components/schemas/Fqdn' + ipv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + allowedPlmns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + allowedNfTypes: + type: array + items: + $ref: '#/components/schemas/NFType' + minItems: 1 + allowedNfDomains: + type: array + items: + type: string + minItems: 1 + allowedNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + priority: + type: integer + minimum: 0 + maximum: 65535 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + locality: + type: string + udrInfo: + $ref: '#/components/schemas/UdrInfo' + udrInfoExt: + type: array + items: + $ref: '#/components/schemas/UdrInfo' + minItems: 1 + udmInfo: + $ref: '#/components/schemas/UdmInfo' + udmInfoExt: + type: array + items: + $ref: '#/components/schemas/UdmInfo' + minItems: 1 + ausfInfo: + $ref: '#/components/schemas/AusfInfo' + ausfInfoExt: + type: array + items: + $ref: '#/components/schemas/AusfInfo' + minItems: 1 + amfInfo: + $ref: '#/components/schemas/AmfInfo' + amfInfoExt: + type: array + items: + $ref: '#/components/schemas/AmfInfo' + minItems: 1 + smfInfo: + $ref: '#/components/schemas/SmfInfo' + smfInfoExt: + type: array + items: + $ref: '#/components/schemas/SmfInfo' + minItems: 1 + upfInfo: + $ref: '#/components/schemas/UpfInfo' + upfInfoExt: + type: array + items: + $ref: '#/components/schemas/UpfInfo' + minItems: 1 + pcfInfo: + $ref: '#/components/schemas/PcfInfo' + pcfInfoExt: + type: array + items: + $ref: '#/components/schemas/PcfInfo' + minItems: 1 + bsfInfo: + $ref: '#/components/schemas/BsfInfo' + bsfInfoExt: + type: array + items: + $ref: '#/components/schemas/BsfInfo' + minItems: 1 + chfInfo: + $ref: '#/components/schemas/ChfInfo' + chfInfoExt: + type: array + items: + $ref: '#/components/schemas/ChfInfo' + minItems: 1 + nrfInfo: + $ref: '#/components/schemas/NrfInfo' + nwdafInfo: + $ref: '#/components/schemas/NwdafInfo' + customInfo: + type: object + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + nfServicePersistence: + type: boolean + default: false + nfServices: + type: array + items: + $ref: '#/components/schemas/NFService' + minItems: 1 + nfProfileChangesSupportInd: + type: boolean + default: false + writeOnly: true + nfProfileChangesInd: + type: boolean + default: false + readOnly: true + defaultNotificationSubscriptions: + type: array + items: + $ref: '#/components/schemas/DefaultNotificationSubscription' + NFService: + type: object + required: + - serviceInstanceId + - serviceName + - versions + - scheme + - nfServiceStatus + properties: + serviceInstanceId: + type: string + serviceName: + $ref: '#/components/schemas/ServiceName' + versions: + type: array + items: + $ref: '#/components/schemas/NFServiceVersion' + minItems: 1 + scheme: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UriScheme' + nfServiceStatus: + $ref: '#/components/schemas/NFServiceStatus' + fqdn: + $ref: '#/components/schemas/Fqdn' + interPlmnFqdn: + $ref: '#/components/schemas/Fqdn' + ipEndPoints: + type: array + items: + $ref: '#/components/schemas/IpEndPoint' + minItems: 1 + apiPrefix: + type: string + defaultNotificationSubscriptions: + type: array + items: + $ref: '#/components/schemas/DefaultNotificationSubscription' + minItems: 1 + allowedPlmns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + allowedNfTypes: + type: array + items: + $ref: '#/components/schemas/NFType' + minItems: 1 + allowedNfDomains: + type: array + items: + type: string + minItems: 1 + allowedNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + priority: + type: integer + minimum: 0 + maximum: 65535 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + chfServiceInfo: + $ref: '#/components/schemas/ChfServiceInfo' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + NFType: + anyOf: + - type: string + enum: + - NRF + - UDM + - AMF + - SMF + - AUSF + - NEF + - PCF + - SMSF + - NSSF + - UDR + - LMF + - GMLC + - 5G_EIR + - SEPP + - UPF + - N3IWF + - AF + - UDSF + - BSF + - CHF + - NWDAF + - type: string + Fqdn: + type: string + IpEndPoint: + type: object + properties: + ipv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + transport: + $ref: '#/components/schemas/TransportProtocol' + port: + type: integer + minimum: 0 + maximum: 65535 + SubscriptionData: + type: object + required: + - nfStatusNotificationUri + - subscriptionId + properties: + nfStatusNotificationUri: + type: string + reqNfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + subscrCond: + oneOf: + - $ref: '#/components/schemas/NfInstanceIdCond' + - $ref: '#/components/schemas/NfTypeCond' + - $ref: '#/components/schemas/ServiceNameCond' + - $ref: '#/components/schemas/AmfCond' + - $ref: '#/components/schemas/GuamiListCond' + - $ref: '#/components/schemas/NetworkSliceCond' + - $ref: '#/components/schemas/NfGroupCond' + subscriptionId: + type: string + pattern: '^([0-9]{5,6}-)?[^-]+$' + readOnly: true + validityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + reqNotifEvents: + type: array + items: + $ref: '#/components/schemas/NotificationEventType' + minItems: 1 + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + notifCondition: + $ref: '#/components/schemas/NotifCondition' + reqNfType: + $ref: '#/components/schemas/NFType' + reqNfFqdn: + $ref: '#/components/schemas/Fqdn' + reqSnssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + NfInstanceIdCond: + type: object + required: + - nfInstanceId + properties: + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + NfTypeCond: + type: object + required: + - nfType + not: + required: [ nfGroupId ] + properties: + nfType: + $ref: '#/components/schemas/NFType' + ServiceNameCond: + type: object + required: + - serviceName + properties: + serviceName: + $ref: '#/components/schemas/ServiceName' + AmfCond: + type: object + anyOf: + - required: [ amfSetId ] + - required: [ amfRegionId ] + properties: + amfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfSetId' + amfRegionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfRegionId' + GuamiListCond: + type: object + required: + - guamiList + properties: + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + NetworkSliceCond: + type: object + required: + - snssaiList + properties: + snssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + nsiList: + type: array + items: + type: string + NfGroupCond: + type: object + required: + - nfType + - nfGroupId + properties: + nfType: + type: string + enum: + - UDM + - AUSF + - UDR + - PCF + nfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + NotifCondition: + type: object + not: + required: [ monitoredAttributes, unmonitoredAttributes ] + properties: + monitoredAttributes: + type: array + items: + type: string + minItems: 1 + unmonitoredAttributes: + type: array + items: + type: string + minItems: 1 + UdrInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + externalGroupIdentifiersRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + supportedDataSets: + type: array + items: + $ref: '#/components/schemas/DataSetId' + minItems: 1 + SupiRange: + type: object + properties: + start: + type: string + pattern: '^[0-9]+$' + end: + type: string + pattern: '^[0-9]+$' + pattern: + type: string + IdentityRange: + type: object + properties: + start: + type: string + pattern: '^[0-9]+$' + end: + type: string + pattern: '^[0-9]+$' + pattern: + type: string + DataSetId: + anyOf: + - type: string + enum: + - SUBSCRIPTION + - POLICY + - EXPOSURE + - APPLICATION + - type: string + UdmInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + externalGroupIdentifiersRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + routingIndicators: + type: array + items: + type: string + pattern: '^[0-9]{1,4}$' + minItems: 1 + AusfInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + routingIndicators: + type: array + items: + type: string + pattern: '^[0-9]{1,4}$' + minItems: 1 + AmfInfo: + type: object + required: + - amfSetId + - amfRegionId + - guamiList + properties: + amfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfSetId' + amfRegionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfRegionId' + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: '#/components/schemas/TaiRange' + minItems: 1 + backupInfoAmfFailure: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + backupInfoAmfRemoval: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + n2InterfaceAmfInfo: + $ref: '#/components/schemas/N2InterfaceAmfInfo' + SmfInfo: + type: object + required: + - sNssaiSmfInfoList + properties: + sNssaiSmfInfoList: + type: array + items: + $ref: '#/components/schemas/SnssaiSmfInfoItem' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: '#/components/schemas/TaiRange' + minItems: 1 + pgwFqdn: + $ref: '#/components/schemas/Fqdn' + accessType: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + SnssaiSmfInfoItem: + type: object + required: + - sNssai + - dnnSmfInfoList + properties: + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnnSmfInfoList: + type: array + items: + $ref: '#/components/schemas/DnnSmfInfoItem' + minItems: 1 + DnnSmfInfoItem: + type: object + required: + - dnn + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + UpfInfo: + type: object + required: + - sNssaiUpfInfoList + properties: + sNssaiUpfInfoList: + type: array + items: + $ref: '#/components/schemas/SnssaiUpfInfoItem' + minItems: 1 + smfServingArea: + type: array + items: + type: string + minItems: 1 + interfaceUpfInfoList: + type: array + items: + $ref: '#/components/schemas/InterfaceUpfInfoItem' + minItems: 1 + iwkEpsInd: + type: boolean + default: false + pduSessionTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + minItems: 1 + atsssCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AtsssCapability' + ueIpAddrInd: + type: boolean + default: false + SnssaiUpfInfoItem: + type: object + required: + - sNssai + - dnnUpfInfoList + properties: + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnnUpfInfoList: + type: array + items: + $ref: '#/components/schemas/DnnUpfInfoItem' + minItems: 1 + DnnUpfInfoItem: + type: object + required: + - dnn + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + pduSessionTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + minItems: 1 + InterfaceUpfInfoItem: + type: object + required: + - interfaceType + properties: + interfaceType: + $ref: '#/components/schemas/UPInterfaceType' + ipv4EndpointAddresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6EndpointAddresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + endpointFqdn: + $ref: '#/components/schemas/Fqdn' + networkInstance: + type: string + UPInterfaceType: + anyOf: + - type: string + enum: + - N3 + - N6 + - N9 + - type: string + PcfInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + dnnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + rxDiamHost: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + rxDiamRealm: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + BsfInfo: + type: object + properties: + dnnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + ipDomainList: + type: array + items: + type: string + minItems: 1 + ipv4AddressRanges: + type: array + items: + $ref: '#/components/schemas/Ipv4AddressRange' + minItems: 1 + ipv6PrefixRanges: + type: array + items: + $ref: '#/components/schemas/Ipv6PrefixRange' + minItems: 1 + ChfInfo: + type: object + properties: + supiRangeList: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRangeList: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + plmnRangeList: + type: array + items: + $ref: '#/components/schemas/PlmnRange' + minItems: 1 + Ipv4AddressRange: + type: object + properties: + start: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + end: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + Ipv6PrefixRange: + type: object + properties: + start: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + end: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + DefaultNotificationSubscription: + type: object + required: + - notificationType + - callbackUri + properties: + notificationType: + $ref: '#/components/schemas/NotificationType' + callbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + n1MessageClass: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N1MessageClass' + n2InformationClass: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N2InformationClass' + NotificationType: + anyOf: + - type: string + enum: + - N1_MESSAGES + - N2_INFORMATION + - LOCATION_NOTIFICATION + - DATA_REMOVAL_NOTIFICATION + - DATA_CHANGE_NOTIFICATION + - type: string + TransportProtocol: + anyOf: + - type: string + enum: + - TCP + - type: string + NotificationEventType: + anyOf: + - type: string + enum: + - NF_REGISTERED + - NF_DEREGISTERED + - NF_PROFILE_CHANGED + - type: string + NotificationData: + type: object + required: + - event + - nfInstanceUri + allOf: + # + # Condition: If 'event' takes value 'NF_PROFILE_CHANGED', + # then either 'nfProfile' or 'profileChanges' (but not both) must be present + # + - anyOf: + - not: + properties: + event: + type: string + enum: + - NF_PROFILE_CHANGED + - oneOf: + - required: [ nfProfile ] + - required: [ profileChanges ] + # + # Condition: If 'event' takes value 'NF_REGISTERED', + # then 'nfProfile' must be present + # + - anyOf: + - not: + properties: + event: + type: string + enum: + - NF_REGISTERED + - required: [ nfProfile ] + properties: + event: + $ref: '#/components/schemas/NotificationEventType' + nfInstanceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nfProfile: + allOf: + - $ref: '#/components/schemas/NFProfile' + - not: + required: [ interPlmnFqdn ] + - not: + required: [ allowedPlmns ] + - not: + required: [ allowedNfTypes ] + - not: + required: [ allowedNfDomains ] + - not: + required: [ allowedNssais ] + - properties: + nfServices: + type: array + items: + allOf: + - $ref: '#/components/schemas/NFService' + - not: + required: [ interPlmnFqdn ] + - not: + required: [ allowedPlmns ] + - not: + required: [ allowedNfTypes ] + - not: + required: [ allowedNfDomains ] + - not: + required: [ allowedNssais ] + profileChanges: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChangeItem' + minItems: 1 + NFStatus: + anyOf: + - type: string + enum: + - REGISTERED + - SUSPENDED + - UNDISCOVERABLE + - type: string + NFServiceVersion: + type: object + required: + - apiVersionInUri + - apiFullVersion + properties: + apiVersionInUri: + type: string + apiFullVersion: + type: string + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ServiceName: + anyOf: + - type: string + enum: + - nnrf-nfm + - nnrf-disc + - nudm-sdm + - nudm-uecm + - nudm-ueau + - nudm-ee + - nudm-pp + - nudm-niddau + - namf-comm + - namf-evts + - namf-mt + - namf-loc + - nsmf-pdusession + - nsmf-event-exposure + - nausf-auth + - nausf-sorprotection + - nausf-upuprotection + - nnef-pfdmanagement + - npcf-am-policy-control + - npcf-smpolicycontrol + - npcf-policyauthorization + - npcf-bdtpolicycontrol + - npcf-eventexposure + - npcf-ue-policy-control + - nsmsf-sms + - nnssf-nsselection + - nnssf-nssaiavailability + - nudr-dr + - nlmf-loc + - n5g-eir-eic + - nbsf-management + - nchf-spendinglimitcontrol + - nchf-convergedcharging + - nnwdaf-eventssubscription + - nnwdaf-analyticsinfo + - type: string + N2InterfaceAmfInfo: + type: object + properties: + ipv4EndpointAddress: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6EndpointAddress: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + amfName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + NFServiceStatus: + anyOf: + - type: string + enum: + - REGISTERED + - SUSPENDED + - UNDISCOVERABLE + - type: string + TaiRange: + type: object + required: + - plmnId + - tacRangeList + properties: + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + tacRangeList: + type: array + items: + $ref: '#/components/schemas/TacRange' + minItems: 1 + TacRange: + type: object + properties: + start: + type: string + pattern: '^([A-Fa-f0-9]{4}|[A-Fa-f0-9]{6})$' + end: + type: string + pattern: '^([A-Fa-f0-9]{4}|[A-Fa-f0-9]{6})$' + pattern: + type: string + ChfServiceInfo: + type: object + not: + required: [ primaryChfServiceInstance, secondaryChfServiceInstance ] + properties: + primaryChfServiceInstance: + type: string + secondaryChfServiceInstance: + type: string + PlmnRange: + type: object + properties: + start: + type: string + pattern: '^[0-9]{3}[0-9]{2,3}$' + end: + type: string + pattern: '^[0-9]{3}[0-9]{2,3}$' + pattern: + type: string + NrfInfo: + type: object + properties: + servedUdrInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UdrInfo' + minProperties: 1 + servedUdmInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UdmInfo' + minProperties: 1 + servedAusfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/AusfInfo' + minProperties: 1 + servedAmfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/AmfInfo' + minProperties: 1 + servedSmfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/SmfInfo' + minProperties: 1 + servedUpfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UpfInfo' + minProperties: 1 + servedPcfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/PcfInfo' + minProperties: 1 + servedBsfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/BsfInfo' + minProperties: 1 + servedChfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/ChfInfo' + minProperties: 1 + servedNwdafInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/NwdafInfo' + minProperties: 1 + PlmnSnssai: + type: object + required: + - plmnId + - sNssaiList + properties: + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + sNssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + NwdafInfo: + type: object + properties: + eventIds: + type: array + items: + $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/EventId' + minItems: 1 + nwdafEvents: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NwdafEvent' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: '#/components/schemas/TaiRange' + minItems: 1 + +externalDocs: + description: 3GPP TS 29.510 V15.3.0; 5G System; Network Function Repository Services; Stage 3 + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' diff --git a/lib/sbi/support/3gpp-spec/TS29512_Npcf_SMPolicyControl.yaml b/lib/sbi/support/3gpp-spec/TS29512_Npcf_SMPolicyControl.yaml new file mode 100644 index 000000000..007274b8d --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29512_Npcf_SMPolicyControl.yaml @@ -0,0 +1,1986 @@ +openapi: 3.0.0 +info: + title: Npcf_SMPolicyControl API + version: 1.1.1.alpha-5 + description: | + Session Management Policy Control Service + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.512 V16.4.0; 5G System; Session Management Policy Control Service. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.512/' +security: + - {} + - oAuth2Clientcredentials: + - npcf-smpolicycontrol +servers: + - url: '{apiRoot}/npcf-smpolicycontrol/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +paths: + /sm-policies: + post: + summary: Create a new Individual SM Policy + operationId: CreateSMPolicy + tags: + - SM Policies (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyContextData' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyDecision' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '308': + description: Permanent Redirect + headers: + Location: + description: 'Contains the URI of the PCF within the existing PCF binding information stored in the BSF for the same UE ID, S-NSSAI and DNN combination ' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + description: Not Found + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + SmPolicyUpdateNotification: + '{$request.body#/notificationUri}/update': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyNotification' + responses: + '200': + description: OK. The current applicable values corresponding to the policy control request trigger is reported + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/UeCampingRep' + - type: array + items: + $ref: '#/components/schemas/PartialSuccessReport' + minItems: 1 + '204': + description: No Content, Notification was succesfull + '400': + description: Bad Request. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorReport' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + SmPolicyControlTerminationRequestNotification: + '{$request.body#/notificationUri}/terminate': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TerminationNotification' + responses: + '204': + description: No Content, Notification was succesful + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /sm-policies/{smPolicyId}: + get: + summary: Read an Individual SM Policy + operationId: GetSMPolicy + tags: + - Individual SM Policy (Document) + parameters: + - name: smPolicyId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyControl' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /sm-policies/{smPolicyId}/update: + post: + summary: Update an existing Individual SM Policy + operationId: UpdateSMPolicy + tags: + - Individual SM Policy (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyUpdateContextData' + parameters: + - name: smPolicyId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Updated policies are returned + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyDecision' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /sm-policies/{smPolicyId}/delete: + post: + summary: Delete an existing Individual SM Policy + operationId: DeleteSMPolicy + tags: + - Individual SM Policy (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyDeleteData' + parameters: + - name: smPolicyId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2Clientcredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + npcf-smpolicycontrol: Access to the Npcf_SMPolicyControl API + schemas: + SmPolicyControl: + type: object + properties: + context: + $ref: '#/components/schemas/SmPolicyContextData' + policy: + $ref: '#/components/schemas/SmPolicyDecision' + required: + - context + - policy + SmPolicyContextData: + type: object + properties: + accNetChId: + $ref: '#/components/schemas/AccNetChId' + chargEntityAddr: + $ref: '#/components/schemas/AccNetChargingAddress' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + interGrpIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + minItems: 1 + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + chargingcharacteristics: + type: string + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + dnnSelMode: + $ref: 'TS29502_Nsmf_PDUSession.yaml#/components/schemas/DnnSelectionMode' + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + addAccessInfo: + $ref: '#/components/schemas/AdditionalAccessInfo' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + userLocationInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + ipv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6AddressPrefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + ipDomain: + type: string + description: Indicates the IPv4 address domain + subsSessAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + authProfIndex: + type: string + description: Indicates the DN-AAA authorization profile index + subsDefQos: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SubscribedDefaultQos' + numOfPackFilter: + type: integer + description: Contains the number of supported packet filter for signalled QoS rules. + online: + type: boolean + description: If it is included and set to true, the online charging is applied to the PDU session. + offline: + type: boolean + description: If it is included and set to true, the offline charging is applied to the PDU session. + 3gppPsDataOffStatus: + type: boolean + description: If it is included and set to true, the 3GPP PS Data Off is activated by the UE. + refQosIndication: + type: boolean + description: If it is included and set to true, the reflective QoS is supported by the UE. + traceReq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + sliceInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + qosFlowUsage: + $ref: '#/components/schemas/QosFlowUsage' + servNfId: + $ref: '#/components/schemas/ServingNfIdentity' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + smfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + maPduInd: + $ref: '#/components/schemas/MaPduIndication' + atsssCapab: + $ref: '#/components/schemas/AtsssCapability' + required: + - supi + - pduSessionId + - pduSessionType + - dnn + - notificationUri + - sliceInfo + SmPolicyDecision: + type: object + properties: + sessRules: + type: object + additionalProperties: + $ref: '#/components/schemas/SessionRule' + minProperties: 1 + description: A map of Sessionrules with the content being the SessionRule as described in subclause 5.6.2.7. + pccRules: + type: object + additionalProperties: + $ref: '#/components/schemas/PccRule' + minProperties: 1 + description: A map of PCC rules with the content being the PCCRule as described in subclause 5.6.2.6. + nullable: true + pcscfRestIndication: + type: boolean + description: If it is included and set to true, it indicates the P-CSCF Restoration is requested. + qosDecs: + type: object + additionalProperties: + $ref: '#/components/schemas/QosData' + minProperties: 1 + description: Map of QoS data policy decisions. + chgDecs: + type: object + additionalProperties: + $ref: '#/components/schemas/ChargingData' + minProperties: 1 + description: Map of Charging data policy decisions. + nullable: true + chargingInfo: + $ref: '#/components/schemas/ChargingInformation' + traffContDecs: + type: object + additionalProperties: + $ref: '#/components/schemas/TrafficControlData' + minProperties: 1 + description: Map of Traffic Control data policy decisions. + umDecs: + type: object + additionalProperties: + $ref: '#/components/schemas/UsageMonitoringData' + minProperties: 1 + description: Map of Usage Monitoring data policy decisions. + nullable: true + qosChars: + type: object + additionalProperties: + $ref: '#/components/schemas/QosCharacteristics' + minProperties: 1 + description: Map of QoS characteristics for non standard 5QIs. This map uses the 5QI values as keys. + qosMonDecs: + type: object + additionalProperties: + $ref: '#/components/schemas/QosMonitoringData' + minProperties: 1 + description: Map of QoS Monitoring data policy decisions. + nullable: true + reflectiveQoSTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + conds: + type: object + additionalProperties: + $ref: '#/components/schemas/ConditionData' + minProperties: 1 + description: A map of condition data with the content being as described in subclause 5.6.2.9. + nullable: true + revalidationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + offline: + type: boolean + description: Indicates the offline charging is applicable to the PDU session or PCC rule. + online: + type: boolean + description: Indicates the online charging is applicable to the PDU session or PCC rule. + policyCtrlReqTriggers: + type: array + items: + $ref: '#/components/schemas/PolicyControlRequestTrigger' + minItems: 1 + description: Defines the policy control request triggers subscribed by the PCF. + nullable: true + lastReqRuleData: + type: array + items: + $ref: '#/components/schemas/RequestedRuleData' + minItems: 1 + description: Defines the last list of rule control data requested by the PCF. + lastReqUsageData: + $ref: '#/components/schemas/RequestedUsageData' + praInfos: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfoRm' + minProperties: 1 + description: Map of PRA information. + nullable: true + ipv4Index: + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/IpIndex' + ipv6Index: + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/IpIndex' + qosFlowUsage: + $ref: '#/components/schemas/QosFlowUsage' + relCause: + $ref: '#/components/schemas/SmPolicyAssociationReleaseCause' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + tsnPortManContDstt: + $ref: '#/components/schemas/PortManagementContainer' + tsnPortManContNwtts: + type: array + items: + $ref: '#/components/schemas/PortManagementContainer' + minItems: 1 + SmPolicyNotification: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smPolicyDecision: + $ref: '#/components/schemas/SmPolicyDecision' + PccRule: + type: object + properties: + flowInfos: + type: array + items: + $ref: '#/components/schemas/FlowInformation' + minItems: 1 + description: An array of IP flow packet filter information. + appId: + type: string + description: A reference to the application detection filter configured at the UPF. + contVer: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/ContentVersion' + pccRuleId: + type: string + description: Univocally identifies the PCC rule within a PDU session. + precedence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + afSigProtocol: + $ref: '#/components/schemas/AfSigProtocol' + appReloc: + type: boolean + description: Indication of application relocation possibility. + refQosData: + type: array + items: + type: string + minItems: 1 + maxItems: 1 + description: A reference to the QoSData policy type decision type. It is the qosId described in subclause 5.6.2.8. + refAltQosParams: + type: array + items: + type: string + minItems: 1 + description: A Reference to the QoS Data policy decision type for the Alternative QoS parameter sets of the service data flow. + refTcData: + type: array + items: + type: string + minItems: 1 + maxItems: 1 + description: A reference to the TrafficControlData policy decision type. It is the tcId described in subclause 5.6.2.10. + refChgData: + type: array + items: + type: string + minItems: 1 + maxItems: 1 + description: A reference to the ChargingData policy decision type. It is the chgId described in subclause 5.6.2.11. + nullable: true + refChgN3gData: + type: array + items: + type: string + minItems: 1 + maxItems: 1 + description: A reference to the ChargingData policy decision type only applicable to Non-3GPP access if "ATSSS" feature is supported. It is the chgId described in subclause 5.6.2.11. + nullable: true + refUmData: + type: array + items: + type: string + minItems: 1 + maxItems: 1 + description: A reference to UsageMonitoringData policy decision type. It is the umId described in subclause 5.6.2.12. + nullable: true + refUmN3gData: + type: array + items: + type: string + minItems: 1 + maxItems: 1 + description: A reference to UsageMonitoringData policy decision type only applicable to Non-3GPP access if "ATSSS" feature is supported. It is the umId described in subclause 5.6.2.12. + nullable: true + refCondData: + type: string + description: A reference to the condition data. It is the condId described in subclause 5.6.2.9. + nullable: true + refQosMon: + type: array + items: + type: string + minItems: 1 + maxItems: 1 + description: A reference to the QosMonitoringData policy type decision type. It is the qmId described in subclause 5.6.2.40. + nullable: true + addrPreserInd: + type: boolean + nullable: true + tscaiInputDl: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/TscaiInputContainer' + tscaiInputUl: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/TscaiInputContainer' + required: + - pccRuleId + nullable: true + SessionRule: + type: object + properties: + authSessAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + authDefQos: + $ref: '#/components/schemas/AuthorizedDefaultQos' + sessRuleId: + type: string + description: Univocally identifies the session rule within a PDU session. + refUmData: + type: string + description: A reference to UsageMonitoringData policy decision type. It is the umId described in subclause 5.6.2.12. + nullable: true + refUmN3gData: + type: string + description: A reference to UsageMonitoringData policy decision type to apply for Non-3GPP access. It is the umId described in subclause 5.6.2.12. + nullable: true + refCondData: + type: string + description: A reference to the condition data. It is the condId described in subclause 5.6.2.9. + nullable: true + required: + - sessRuleId + nullable: true + QosData: + type: object + properties: + qosId: + type: string + description: Univocally identifies the QoS control policy data within a PDU session. + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + maxbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + maxbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + gbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + gbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + qnc: + type: boolean + description: Indicates whether notifications are requested from 3GPP NG-RAN when the GFBR can no longer (or again) be guaranteed for a QoS Flow during the lifetime of the QoS Flow. + priorityLevel: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5QiPriorityLevelRm' + averWindow: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AverWindowRm' + maxDataBurstVol: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MaxDataBurstVolRm' + reflectiveQos: + type: boolean + description: Indicates whether the QoS information is reflective for the corresponding service data flow. + sharingKeyDl: + type: string + description: Indicates, by containing the same value, what PCC rules may share resource in downlink direction. + sharingKeyUl: + type: string + description: Indicates, by containing the same value, what PCC rules may share resource in uplink direction. + maxPacketLossRateDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRateRm' + maxPacketLossRateUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRateRm' + defQosFlowIndication: + type: boolean + description: Indicates that the dynamic PCC rule shall always have its binding with the QoS Flow associated with the default QoS rule + extMaxDataBurstVol: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtMaxDataBurstVolRm' + required: + - qosId + nullable: true + ConditionData: + type: object + properties: + condId: + type: string + description: Uniquely identifies the condition data within a PDU session. + activationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTimeRm' + deactivationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTimeRm' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + required: + - condId + nullable: true + TrafficControlData: + type: object + properties: + tcId: + type: string + description: Univocally identifies the traffic control policy data within a PDU session. + flowStatus: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/FlowStatus' + redirectInfo: + $ref: '#/components/schemas/RedirectInformation' + addRedirectInfo: + type: array + items: + $ref: '#/components/schemas/RedirectInformation' + minItems: 1 + muteNotif: + type: boolean + description: Indicates whether applicat'on's start or stop notification is to be muted. + trafficSteeringPolIdDl: + type: string + description: Reference to a pre-configured traffic steering policy for downlink traffic at the SMF. + nullable: true + trafficSteeringPolIdUl: + type: string + description: Reference to a pre-configured traffic steering policy for uplink traffic at the SMF. + nullable: true + routeToLocs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + minItems: 1 + description: A list of location which the traffic shall be routed to for the AF request + traffCorreInd: + type: boolean + upPathChgEvent: + $ref: '#/components/schemas/UpPathChgEvent' + steerFun: + $ref: '#/components/schemas/SteeringFunctionality' + steerModeDl: + $ref: '#/components/schemas/SteeringMode' + steerModeUl: + $ref: '#/components/schemas/SteeringMode' + mulAccCtrl: + $ref: '#/components/schemas/MulticastAccessControl' + required: + - tcId + nullable: true + ChargingData: + type: object + properties: + chgId: + type: string + description: Univocally identifies the charging control policy data within a PDU session. + meteringMethod: + $ref: '#/components/schemas/MeteringMethod' + offline: + type: boolean + description: Indicates the offline charging is applicable to the PCC rule. + online: + type: boolean + description: Indicates the online charging is applicable to the PCC rule. + sdfHandl: + type: boolean + description: Indicates whether the service data flow is allowed to start while the SMF is waiting for the response to the credit request. + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + reportingLevel: + $ref: '#/components/schemas/ReportingLevel' + serviceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceId' + sponsorId: + type: string + description: Indicates the sponsor identity. + appSvcProvId: + type: string + description: Indicates the application service provider identity. + afChargingIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + afChargId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationChargingId' + required: + - chgId + nullable: true + UsageMonitoringData: + type: object + properties: + umId: + type: string + description: Univocally identifies the usage monitoring policy data within a PDU session. + volumeThreshold: + $ref: 'TS29122_CommonData.yaml#/components/schemas/VolumeRm' + volumeThresholdUplink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/VolumeRm' + volumeThresholdDownlink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/VolumeRm' + timeThreshold: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' + monitoringTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTimeRm' + nextVolThreshold: + $ref: 'TS29122_CommonData.yaml#/components/schemas/VolumeRm' + nextVolThresholdUplink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/VolumeRm' + nextVolThresholdDownlink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/VolumeRm' + nextTimeThreshold: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' + inactivityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' + exUsagePccRuleIds: + type: array + items: + type: string + minItems: 1 + description: Contains the PCC rule identifier(s) which corresponding service data flow(s) shall be excluded from PDU Session usage monitoring. It is only included in the UsageMonitoringData instance for session level usage monitoring. + nullable: true + required: + - umId + nullable: true + RedirectInformation: + type: object + properties: + redirectEnabled: + type: boolean + description: Indicates the redirect is enable. + redirectAddressType: + $ref: '#/components/schemas/RedirectAddressType' + redirectServerAddress: + type: string + description: Indicates the address of the redirect server. + FlowInformation: + type: object + properties: + flowDescription: + $ref: '#/components/schemas/FlowDescription' + ethFlowDescription: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + packFiltId: + type: string + description: An identifier of packet filter. + packetFilterUsage: + type: boolean + description: The packet shall be sent to the UE. + tosTrafficClass: + type: string + description: Contains the Ipv4 Type-of-Service and mask field or the Ipv6 Traffic-Class field and mask field. + nullable: true + spi: + type: string + description: the security parameter index of the IPSec packet. + nullable: true + flowLabel: + type: string + description: the Ipv6 flow label header field. + nullable: true + flowDirection: + $ref: '#/components/schemas/FlowDirectionRm' + SmPolicyDeleteData: + type: object + properties: + userLocationInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + userLocationInfoTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ranNasRelCauses: + type: array + items: + $ref: '#/components/schemas/RanNasRelCause' + minItems: 1 + description: Contains the RAN and/or NAS release cause. + accuUsageReports: + type: array + items: + $ref: '#/components/schemas/AccuUsageReport' + minItems: 1 + description: Contains the usage report + pduSessRelCause: + $ref: '#/components/schemas/PduSessionRelCause' + QosCharacteristics: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + resourceType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/QosResourceType' + priorityLevel: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5QiPriorityLevel' + packetDelayBudget: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudget' + packetErrorRate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketErrRate' + averagingWindow: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AverWindow' + maxDataBurstVol: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MaxDataBurstVol' + extMaxDataBurstVol: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtMaxDataBurstVol' + required: + - 5qi + - resourceType + - priorityLevel + - packetDelayBudget + - packetErrorRate + ChargingInformation: + type: object + properties: + primaryChfAddress: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + secondaryChfAddress: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + primaryChfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + primaryChfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + secondaryChfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + secondaryChfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + required: + - primaryChfAddress + - secondaryChfAddress + AccuUsageReport: + type: object + properties: + refUmIds: + type: string + description: An id referencing UsageMonitoringData objects associated with this usage report. + volUsage: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + volUsageUplink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + volUsageDownlink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + timeUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + nextVolUsage: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + nextVolUsageUplink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + nextVolUsageDownlink: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + nextTimeUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + required: + - refUmIds + SmPolicyUpdateContextData: + type: object + properties: + repPolicyCtrlReqTriggers: + type: array + items: + $ref: '#/components/schemas/PolicyControlRequestTrigger' + minItems: 1 + description: The policy control reqeust trigges which are met. + accNetChIds: + type: array + items: + $ref: '#/components/schemas/AccNetChId' + minItems: 1 + description: Indicates the access network charging identifier for the PCC rule(s) or whole PDU session. + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + addAccessInfo: + $ref: '#/components/schemas/AdditionalAccessInfo' + relAccessInfo: + $ref: '#/components/schemas/AdditionalAccessInfo' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + userLocationInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + relIpv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipDomain: + type: string + description: Indicates the IPv4 address domain + ipv6AddressPrefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + relIpv6AddressPrefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + addIpv6AddrPrefixes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + addRelIpv6AddrPrefixes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + relUeMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + ueMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + subsSessAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + authProfIndex: + type: string + description: Indicates the DN-AAA authorization profile index + subsDefQos: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SubscribedDefaultQos' + numOfPackFilter: + type: integer + description: Contains the number of supported packet filter for signalled QoS rules. + accuUsageReports: + type: array + items: + $ref: '#/components/schemas/AccuUsageReport' + minItems: 1 + description: Contains the usage report + 3gppPsDataOffStatus: + type: boolean + description: If it is included and set to true, the 3GPP PS Data Off is activated by the UE. + appDetectionInfos: + type: array + items: + $ref: '#/components/schemas/AppDetectionInfo' + minItems: 1 + description: Report the start/stop of the application traffic and detected SDF descriptions if applicable. + ruleReports: + type: array + items: + $ref: '#/components/schemas/RuleReport' + minItems: 1 + description: Used to report the PCC rule failure. + sessRuleReports: + type: array + items: + $ref: '#/components/schemas/SessionRuleReport' + minItems: 1 + description: Used to report the session rule failure. + qncReports: + type: array + items: + $ref: '#/components/schemas/QosNotificationControlInfo' + minItems: 1 + description: QoS Notification Control information. + qosMonReports: + type: array + items: + $ref: '#/components/schemas/QosMonitoringReport' + userLocationInfoTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + repPraInfos: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + description: Reports the changes of presence reporting area. + ueInitResReq: + $ref: '#/components/schemas/UeInitiatedResourceRequest' + refQosIndication: + type: boolean + description: If it is included and set to true, the reflective QoS is supported by the UE. If it is included and set to false, the reflective QoS is revoked by the UE. + qosFlowUsage: + $ref: '#/components/schemas/QosFlowUsage' + creditManageStatus: + $ref: '#/components/schemas/CreditManagementStatus' + servNfId: + $ref: '#/components/schemas/ServingNfIdentity' + traceReq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + maPduInd: + $ref: '#/components/schemas/MaPduIndication' + atsssCapab: + $ref: '#/components/schemas/AtsssCapability' + tsnBridgeInfo: + $ref: '#/components/schemas/TsnBridgeInfo' + tsnPortManContDstt: + $ref: '#/components/schemas/PortManagementContainer' + tsnPortManContNwtts: + type: array + items: + $ref: '#/components/schemas/PortManagementContainer' + minItems: 1 + mulAddrInfos: + type: array + items: + $ref: '#/components/schemas/IpMulticastAddressInfo' + minItems: 1 + UpPathChgEvent: + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifCorreId: + type: string + description: It is used to set the value of Notification Correlation ID in the notification sent by the SMF. + dnaiChgType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DnaiChangeType' + afAckInd: + type: boolean + required: + - notificationUri + - notifCorreId + - dnaiChgType + nullable: true + TerminationNotification: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + cause: + $ref: '#/components/schemas/SmPolicyAssociationReleaseCause' + required: + - resourceUri + - cause + AppDetectionInfo: + type: object + properties: + appId: + type: string + description: A reference to the application detection filter configured at the UPF + instanceId: + type: string + description: Identifier sent by the SMF in order to allow correlation of application Start and Stop events to the specific service data flow description, if service data flow descriptions are deducible. + sdfDescriptions: + type: array + items: + $ref: '#/components/schemas/FlowInformation' + minItems: 1 + description: Contains the detected service data flow descriptions if they are deducible. + required: + - appId + AccNetChId: + type: object + properties: + accNetChaIdValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + refPccRuleIds: + type: array + items: + type: string + minItems: 1 + description: Contains the identifier of the PCC rule(s) associated to the provided Access Network Charging Identifier. + sessionChScope: + type: boolean + description: When it is included and set to true, indicates the Access Network Charging Identifier applies to the whole PDU Session + required: + - accNetChaIdValue + AccNetChargingAddress: + description: Describes the network entity within the access network performing charging + type: object + anyOf: + - required: [anChargIpv4Addr] + - required: [anChargIpv6Addr] + properties: + anChargIpv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + anChargIpv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + RequestedRuleData: + type: object + properties: + refPccRuleIds: + type: array + items: + type: string + minItems: 1 + description: An array of PCC rule id references to the PCC rules associated with the control data. + reqData: + type: array + items: + $ref: '#/components/schemas/RequestedRuleDataType' + minItems: 1 + description: Array of requested rule data type elements indicating what type of rule data is requested for the corresponding referenced PCC rules. + required: + - refPccRuleIds + - reqData + RequestedUsageData: + type: object + properties: + refUmIds: + type: array + items: + type: string + minItems: 1 + description: An array of usage monitoring data id references to the usage monitoring data instances for which the PCF is requesting a usage report. This attribute shall only be provided when allUmIds is not set to true. + allUmIds: + type: boolean + description: Thooleanean indicates whether requested usage data applies to all usage monitoring data instances. When it's not included, it means requested usage data shall only apply to the usage monitoring data instances referenced by the refUmIds attribute. + UeCampingRep: + type: object + properties: + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + servNfId: + $ref: '#/components/schemas/ServingNfIdentity' + servingNetwork: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + userLocationInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + RuleReport: + type: object + properties: + pccRuleIds: + type: array + items: + type: string + minItems: 1 + description: Contains the identifier of the affected PCC rule(s). + ruleStatus: + $ref: '#/components/schemas/RuleStatus' + contVers: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/ContentVersion' + minItems: 1 + description: Indicates the version of a PCC rule. + failureCode: + $ref: '#/components/schemas/FailureCode' + finUnitAct: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/FinalUnitAction' + ranNasRelCauses: + type: array + items: + $ref: '#/components/schemas/RanNasRelCause' + minItems: 1 + description: indicates the RAN or NAS release cause code information. + required: + - pccRuleIds + - ruleStatus + RanNasRelCause: + type: object + properties: + ngApCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + 5gMmCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5GMmCause' + 5gSmCause: + $ref: '#/components/schemas/5GSmCause' + UeInitiatedResourceRequest: + type: object + properties: + pccRuleId: + type: string + ruleOp: + $ref: '#/components/schemas/RuleOperation' + precedence: + type: integer + packFiltInfo: + type: array + items: + $ref: '#/components/schemas/PacketFilterInfo' + minItems: 1 + reqQos: + $ref: '#/components/schemas/RequestedQos' + required: + - ruleOp + - packFiltInfo + PacketFilterInfo: + type: object + properties: + packFiltId: + type: string + description: An identifier of packet filter. + packFiltCont: + $ref: '#/components/schemas/PacketFilterContent' + tosTrafficClass: + type: string + description: Contains the Ipv4 Type-of-Service and mask field or the Ipv6 Traffic-Class field and mask field. + spi: + type: string + description: The security parameter index of the IPSec packet. + flowLabel: + type: string + description: The Ipv6 flow label header field. + flowDirection: + $ref: '#/components/schemas/FlowDirection' + RequestedQos: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + gbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + gbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + required: + - 5qi + QosNotificationControlInfo: + type: object + properties: + refPccRuleIds: + type: array + items: + type: string + minItems: 1 + description: An array of PCC rule id references to the PCC rules associated with the QoS notification control info. + notifType: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/QosNotifType' + contVer: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/ContentVersion' + altQosParamId: + type: string + required: + - refPccRuleIds + - notifType + PartialSuccessReport: + type: object + properties: + failureCause: + $ref: '#/components/schemas/FailureCause' + ruleReports: + type: array + items: + $ref: '#/components/schemas/RuleReport' + minItems: 1 + description: Information about the PCC rules provisioned by the PCF not successfully installed/activated. + sessRuleReports: + type: array + items: + $ref: '#/components/schemas/SessionRuleReport' + minItems: 1 + description: Information about the session rules provisioned by the PCF not successfully installed. + ueCampingRep: + $ref: '#/components/schemas/UeCampingRep' + required: + - failureCause + AuthorizedDefaultQos: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + priorityLevel: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5QiPriorityLevelRm' + averWindow: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AverWindowRm' + maxDataBurstVol: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MaxDataBurstVolRm' + maxbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + maxbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + gbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + gbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + qnc: + type: boolean + description: Indicates whether notifications are requested from 3GPP NG-RAN when the GFBR can no longer (or again) be guaranteed for a QoS Flow during the lifetime of the QoS Flow. + extMaxDataBurstVol: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtMaxDataBurstVolRm' + ErrorReport: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + ruleReports: + type: array + items: + $ref: '#/components/schemas/RuleReport' + minItems: 1 + description: Used to report the PCC rule failure. + sessRuleReports: + type: array + items: + $ref: '#/components/schemas/SessionRuleReport' + minItems: 1 + description: Used to report the session rule failure. + SessionRuleReport: + type: object + properties: + ruleIds: + type: array + items: + type: string + minItems: 1 + description: Contains the identifier of the affected session rule(s). + ruleStatus: + $ref: '#/components/schemas/RuleStatus' + sessRuleFailureCode: + $ref: '#/components/schemas/SessionRuleFailureCode' + required: + - ruleIds + - ruleStatus + ServingNfIdentity: + type: object + properties: + servNfInstId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + anGwAddr: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/AnGwAddress' + SteeringMode: + type: object + properties: + steerModeValue: + $ref: '#/components/schemas/SteerModeValue' + active: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + standby: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + 3gLoad: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + prioAcc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + required: + - steerModeValue + AdditionalAccessInfo: + type: object + properties: + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + required: + - accessType + QosMonitoringData: + type: object + properties: + qmId: + type: string + description: Univocally identifies the QoS monitoring policy data within a PDU session. + reqQosMonParams: + type: array + items: + $ref: '#/components/schemas/RequestedQosMonitoringParameter' + minItems: 1 + maxItems: 3 + description: indicates the UL packet delay, DL packet delay and/or round trip packet delay between the UE and the UPF is to be monitored when the QoS Monitoring for URLLC is enabled for the service data flow.. + repFreqs: + type: array + items: + $ref: '#/components/schemas/ReportingFrequency' + minItems: 1 + repThreshDl: + type: integer + description: Unsigned integer identifying a period of time in units of miliiseconds for DL packet delay. + nullable: true + repThreshUl: + type: integer + description: Unsigned integer identifying a period of time in units of miliiseconds for UL packet delay. + nullable: true + repThreshRp: + type: integer + description: Unsigned integer identifying a period of time in units of miliiseconds for round trip packet delay. + nullable: true + waitTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' + repPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSecRm' + notifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifyCorreId: + type: string + required: + - qmId + nullable: true + QosMonitoringReport: + type: object + properties: + refPccRuleIds: + type: array + items: + type: string + minItems: 1 + description: An array of PCC rule id references to the PCC rules associated with the QoS monitoring report. + ulDelays: + type: array + items: + type: integer + dlDelays: + type: array + items: + type: integer + rtDelays: + type: array + items: + type: integer + required: + - refPccRuleIds +# + TsnBridgeInfo: + type: object + properties: + bridgeName: + type: string + description: Name of the bridge. + bridgeMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + nwttPorts: + type: array + items: + $ref: '#/components/schemas/TsnPortIdentifier' + minItems: 1 + description: NW-TT ports available for a PDU session. + dsttPort: + $ref: '#/components/schemas/TsnPortIdentifier' + dsttResidTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' +# + TsnPortIdentifier: + type: object + properties: + portMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + portNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - portMac +# + PortManagementContainer: + type: object + properties: + portManCont: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + portIdentifier: + $ref: '#/components/schemas/TsnPortIdentifier' + required: + - portManCont + - portIdentifier + IpMulticastAddressInfo: + type: object + properties: + srcIpv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv4MulAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + srcIpv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + ipv6MulAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + 5GSmCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + PacketFilterContent: + type: string + description: Defines a packet filter for an IP flow. Refer to subclause 5.3.54 of 3GPP TS 29.212 for encoding. + FlowDescription: + type: string + description: Defines a packet filter for an IP flow. Refer to subclause 5.4.2 of 3GPP TS 29.212 for encoding. + FlowDirection: + anyOf: + - type: string + enum: + - DOWNLINK + - UPLINK + - BIDIRECTIONAL + - UNSPECIFIED + - 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 + - DOWNLINK: The corresponding filter applies for traffic to the UE. + - UPLINK: The corresponding filter applies for traffic from the UE. + - BIDIRECTIONAL: The corresponding filter applies for traffic both to and from the UE. + - UNSPECIFIED: The corresponding filter applies for traffic to the UE (downlink), but has no specific direction declared. The service data flow detection shall apply the filter for uplink traffic as if the filter was bidirectional. The PCF shall not use the value UNSPECIFIED in filters created by the network in NW-initiated procedures. The PCF shall only include the value UNSPECIFIED in filters in UE-initiated procedures if the same value is received from the SMF. + FlowDirectionRm: + anyOf: + - $ref: '#/components/schemas/FlowDirection' + - $ref: 'TS29571_CommonData.yaml#/components/schemas/NullValue' + ReportingLevel: + anyOf: + - type: string + enum: + - SER_ID_LEVEL + - RAT_GR_LEVEL + - SPON_CON_LEVEL + - $ref: 'TS29571_CommonData.yaml#/components/schemas/NullValue' + - 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 + - SER_ID_LEVEL: Indicates that the usage shall be reported on service id and rating group combination level. + - RAT_GR_LEVEL: Indicates that the usage shall be reported on rating group level. + - SPON_CON_LEVEL: Indicates that the usage shall be reported on sponsor identity and rating group combination level. + MeteringMethod: + anyOf: + - type: string + enum: + - DURATION + - VOLUME + - DURATION_VOLUME + - EVENT + - $ref: 'TS29571_CommonData.yaml#/components/schemas/NullValue' + - 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 + - DURATION: Indicates that the duration of the service data flow traffic shall be metered. + - VOLUME: Indicates that volume of the service data flow traffic shall be metered. + - DURATION_VOLUME: Indicates that the duration and the volume of the service data flow traffic shall be metered. + - EVENT: Indicates that events of the service data flow traffic shall be metered. + PolicyControlRequestTrigger: + anyOf: + - type: string + enum: + - PLMN_CH + - RES_MO_RE + - AC_TY_CH + - UE_IP_CH + - UE_MAC_CH + - AN_CH_COR + - US_RE + - APP_STA + - APP_STO + - AN_INFO + - CM_SES_FAIL + - PS_DA_OFF + - DEF_QOS_CH + - SE_AMBR_CH + - QOS_NOTIF + - NO_CREDIT + - REALLO_OF_CREDIT + - PRA_CH + - SAREA_CH + - SCNN_CH + - RE_TIMEOUT + - RES_RELEASE + - SUCC_RES_ALLO + - RAT_TY_CH + - REF_QOS_IND_CH + - NUM_OF_PACKET_FILTER + - UE_STATUS_RESUME + - UE_TZ_CH + - AUTH_PROF_CH + - QOS_MONITORING + - SCELL_CH + - EPS_FALLBACK + - MA_PDU + - TSN_ETHER_PORT + - TSN_CONTAINER + - 5G_RG_JOIN + - 5G_RG_LEAVE + - 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 + - PLMN_CH: PLMN Change + - RES_MO_RE: A request for resource modification has been received by the SMF. The SMF always reports to the PCF. + - AC_TY_CH: Access Type Change + - UE_IP_CH: UE IP address change. The SMF always reports to the PCF. + - UE_MAC_CH: A new UE MAC address is detected or a used UE MAC address is inactive for a specific period + - AN_CH_COR: Access Network Charging Correlation Information + - US_RE: The PDU Session or the Monitoring key specific resources consumed by a UE either reached the threshold or needs to be reported for other reasons. + - APP_STA: The start of application traffic has been detected. + - APP_STO: The stop of application traffic has been detected. + - AN_INFO: Access Network Information report + - CM_SES_FAIL: Credit management session failure + - PS_DA_OFF: The SMF reports when the 3GPP PS Data Off status changes. The SMF always reports to the PCF. + - DEF_QOS_CH: Default QoS Change. The SMF always reports to the PCF. + - SE_AMBR_CH: Session AMBR Change. The SMF always reports to the PCF. + - QOS_NOTIF: The SMF notify the PCF when receiving notification from RAN that QoS targets of the QoS Flow cannot be guranteed or gurateed again. + - NO_CREDIT: Out of credit + - REALLO_OF_CREDIT: Reallocation of credit + - PRA_CH: Change of UE presence in Presence Reporting Area + - SAREA_CH: Location Change with respect to the Serving Area + - SCNN_CH: Location Change with respect to the Serving CN node + - RE_TIMEOUT: Indicates the SMF generated the request because there has been a PCC revalidation timeout + - RES_RELEASE: Indicate that the SMF can inform the PCF of the outcome of the release of resources for those rules that require so. + - SUCC_RES_ALLO: Indicates that the requested rule data is the successful resource allocation. + - RAT_TY_CH: RAT Type Change. + - REF_QOS_IND_CH: Reflective QoS indication Change + - NUM_OF_PACKET_FILTER: Indicates that the SMF shall report the number of supported packet filter for signalled QoS rules + - UE_STATUS_RESUME: Indicates that the UE's status is resumed. + - UE_TZ_CH: UE Time Zone Change + - AUTH_PROF_CH: The DN-AAA authorization profile index has changed + - QOS_MONITORING: Indicate that the SMF notifies the PCF of the QoS Monitoring information. + - SCELL_CH: Location Change with respect to the Serving Cell. Only applicable to the interworking scenario as defined in Annex B. + - EPS_FALLBACK: EPS Fallback report is enabled in the SMF. + - MA_PDU: UE Indicates that the SMF notifies the PCF of the MA PDU session request + - TSN_ETHER_PORT: Manageable Ethernet port detected + - TSN_CONTAINER: Port management container detected. + - 5G_RG_JOIN: The 5G-RG has joined to an IP Multicast Group. + - 5G_RG_LEAVE: The 5G-RG has left an IP Multicast Group. + RequestedRuleDataType: + anyOf: + - type: string + enum: + - CH_ID + - MS_TIME_ZONE + - USER_LOC_INFO + - RES_RELEASE + - SUCC_RES_ALLO + - EPS_FALLBACK + - 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 + - CH_ID: Indicates that the requested rule data is the charging identifier. + - MS_TIME_ZONE: Indicates that the requested access network info type is the UE's timezone. + - USER_LOC_INFO: Indicates that the requested access network info type is the UE's location. + - RES_RELEASE: Indicates that the requested rule data is the result of the release of resource. + - SUCC_RES_ALLO: Indicates that the requested rule data is the successful resource allocation. + - EPS_FALLBACK: Indicates that the requested rule data is the report of QoS flow rejection due to EPS fallback. + RuleStatus: + anyOf: + - type: string + enum: + - ACTIVE + - INACTIVE + - 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 + - ACTIVE: Indicates that the PCC rule(s) are successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF), or the session rule(s) are successfully installed + - INACTIVE: Indicates that the PCC rule(s) are removed (for those provisioned from PCF) or inactive (for those pre-defined in SMF) or the session rule(s) are removed. + FailureCode: + anyOf: + - type: string + enum: + - UNK_RULE_ID + - RA_GR_ERR + - SER_ID_ERR + - NF_MAL + - RES_LIM + - MAX_NR_QoS_FLOW + - MISS_FLOW_INFO + - RES_ALLO_FAIL + - UNSUCC_QOS_VAL + - INCOR_FLOW_INFO + - PS_TO_CS_HAN + - APP_ID_ERR + - NO_QOS_FLOW_BOUND + - FILTER_RES + - MISS_REDI_SER_ADDR + - CM_END_USER_SER_DENIED + - CM_CREDIT_CON_NOT_APP + - CM_AUTH_REJ + - CM_USER_UNK + - CM_RAT_FAILED + - UE_STA_SUSP + - 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 + - UNK_RULE_ID: Indicates that the pre-provisioned PCC rule could not be successfully activated because the PCC rule identifier is unknown to the SMF. + - RA_GR_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Rating Group specified within the Charging Data policy decision which the PCC rule refers to is unknown or, invalid. + - SER_ID_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Service Identifier specified within the Charging Data policy decision which the PCC rule refers to is invalid, unknown, or not applicable to the service being charged. + - NF_MAL: Indicate that the PCC rule could not be successfully installed (for those provisioned from the PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to SMF/UPF malfunction. + - RES_LIM: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to a limitation of resources at the SMF/UPF. + - MAX_NR_QoS_FLOW: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to the fact that the maximum number of QoS flows has been reached for the PDU session. + - MISS_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or enforced because neither the "flowInfos" attribute nor the "appId" attribute is specified within the PccRule data structure by the PCF during the first install request of the PCC rule. + - RES_ALLO_FAIL: Indicate that the PCC rule could not be successfully installed or maintained since the QoS flow establishment/modification failed, or the QoS flow was released. + - UNSUCC_QOS_VAL: indicate that the QoS validation has failed or when Guaranteed Bandwidth > Max-Requested-Bandwidth. + - INCOR_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or modified at the SMF because the provided flow information is not supported by the network (e.g. the provided IP address(es) or Ipv6 prefix(es) do not correspond to an IP version applicable for the PDU session). + - PS_TO_CS_HAN: Indicate that the PCC rule could not be maintained because of PS to CS handover. + - APP_ID_ERR: Indicate that the rule could not be successfully installed or enforced because the Application Identifier is invalid, unknown, or not applicable to the application required for detection. + - NO_QOS_FLOW_BOUND: Indicate that there is no QoS flow which the SMF can bind the PCC rule(s) to. + - FILTER_RES: Indicate that the Flow Information within the "flowInfos" attribute cannot be handled by the SMF because any of the restrictions defined in subclause 5.4.2 of 3GPP TS 29.212 was not met. + - MISS_REDI_SER_ADDR: Indicate that the PCC rule could not be successfully installed or enforced at the SMF because there is no valid Redirect Server Address within the Traffic Control Data policy decision which the PCC rule refers to provided by the PCF and no preconfigured redirection address for this PCC rule at the SMF. + - CM_END_USER_SER_DENIED: Indicate that the charging system denied the service request due to service restrictions (e.g. terminate rating group) or limitations related to the end-user, for example the end-user's account could not cover the requested service. + - CM_CREDIT_CON_NOT_APP: Indicate that the charging system determined that the service can be granted to the end user but no further credit control is needed for the service (e.g. service is free of charge or is treated for offline charging). + - CM_AUTH_REJ: Indicate that the charging system denied the service request in order to terminate the service for which credit is requested. + - CM_USER_UNK: Indicate that the specified end user could not be found in the charging system. + - CM_RAT_FAILED: Indicate that the charging system cannot rate the service request due to insufficient rating input, incorrect AVP combination or due to an attribute or an attribute value that is not recognized or supported in the rating. + - UE_STA_SUSP: Indicates that the UE is in suspend state. + AfSigProtocol: + anyOf: + - type: string + enum: + - NO_INFORMATION + - SIP + - $ref: 'TS29571_CommonData.yaml#/components/schemas/NullValue' + - 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 + - NO_INFORMATION: Indicate that no information about the AF signalling protocol is being provided. + - SIP: Indicate that the signalling protocol is Session Initiation Protocol. + RuleOperation: + anyOf: + - type: string + enum: + - CREATE_PCC_RULE + - DELETE_PCC_RULE + - MODIFY_PCC_RULE_AND_ADD_PACKET_FILTERS + - MODIFY_ PCC_RULE_AND_REPLACE_PACKET_FILTERS + - MODIFY_ PCC_RULE_AND_DELETE_PACKET_FILTERS + - MODIFY_PCC_RULE_WITHOUT_MODIFY_PACKET_FILTERS + - 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 + - CREATE_PCC_RULE: Indicates to create a new PCC rule to reserve the resource requested by the UE. + - DELETE_PCC_RULE: Indicates to delete a PCC rule corresponding to reserve the resource requested by the UE.. + - MODIFY_PCC_RULE_AND_ADD_PACKET_FILTERS: Indicates to modify the PCC rule by adding new packet filter(s). + - MODIFY_ PCC_RULE_AND_REPLACE_PACKET_FILTERS: Indicates to modify the PCC rule by replacing the existing packet filter(s). + - MODIFY_ PCC_RULE_AND_DELETE_PACKET_FILTERS: Indicates to modify the PCC rule by deleting the existing packet filter(s). + - MODIFY_PCC_RULE_WITHOUT_MODIFY_PACKET_FILTERS: Indicates to modify the PCC rule by modifying the QoS of the PCC rule. + RedirectAddressType: + anyOf: + - type: string + enum: + - IPV4_ADDR + - IPV6_ADDR + - URL + - SIP_URI + - 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 + - IPV4_ADDR: Indicates that the address type is in the form of "dotted-decimal" IPv4 address. + - IPV6_ADDR: Indicates that the address type is in the form of IPv6 address. + - URL: Indicates that the address type is in the form of Uniform Resource Locator. + - SIP_URI: Indicates that the address type is in the form of SIP Uniform Resource Identifier. + QosFlowUsage: + anyOf: + - type: string + enum: + - GENERAL + - IMS_SIG + - 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 + - GENERAL: Indicate no specific QoS flow usage information is available. + - IMS_SIG: Indicate that the QoS flow is used for IMS signalling only. + FailureCause: + anyOf: + - type: string + enum: + - PCC_RULE_EVENT + - PCC_QOS_FLOW_EVENT + - RULE_PERMANENT_ERROR + - RULE_TEMPORARY_ERROR + - type: string + CreditManagementStatus: + anyOf: + - type: string + enum: + - END_USER_SER_DENIED + - CREDIT_CTRL_NOT_APP + - AUTH_REJECTED + - USER_UNKNOWN + - RATING_FAILED + - type: string + SessionRuleFailureCode: + anyOf: + - type: string + enum: + - NF_MAL + - RES_LIM + - UNSUCC_QOS_VAL + - UE_STA_SUSP + - 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 + - NF_MAL: Indicate that the PCC rule could not be successfully installed (for those provisioned from the PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to SMF/UPF malfunction. + - RES_LIM: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to a limitation of resources at the SMF/UPF. + - UNSUCC_QOS_VAL: indicate that the QoS validation has failed. + - UE_STA_SUSP: Indicates that the UE is in suspend state. + SteeringFunctionality: + anyOf: + - type: string + enum: + - MPTCP + - ATSSS_LL + - 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 + - MPTCP: Indicates that PCF authorizes the MPTCP functionality to support traffic steering, switching and splitting. + - ATSSS_LL: Indicates that PCF authorizes the ATSSS-LL functionality to support traffic steering, switching and splitting. + SteerModeValue: + anyOf: + - type: string + enum: + - ACTIVE_STANDBY + - LOAD_BALANCING + - SMALLEST_DELAY + - PRIORITY_BASED + - type: string + MulticastAccessControl: + anyOf: + - type: string + enum: + - ALLOWED + - NOT_ALLOWED + - type: string + RequestedQosMonitoringParameter: + anyOf: + - type: string + enum: + - DOWNLINK + - UPLINK + - ROUND_TRIP + - type: string + ReportingFrequency: + anyOf: + - type: string + enum: + - EVENT_TRIGGERED + - PERIODIC + - SESSION_RELEASE + - type: string + SmPolicyAssociationReleaseCause: + anyOf: + - type: string + enum: + - UNSPECIFIED + - UE_SUBSCRIPTION + - INSUFFICIENT_RES + - VALIDATION_CONDITION_NOT_MET + - type: string + PduSessionRelCause: + anyOf: + - type: string + enum: + - PS_TO_CS_HO + - type: string + MaPduIndication: + anyOf: + - type: string + enum: + - MA_PDU_REQUEST + - MA_PDU_ NETWORK_UPGRADE ALLOWED + - type: string + AtsssCapability: + anyOf: + - type: string + enum: + - MPTCP_ATSSS_LL_WITH_ASMODE_UL + - MPTCP_ATSSS_LL_WITH_ASMODE_DLUL + - ATSSS_LL + - MPTCP_ATSSS_LL + - type: string +# diff --git a/lib/sbi/support/3gpp-spec/TS29514_Npcf_PolicyAuthorization.yaml b/lib/sbi/support/3gpp-spec/TS29514_Npcf_PolicyAuthorization.yaml new file mode 100644 index 000000000..d89961ab5 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29514_Npcf_PolicyAuthorization.yaml @@ -0,0 +1,1702 @@ +openapi: 3.0.0 +info: + title: Npcf_PolicyAuthorization Service API + version: 1.1.0.alpha-5 + description: | + PCF Policy Authorization Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +externalDocs: + description: 3GPP TS 29.514 V16.4.0; 5G System; Policy Authorization Service;Stage 3. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.514/' +# +servers: + - url: '{apiRoot}/npcf-policyauthorization/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 + +security: + - {} + - oAuth2ClientCredentials: + - npcf-policyauthorization +paths: + /app-sessions: + post: + summary: Creates a new Individual Application Session Context resource + operationId: PostAppSessions + tags: + - Application Sessions (Collection) + requestBody: + description: Contains the information for the creation the resource + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AppSessionContext' + responses: + '201': + description: Successful creation of the resource + content: + application/json: + schema: + $ref: '#/components/schemas/AppSessionContext' + headers: + Location: + description: 'Contains the URI of the created individual application session context resource, according to the structure: {apiRoot}/npcf-policyauthorization/v1/app-sessions/{appSessionId} or the URI of the created events subscription sub-resource, according to the structure: {apiRoot}/npcf-policyauthorization/v1/app-sessions/{appSessionId}/events-subscription}' + required: true + schema: + type: string + '303': + description: See Other. The result of the HTTP POST request would be equivalent to the existing Application Session Context. The HTTP response shall contain a Location header field set to the URI of the existing individual Application Session Context resource + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + description: Forbidden + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtendedProblemDetails' + headers: + Retry-After: + description: 'Indicates the time the AF has to wait before making a new request. It can be a non-negative integer (decimal number) indicating the number of seconds the AF has to wait before making a new request or an HTTP-date after which the AF can retry a new request. ' + schema: + anyOf: + - type: integer + - type: string + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + terminationRequest: + '{$request.body#/ascReqData/notifUri}/terminate': + post: + requestBody: + description: Request of the termination of the Individual Application Session Context + content: + application/json: + schema: + $ref: '#/components/schemas/TerminationInfo' + responses: + '204': + description: The receipt of the notification is acknowledged. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + eventNotification: + '{$request.body#/ascReqData/evSubsc/notifUri}/notify': + post: + requestBody: + description: Notification of an event occurrence in the PCF. + content: + application/json: + schema: + $ref: '#/components/schemas/EventsNotification' + responses: + '204': + description: The receipt of the notification is acknowledged + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + new5GsBridge: + '{$request.body#/ascReqData/evSubsc/notifUri}/new-bridge': + post: + requestBody: + description: Notification of a new 5GS Bridge detected in the PCF. + content: + application/json: + schema: + $ref: '#/components/schemas/NewTsnBridge' + responses: + '204': + description: The receipt of the notification is acknowledged + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /app-sessions/pcscf-restoration: + post: + summary: "Indicates P-CSCF restoration and does not create an Individual Application Session Context" + operationId: PcscfRestoration + tags: + - PCSCF Restoration Indication + requestBody: + description: PCSCF Restoration Indication + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/PcscfRestorationRequestData' + responses: + '204': + description: The deletion is confirmed without returning additional data. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +# + /app-sessions/{appSessionId}: + get: + summary: "Reads an existing Individual Application Session Context" + operationId: GetAppSession + tags: + - Individual Application Session Context (Document) + parameters: + - name: appSessionId + description: string identifying the resource + in: path + required: true + schema: + type: string + responses: + '200': + description: A representation of the resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/AppSessionContext' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: "Modifies an existing Individual Application Session Context" + operationId: ModAppSession + tags: + - Individual Application Session Context (Document) + parameters: + - name: appSessionId + description: string identifying the resource + in: path + required: true + schema: + type: string + requestBody: + description: modification of the resource. + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/AppSessionContextUpdateData' + responses: + '200': + description: successful modification of the resource and a representation of that resource is returned + content: + application/json: + schema: + $ref: '#/components/schemas/AppSessionContext' + '204': + description: The successful modification + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + description: Forbidden + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ExtendedProblemDetails' + headers: + Retry-After: + description: 'Indicates the time the AF has to wait before making a new request. It can be a non-negative integer (decimal number) indicating the number of seconds the AF has to wait before making a new request or an HTTP-date after which the AF can retry a new request. ' + schema: + anyOf: + - type: integer + - type: string + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + eventNotification: + '{$request.body#/evSubsc/notifUri}/notify': + post: + requestBody: + description: Notification of an event occurrence in the PCF. + content: + application/json: + schema: + $ref: '#/components/schemas/EventsNotification' + responses: + '204': + description: The receipt of the notification is acknowledged + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +# +# + /app-sessions/{appSessionId}/delete: + post: + summary: "Deletes an existing Individual Application Session Context" + operationId: DeleteAppSession + tags: + - Individual Application Session Context (Document) + parameters: + - name: appSessionId + description: string identifying the Individual Application Session Context resource + in: path + required: true + schema: + type: string + requestBody: + description: deletion of the Individual Application Session Context resource, req notification + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/EventsSubscReqData' + responses: + '200': + description: The deletion of the resource is confirmed and a resource is returned + content: + application/json: + schema: + $ref: '#/components/schemas/AppSessionContext' + '204': + description: The deletion is confirmed without returning additional data. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +# + /app-sessions/{appSessionId}/events-subscription: + put: + summary: "creates or modifies an Events Subscription subresource" + operationId: updateEventsSubsc + tags: + - Events Subscription (Document) + parameters: + - name: appSessionId + description: string identifying the Events Subscription resource + in: path + required: true + schema: + type: string + requestBody: + description: Creation or modification of an Events Subscription resource. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/EventsSubscReqData' + responses: + '201': + description: The creation of the Events Subscription resource is confirmed and its representation is returned. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/EventsSubscReqData' + - $ref: '#/components/schemas/EventsNotification' + headers: + Location: + description: 'Contains the URI of the created Events Subscription resource, according to the structure: {apiRoot}/npcf-policyauthorization/v1/app-sessions/{appSessionId}/events-subscription}' + required: true + schema: + type: string + '200': + description: The modification of the of the Events Subscription resource is confirmed its representation is returned. + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/EventsSubscReqData' + - $ref: '#/components/schemas/EventsNotification' + '204': + description: The modification of the Events Subscription subresource is confirmed without returning additional data. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + eventNotification: + '{$request.body#/notifUri}/notify': + post: + requestBody: + description: Contains the information for the notification of an event occurrence in the PCF. + content: + application/json: + schema: + $ref: '#/components/schemas/EventsNotification' + responses: + '204': + description: The receipt of the notification is acknowledged. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: deletes the Events Subscription subresource + operationId: DeleteEventsSubsc + tags: + - Events Subscription (Document) + parameters: + - name: appSessionId + description: string identifying the Individual Application Session Context resource + in: path + required: true + schema: + type: string + responses: + '204': + description: The deletion of the of the Events Subscription sub-resource is confirmed without returning additional data. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + npcf-policyauthorization: Access to the Npcf_PolicyAuthorization API + schemas: + AppSessionContext: + description: Represents an Individual Application Session Context resource. + type: object + properties: + ascReqData: + $ref: '#/components/schemas/AppSessionContextReqData' + ascRespData: + $ref: '#/components/schemas/AppSessionContextRespData' + evsNotif: + $ref: '#/components/schemas/EventsNotification' + AppSessionContextReqData: + description: Identifies the service requirements of an Individual Application Session Context. + type: object + required: + - notifUri + - suppFeat + oneOf: + - required: [ueIpv4] + - required: [ueIpv6] + - required: [ueMac] + properties: + afAppId: + $ref: '#/components/schemas/AfAppId' + afChargId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationChargingId' + afReqData: + $ref: '#/components/schemas/AfRequestedData' + afRoutReq: + $ref: '#/components/schemas/AfRoutingRequirement' + aspId: + $ref: '#/components/schemas/AspId' + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + evSubsc: + $ref: '#/components/schemas/EventsSubscReqData' + mcpttId: + description: indication of MCPTT service request + type: string + mcVideoId: + description: indication of MCVideo service request + type: string + medComponents: + type: object + additionalProperties: + $ref: '#/components/schemas/MediaComponent' + minProperties: 1 + ipDomain: + type: string + mpsId: + description: indication of MPS service request + type: string + mcsId: + description: indication of MCS service request + type: string + preemptControlInfo: + $ref: '#/components/schemas/PreemptionControlInformation' + resPrio: + $ref: '#/components/schemas/ReservPriority' + servInfStatus: + $ref: '#/components/schemas/ServiceInfoStatus' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + servUrn: + $ref: '#/components/schemas/ServiceUrn' + sliceInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + sponId: + $ref: '#/components/schemas/SponId' + sponStatus: + $ref: '#/components/schemas/SponsoringStatus' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + ueIpv4: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + ueMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + tsnPortManContDstt: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + tsnPortManContNwtts: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + minItems: 1 + AppSessionContextRespData: + description: Describes the authorization data of an Individual Application Session Context created by the PCF. + type: object + properties: + servAuthInfo: + $ref: '#/components/schemas/ServAuthInfo' + ueIds: + type: array + items: + $ref: '#/components/schemas/UeIdentityInfo' + minItems: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + AppSessionContextUpdateData: + description: Identifies the modifications to an Individual Application Session Context and may include the modifications to the sub-resource Events Subscription. + type: object + properties: + afAppId: + $ref: '#/components/schemas/AfAppId' + afRoutReq: + $ref: '#/components/schemas/AfRoutingRequirementRm' + aspId: + $ref: '#/components/schemas/AspId' + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + evSubsc: + $ref: '#/components/schemas/EventsSubscReqDataRm' + mcpttId: + description: indication of MCPTT service request + type: string + mcVideoId: + description: indication of modification of MCVideo service + type: string + medComponents: + type: object + additionalProperties: + $ref: '#/components/schemas/MediaComponentRm' + minProperties: 1 + mpsId: + description: indication of MPS service request + type: string + mcsId: + description: indication of MCS service request + type: string + preemptControlInfo: + $ref: '#/components/schemas/PreemptionControlInformationRm' + resPrio: + $ref: '#/components/schemas/ReservPriority' + servInfStatus: + $ref: '#/components/schemas/ServiceInfoStatus' + sipForkInd: + $ref: '#/components/schemas/SipForkingIndication' + sponId: + $ref: '#/components/schemas/SponId' + sponStatus: + $ref: '#/components/schemas/SponsoringStatus' + tsnPortManContDstt: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + tsnPortManContNwtts: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + minItems: 1 + EventsSubscReqData: + description: Identifies the events the application subscribes to. + type: object + required: + - events + properties: + events: + type: array + items: + $ref: '#/components/schemas/AfEventSubscription' + minItems: 1 + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + reqQosMonParams: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/RequestedQosMonitoringParameter' + minItems: 1 + qosMon: + $ref: '#/components/schemas/QosMonitoringInformation' + reqAni: + $ref: '#/components/schemas/RequiredAccessInfo' + usgThres: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + notifCorreId: + type: string + EventsSubscReqDataRm: + description: this data type is defined in the same way as the EventsSubscReqData data type, but with the OpenAPI nullable property set to true. + type: object + required: + - events + properties: + events: + type: array + items: + $ref: '#/components/schemas/AfEventSubscription' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + reqQosMonParams: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/RequestedQosMonitoringParameter' + minItems: 1 + qosMon: + $ref: '#/components/schemas/QosMonitoringInformationRm' + reqAni: + $ref: '#/components/schemas/RequiredAccessInfo' + usgThres: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThresholdRm' + notifCorreId: + type: string + nullable: true + MediaComponent: + description: Identifies a media component. + type: object + required: + - medCompN + properties: + afAppId: + $ref: '#/components/schemas/AfAppId' + afRoutReq: + $ref: '#/components/schemas/AfRoutingRequirement' + qosReference: + type: string + altSerReqs: + type: array + items: + type: string + minItems: 1 + contVer: + $ref: '#/components/schemas/ContentVersion' + codecs: + type: array + items: + $ref: '#/components/schemas/CodecData' + minItems: 1 + maxItems: 2 + desMaxLatency: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + desMaxLoss: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + flusId: + type: string + fStatus: + $ref: '#/components/schemas/FlowStatus' + marBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + marBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxPacketLossRateDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRateRm' + maxPacketLossRateUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRateRm' + maxSuppBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxSuppBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + medCompN: + type: integer + medSubComps: + type: object + additionalProperties: + $ref: '#/components/schemas/MediaSubComponent' + minProperties: 1 + medType: + $ref: '#/components/schemas/MediaType' + minDesBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + minDesBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + mirBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + mirBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + preemptCap: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PreemptionCapability' + preemptVuln: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PreemptionVulnerability' + prioSharingInd: + $ref: '#/components/schemas/PrioritySharingIndicator' + resPrio: + $ref: '#/components/schemas/ReservPriority' + rrBw: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + rsBw: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + sharingKeyDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + sharingKeyUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + tsnQos: + $ref: '#/components/schemas/TsnQosContainer' + tscaiInputDl: + $ref: '#/components/schemas/TscaiInputContainer' + tscaiInputUl: + $ref: '#/components/schemas/TscaiInputContainer' + MediaComponentRm: + description: This data type is defined in the same way as the MediaComponent data type, but with the OpenAPI nullable property set to true + type: object + required: + - medCompN + properties: + afAppId: + $ref: '#/components/schemas/AfAppId' + afRoutReq: + $ref: '#/components/schemas/AfRoutingRequirementRm' + qosReference: + type: string + nullable: true + altSerReqs: + type: array + items: + type: string + minItems: 1 + nullable: true + contVer: + $ref: '#/components/schemas/ContentVersion' + codecs: + type: array + items: + $ref: '#/components/schemas/CodecData' + minItems: 1 + maxItems: 2 + desMaxLatency: + $ref: 'TS29571_CommonData.yaml#/components/schemas/FloatRm' + desMaxLoss: + $ref: 'TS29571_CommonData.yaml#/components/schemas/FloatRm' + flusId: + type: string + nullable: true + fStatus: + $ref: '#/components/schemas/FlowStatus' + marBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + marBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + maxPacketLossRateDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRateRm' + maxPacketLossRateUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketLossRateRm' + maxSuppBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + maxSuppBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + medCompN: + type: integer + medSubComps: + type: object + additionalProperties: + $ref: '#/components/schemas/MediaSubComponentRm' + minProperties: 1 + medType: + $ref: '#/components/schemas/MediaType' + minDesBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + minDesBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + mirBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + mirBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + preemptCap: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PreemptionCapabilityRm' + preemptVuln: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PreemptionVulnerabilityRm' + prioSharingInd: + $ref: '#/components/schemas/PrioritySharingIndicator' + resPrio: + $ref: '#/components/schemas/ReservPriority' + rrBw: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + rsBw: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + sharingKeyDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32Rm' + sharingKeyUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32Rm' + tsnQos: + $ref: '#/components/schemas/TsnQosContainerRm' + tscaiInputDl: + $ref: '#/components/schemas/TscaiInputContainer' + tscaiInputUl: + $ref: '#/components/schemas/TscaiInputContainer' + nullable: true + MediaSubComponent: + description: Identifies a media subcomponent + type: object + required: + - fNum + properties: + afSigProtocol: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/AfSigProtocol' + ethfDescs: + type: array + items: + $ref: '#/components/schemas/EthFlowDescription' + minItems: 1 + maxItems: 2 + fNum: + type: integer + fDescs: + type: array + items: + $ref: '#/components/schemas/FlowDescription' + minItems: 1 + maxItems: 2 + fStatus: + $ref: '#/components/schemas/FlowStatus' + marBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + marBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + tosTrCl: + $ref: '#/components/schemas/TosTrafficClass' + flowUsage: + $ref: '#/components/schemas/FlowUsage' + tscaiInputDl: + $ref: '#/components/schemas/TscaiInputContainer' + tscaiInputUl: + $ref: '#/components/schemas/TscaiInputContainer' + MediaSubComponentRm: + description: This data type is defined in the same way as the MediaSubComponent data type, but with the OpenAPI nullable property set to true. Removable attributes marBwDl and marBwUl are defined with the corresponding removable data type. + type: object + required: + - fNum + properties: + afSigProtocol: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/AfSigProtocol' + ethfDescs: + type: array + items: + $ref: '#/components/schemas/EthFlowDescription' + minItems: 1 + maxItems: 2 + nullable: true + fNum: + type: integer + fDescs: + type: array + items: + $ref: '#/components/schemas/FlowDescription' + minItems: 1 + maxItems: 2 + nullable: true + fStatus: + $ref: '#/components/schemas/FlowStatus' + marBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + marBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRateRm' + tosTrCl: + $ref: '#/components/schemas/TosTrafficClassRm' + flowUsage: + $ref: '#/components/schemas/FlowUsage' + tscaiInputDl: + $ref: '#/components/schemas/TscaiInputContainer' + tscaiInputUl: + $ref: '#/components/schemas/TscaiInputContainer' + nullable: true + EventsNotification: + description: describes the notification of a matched event + type: object + required: + - evSubsUri + - evNotifs + properties: + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + anChargAddr: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/AccNetChargingAddress' + anChargIds: + type: array + items: + $ref: '#/components/schemas/AccessNetChargingIdentifier' + minItems: 1 + anGwAddr: + $ref: '#/components/schemas/AnGwAddress' + evSubsUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + evNotifs: + type: array + items: + $ref: '#/components/schemas/AfEventNotification' + minItems: 1 + failedResourcAllocReports: + type: array + items: + $ref: '#/components/schemas/ResourcesAllocationInfo' + minItems: 1 + noNetLocSupp: + type: boolean + outOfCredReports: + type: array + items: + $ref: '#/components/schemas/OutOfCreditInformation' + minItems: 1 + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + qncReports: + type: array + items: + $ref: '#/components/schemas/QosNotificationControlInfo' + minItems: 1 + qosMonReports: + type: array + items: + $ref: '#/components/schemas/QosMonitoringReport' + minItems: 1 + ranNasRelCauses: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/RanNasRelCause' + minItems: 1 + description: Contains the RAN and/or NAS release cause. + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ueLoc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + usgRep: + $ref: 'TS29122_CommonData.yaml#/components/schemas/AccumulatedUsage' + tsnBridgeInfo: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/TsnBridgeInfo' + tsnPortManContDstt: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + tsnPortManContNwtts: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + minItems: 1 + AfEventSubscription: + description: describes the event information delivered in the subscription + type: object + required: + - event + properties: + event: + $ref: '#/components/schemas/AfEvent' + notifMethod: + $ref: '#/components/schemas/AfNotifMethod' + repPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + waitTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + AfEventNotification: + description: describes the event information delivered in the notification + type: object + required: + - event + properties: + event: + $ref: '#/components/schemas/AfEvent' + flows: + type: array + items: + $ref: '#/components/schemas/Flows' + minItems: 1 + TerminationInfo: + description: indicates the cause for requesting the deletion of the Individual Application Session Context resource + type: object + required: + - termCause + - resUri + properties: + termCause: + $ref: '#/components/schemas/TerminationCause' + resUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + AfRoutingRequirement: + description: describes the event information delivered in the subscription + type: object + properties: + appReloc: + type: boolean + routeToLocs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + minItems: 1 + spVal: + $ref: '#/components/schemas/SpatialValidity' + tempVals: + type: array + items: + $ref: '#/components/schemas/TemporalValidity' + minItems: 1 + upPathChgSub: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/UpPathChgEvent' + addrPreserInd: + type: boolean + SpatialValidity: + description: describes explicitly the route to an Application location + type: object + required: + - presenceInfoList + properties: + presenceInfoList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + SpatialValidityRm: + description: this data type is defined in the same way as the SpatialValidity data type, but with the OpenAPI nullable property set to true + type: object + required: + - presenceInfoList + properties: + presenceInfoList: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + nullable: true + AfRoutingRequirementRm: + description: this data type is defined in the same way as the AfRoutingRequirement data type, but with the OpenAPI nullable property set to true and the spVal and tempVals attributes defined as removable. + type: object + properties: + appReloc: + type: boolean + routeToLocs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + minItems: 1 + nullable: true + spVal: + $ref: '#/components/schemas/SpatialValidityRm' + tempVals: + type: array + items: + $ref: '#/components/schemas/TemporalValidity' + minItems: 1 + nullable: true + upPathChgSub: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/UpPathChgEvent' + addrPreserInd: + type: boolean + nullable: true + nullable: true + AnGwAddress: + description: describes the address of the access network gateway control node + type: object + anyOf: + - required: [anGwIpv4Addr] + - required: [anGwIpv6Addr] + properties: + anGwIpv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + anGwIpv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + Flows: + description: Identifies the flows + type: object + required: + - medCompN + properties: + contVers: + type: array + items: + $ref: '#/components/schemas/ContentVersion' + minItems: 1 + fNums: + type: array + items: + type: integer + minItems: 1 + medCompN: + type: integer + EthFlowDescription: + description: Identifies an Ethernet flow + type: object + required: + - ethType + properties: + destMacAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + ethType: + type: string + fDesc: + $ref: '#/components/schemas/FlowDescription' + fDir: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/FlowDirection' + sourceMacAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + vlanTags: + type: array + items: + type: string + minItems: 1 + maxItems: 2 + srcMacAddrEnd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + destMacAddrEnd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + + + ResourcesAllocationInfo: + description: describes the status of the PCC rule(s) related to certain media components. + type: object + required: + - mcResourcStatus + properties: + mcResourcStatus: + $ref: '#/components/schemas/MediaComponentResourcesStatus' + flows: + type: array + items: + $ref: '#/components/schemas/Flows' + minItems: 1 + TemporalValidity: + description: Indicates the time interval(s) during which the AF request is to be applied + type: object + properties: + startTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + stopTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' +# + QosNotificationControlInfo: + description: Indicates whether the QoS targets for a GRB flow are not guaranteed or guaranteed again + type: object + required: + - notifType + properties: + notifType: + $ref: '#/components/schemas/QosNotifType' + flows: + type: array + items: + $ref: '#/components/schemas/Flows' + minItems: 1 + altSerReq: + type: string +# + AcceptableServiceInfo: + description: Indicates the maximum bandwidth that shall be authorized by the PCF. + type: object + properties: + accBwMedComps: + type: object + additionalProperties: + $ref: '#/components/schemas/MediaComponent' + marBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + marBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + + UeIdentityInfo: + description: Represents 5GS-Level UE identities. + type: object + anyOf: + - required: [gpsi] + - required: [pei] + - required: [supi] + properties: + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' +# + AccessNetChargingIdentifier: + description: Describes the access network charging identifier. + type: object + required: + - accNetChaIdValue + properties: + accNetChaIdValue: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + flows: + type: array + items: + $ref: '#/components/schemas/Flows' + minItems: 1 +# + OutOfCreditInformation: + description: Indicates the SDFs without available credit and the corresponding termination action. + type: object + required: + - finUnitAct + properties: + finUnitAct: + $ref: 'TS32291_Nchf_ConvergedCharging.yaml#/components/schemas/FinalUnitAction' + flows: + type: array + items: + $ref: '#/components/schemas/Flows' + minItems: 1 +# + QosMonitoringInformation: + description: Indicates the QoS Monitoring information to report, i.e. UL and/or DL and or round trip delay. + type: object + properties: + repThreshDl: + type: integer + repThreshUl: + type: integer + repThreshRp: + type: integer +# +# + NewTsnBridge: + description: Contains the new 5GS Bridge information and may contain the DS-TT port and/or NW-TT port management information. + type: object + required: + - tsnBridgeInfo + properties: + tsnBridgeInfo: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/TsnBridgeInfo' + tsnPortManContDstt: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + tsnPortManContNwtts: + type: array + items: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/PortManagementContainer' + minItems: 1 + +# + QosMonitoringInformationRm: + description: this data type is defined in the same way as the QosMonitoringInformation data type, but with the OpenAPI nullable property set to true. + type: object + properties: + repThreshDl: + type: integer + repThreshUl: + type: integer + repThreshRp: + type: integer + nullable: true +# + PcscfRestorationRequestData: + description: Indicates P-CSCF restoration. + type: object + oneOf: + - required: [ueIpv4] + - required: [ueIpv6] + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + ipDomain: + type: string + sliceInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + ueIpv4: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + +# +# + QosMonitoringReport: + description: QoS Monitoring reporting information + type: object + properties: + flows: + type: array + items: + $ref: '#/components/schemas/Flows' + minItems: 1 + ulDelays: + type: array + items: + type: integer + minItems: 1 + dlDelays: + type: array + items: + type: integer + minItems: 1 + rtDelays: + type: array + items: + type: integer + minItems: 1 +# + TsnQosContainer: + description: Indicates TSC Traffic QoS. + type: object + properties: + maxTscBurstSize: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtMaxDataBurstVol' + tscPackDelay: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudget' + tscPrioLevel: + $ref: '#/components/schemas/TscPriorityLevel' +# +# + TsnQosContainerRm: + description: Indicates removable TSC Traffic QoS. + type: object + properties: + maxTscBurstSize: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ExtMaxDataBurstVolRm' + tscPackDelay: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudgetRm' + tscPrioLevel: + $ref: '#/components/schemas/TscPriorityLevelRm' + nullable: true +# + TscaiInputContainer: + description: Indicates TSC Traffic pattern. + type: object + properties: + periodicity: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + burstArrivalTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + nullable: true +# +# EXTENDED PROBLEMDETAILS +# + ExtendedProblemDetails: + description: Extends ProblemDetails to also include the acceptable service info. + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + - type: object + properties: + acceptableServInfo: + $ref: '#/components/schemas/AcceptableServiceInfo' + +# +# SIMPLE DATA TYPES +# + AfAppId: + description: Contains an AF application identifier. + type: string + AspId: + description: Contains an identity of an application service provider. + type: string + CodecData: + description: Contains codec related information. + type: string + ContentVersion: + description: Represents the content version of some content. + type: integer + FlowDescription: + description: Defines a packet filter of an IP flow. + type: string + SponId: + description: Contains an identity of a sponsor. + type: string + ServiceUrn: + description: Contains values of the service URN and may include subservices. + type: string + TosTrafficClass: + description: 2-octet string, where each octet is encoded in hexadecimal representation. The first octet contains the IPv4 Type-of-Service or the IPv6 Traffic-Class field and the second octet contains the ToS/Traffic Class mask field. + type: string + TosTrafficClassRm: + description: this data type is defined in the same way as the TosTrafficClass data type, but with the OpenAPI nullable property set to true + type: string + nullable: true + TscPriorityLevel: + type: integer + minimum: 1 + maximum: 8 + TscPriorityLevelRm: + type: integer + minimum: 1 + maximum: 8 + nullable: true +# +# ENUMERATIONS DATA TYPES +# + MediaType: + anyOf: + - type: string + enum: + - AUDIO + - VIDEO + - DATA + - APPLICATION + - CONTROL + - TEXT + - MESSAGE + - OTHER + - type: string +# + ReservPriority: + anyOf: + - type: string + enum: + - PRIO_1 + - PRIO_2 + - PRIO_3 + - PRIO_4 + - PRIO_5 + - PRIO_6 + - PRIO_7 + - PRIO_8 + - PRIO_9 + - PRIO_10 + - PRIO_11 + - PRIO_12 + - PRIO_13 + - PRIO_14 + - PRIO_15 + - PRIO_16 + - type: string +# + ServAuthInfo: + anyOf: + - type: string + enum: + - TP_NOT_KNOWN + - TP_EXPIRED + - TP_NOT_YET_OCURRED + - type: string +# + SponsoringStatus: + anyOf: + - type: string + enum: + - SPONSOR_DISABLED + - SPONSOR_ENABLED + - type: string +# + AfEvent: + anyOf: + - type: string + enum: + - ACCESS_TYPE_CHANGE + - ANI_REPORT + - CHARGING_CORRELATION + - EPS_FALLBACK + - FAILED_RESOURCES_ALLOCATION + - OUT_OF_CREDIT + - PLMN_CHG + - QOS_MONITORING + - QOS_NOTIF + - RAN_NAS_CAUSE + - SUCCESSFUL_RESOURCES_ALLOCATION + - TSN_ETHER_PORT + - TSN_CONTAINER + - USAGE_REPORT + - type: string +# + AfNotifMethod: + anyOf: + - type: string + enum: + - EVENT_DETECTION + - ONE_TIME + - PERIODIC + - PDU_SESSION_RELEASE + - type: string +# + QosNotifType: + anyOf: + - type: string + enum: + - GUARANTEED + - NOT_GUARANTEED + - type: string +# + TerminationCause: + anyOf: + - type: string + enum: + - ALL_SDF_DEACTIVATION + - PDU_SESSION_TERMINATION + - PS_TO_CS_HO + - type: string +# + MediaComponentResourcesStatus: + anyOf: + - type: string + enum: + - ACTIVE + - INACTIVE + - type: string +# +# + FlowUsage: + anyOf: + - type: string + enum: + - NO_INFO + - RTCP + - AF_SIGNALLING + - type: string + + + FlowStatus: + anyOf: + - type: string + enum: + - ENABLED-UPLINK + - ENABLED-DOWNLINK + - ENABLED + - DISABLED + - REMOVED + - type: string +# + RequiredAccessInfo: + anyOf: + - type: string + enum: + - USER_LOCATION + - UE_TIME_ZONE + - type: string +# + SipForkingIndication: + anyOf: + - type: string + enum: + - SINGLE_DIALOGUE + - SEVERAL_DIALOGUES + - type: string +# + AfRequestedData: + anyOf: + - type: string + enum: + - UE_IDENTITY + - type: string +# + ServiceInfoStatus: + anyOf: + - type: string + enum: + - FINAL + - PRELIMINARY + - type: string +# + PreemptionControlInformation: + anyOf: + - type: string + enum: + - MOST_RECENT + - LEAST_RECENT + - HIGHEST_BW + - type: string +# + PrioritySharingIndicator: + anyOf: + - type: string + enum: + - ENABLED + - DISABLED + - type: string +# + PreemptionControlInformationRm: + anyOf: + - $ref: '#/components/schemas/PreemptionControlInformation' + - $ref: 'TS29571_CommonData.yaml#/components/schemas/NullValue' diff --git a/lib/sbi/support/3gpp-spec/TS29517_Naf_EventExposure.yaml b/lib/sbi/support/3gpp-spec/TS29517_Naf_EventExposure.yaml new file mode 100644 index 000000000..8152c7c07 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29517_Naf_EventExposure.yaml @@ -0,0 +1,476 @@ +openapi: 3.0.0 +info: + version: 1.0.0.alpha-2 + title: Naf_EventExposure + description: | + AF Event Exposure Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +externalDocs: + description: 3GPP TS 29.517 V16.0.0; 5G System; Application Function Event Exposure Service; Stage 3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.517/ + +servers: + - url: '{apiRoot}/naf-eventexposure/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 + +security: + - {} + - oAuth2ClientCredentials: [] + + +paths: + /subscriptions: + post: + summary: Creates a new Individual Application Event Exposure Subscription resource + operationId: PostAfEventExposureSubsc + tags: + - Application Event Subscription (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AfEventExposureSubsc' + responses: + '201': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/AfEventExposureSubsc' + headers: + Location: + description: 'Contains the URI of the created individual application event subscription resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + AfEventExposureNotif: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AfEventExposureNotif' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionId}: + get: + summary: "Reads an existing Individual Application Event Subscription" + operationId: GetAfEventExposureSubsc + tags: + - Individual Application Event Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: Application Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/AfEventExposureSubsc' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: "Modifies an existing Individual Application Event Subscription " + operationId: PutAfEventExposureSubsc + tags: + - Individual Application Event Subscription (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AfEventExposureSubsc' + parameters: + - name: subscriptionId + in: path + description: Application Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource was succesfully modified and representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/AfEventExposureSubsc' + '204': + description: No Content. Resource was succesfully modified + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: "Cancels an existing Individual Application Event Subscription " + operationId: DeleteAfEventExposureSubsc + tags: + - Individual Application Event Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: Application Event Subscription ID + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUri}' + scopes: {} + description: for trusted AF, the 'naf-eventexposure' shall be used as 'scopes' and '{nrfApiRoot}/oauth2/token' shall be used as 'tokenUri'. + + schemas: + AfEventExposureNotif: + type: object + properties: + notifId: + type: string + eventNotifs: + type: array + items: + $ref: '#/components/schemas/AfEventNotification' + minItems: 1 + required: + - notifId + - eventNotifs + AfEventExposureSubsc: + type: object + properties: + eventSubs: + type: array + items: + $ref: '#/components/schemas/EventsSubs' + minItems: 1 + eventsRepInfo: + $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifId: + type: string + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - eventSubs + - eventsRepInfo + - notifId + - notifUri + - suppFeat + AfEventNotification: + type: object + properties: + event: + $ref: '#/components/schemas/AfEvent' + timeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + svcExprcInfos: + type: array + items: + $ref: '#/components/schemas/ServiceExperienceInfoPerApp' + minItems: 1 + ueMobilityInfos: + type: array + items: + $ref: '#/components/schemas/UeMobilityCollection' + minItems: 1 + ueCommInfos: + type: array + items: + $ref: '#/components/schemas/UeCommunicationCollection' + minItems: 1 + excepInfos: + type: array + items: + $ref: '#/components/schemas/ExceptionInfo' + minItems: 1 + required: + - event + - timeStamp + EventsSubs: + type: object + properties: + event: + $ref: '#/components/schemas/AfEvent' + eventFilter: + $ref: '#/components/schemas/EventFilter' + required: + - event + - eventFilter + EventFilter: + type: object + properties: + gpsis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + minItems: 1 + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + exterGroupIds: + type: array + items: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExtGroupId' + minItems: 1 + interGroupIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + anyUeInd: + type: boolean + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + locArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + ServiceExperienceInfoPerApp: + type: object + properties: + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + svcExpPerFlows: + type: array + items: + $ref: '#/components/schemas/ServiceExperienceInfoPerFlow' + minItems: 1 + gpsis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + minItems: 1 + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + required: + - svcExpPerFlows + ServiceExperienceInfoPerFlow: + type: object + properties: + svcExprc: + $ref: '#/components/schemas/SvcExperience' + timeIntev: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + dnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + ipTrafficFilter: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + ethTrafficFilter: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + SvcExperience: + type: object + properties: + mos: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + upperRange: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + lowerRange: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + UeMobilityCollection: + type: object + properties: + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + ueTrajs: + type: array + items: + $ref: '#/components/schemas/UeTrajectoryCollection' + minItems: 1 + required: + - appId + - ueTrajs + UeCommunicationCollection: + type: object + properties: + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + exterGroupId: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExtGroupId' + interGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + comms: + type: array + items: + $ref: '#/components/schemas/CommunicationCollection' + minItems: 1 + required: + - appId + - comms + UeTrajectoryCollection: + type: object + properties: + ts: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + locArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + required: + - ts + - locArea + CommunicationCollection: + type: object + properties: + startTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ulVol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + dlVol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + required: + - startTime + - endTime + - ulVol + - dlVol + ExceptionInfo: + type: object + properties: + ipTrafficFilter: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + ethTrafficFilter: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + exceps: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/Exception' + minItems: 1 + +# Simple data types and Enumerations + + AfEvent: + anyOf: + - type: string + enum: + - SVC_EXPERIENCE + - UE_MOBILITY + - UE_COMM + - EXCEPTIONS + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29518_Namf_Communication.yaml b/lib/sbi/support/3gpp-spec/TS29518_Namf_Communication.yaml new file mode 100644 index 000000000..fa23d393f --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29518_Namf_Communication.yaml @@ -0,0 +1,2439 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-1 + title: Namf_Communication + description: | + AMF Communication Service + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - {} + - oAuth2ClientCredentials: + - namf-comm +externalDocs: + description: 3GPP TS 29.518 V15.3.0; 5G System; Access and Mobility Management Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.518/' +servers: + - url: '{apiRoot}/namf-comm/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +paths: + /ue-contexts/{ueContextId}: + put: + summary: Namf_Communication CreateUEContext service Operation + tags: + - Individual ueContext (Document) + operationId: CreateUEContext + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextCreateData' + binaryDataN2Information: + type: string + format: binary + binaryDataN2InformationExt1: + type: string + format: binary + binaryDataN2InformationExt2: + type: string + format: binary + binaryDataN2InformationExt3: + type: string + format: binary + binaryDataN2InformationExt4: + type: string + format: binary + binaryDataN2InformationExt5: + type: string + format: binary + binaryDataN2InformationExt6: + type: string + format: binary + binaryDataN2InformationExt7: + type: string + format: binary + binaryDataN2InformationExt8: + type: string + format: binary + binaryDataN2InformationExt9: + type: string + format: binary + binaryDataN2InformationExt10: + type: string + format: binary + binaryDataN2InformationExt11: + type: string + format: binary + binaryDataN2InformationExt12: + type: string + format: binary + binaryDataN2InformationExt13: + type: string + format: binary + binaryDataN2InformationExt14: + type: string + format: binary + binaryDataN2InformationExt15: + type: string + format: binary + binaryDataN2InformationExt16: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt2: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt3: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt4: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt5: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt6: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt7: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt8: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt9: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt10: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt11: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt12: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt13: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt14: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt15: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt16: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + required: true + callbacks: + onN2MessageNotify: + '{$request.body#/n2NotifyUri}': + post: + summary: Namf_Communication N2 Info Notify (UE Specific) service Operation + tags: + - N2 Info Notify + operationId: N2InfoNotify + requestBody: + description: UE Specific N2 Information Notification + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationNotification' + responses: + '200': + description: N2 Information Notification Response. + content: + application/json: + schema: + $ref: '#/components/schemas/N2InfoNotificationRspData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InfoNotificationRspData' + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + responses: + '201': + description: UE context successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//ue-contexts/{ueContextId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextCreatedData' + binaryDataN2Information: + type: string + format: binary + binaryDataN2InformationExt1: + type: string + format: binary + binaryDataN2InformationExt2: + type: string + format: binary + binaryDataN2InformationExt3: + type: string + format: binary + binaryDataN2InformationExt4: + type: string + format: binary + binaryDataN2InformationExt5: + type: string + format: binary + binaryDataN2InformationExt6: + type: string + format: binary + binaryDataN2InformationExt7: + type: string + format: binary + binaryDataN2InformationExt8: + type: string + format: binary + binaryDataN2InformationExt9: + type: string + format: binary + binaryDataN2InformationExt10: + type: string + format: binary + binaryDataN2InformationExt11: + type: string + format: binary + binaryDataN2InformationExt12: + type: string + format: binary + binaryDataN2InformationExt13: + type: string + format: binary + binaryDataN2InformationExt14: + type: string + format: binary + binaryDataN2InformationExt15: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt2: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt3: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt4: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt5: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt6: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt7: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt8: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt9: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt10: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt11: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt12: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt13: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt14: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt15: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreateError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreateError' + '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': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreateError' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/release: + post: + summary: Namf_Communication ReleaseUEContext service Operation + tags: + - Individual ueContext (Document) + operationId: ReleaseUEContext + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UEContextRelease' + required: true + responses: + '204': + description: UE Context successfully released + '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' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/assign-ebi: + post: + summary: Namf_Communication EBI Assignment service Operation + tags: + - Individual ueContext (Document) + operationId: EBIAssignment + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiData' + required: true + responses: + '200': + description: EBI Assignment successfully performed. + content: + application/json: + schema: + $ref: '#/components/schemas/AssignedEbiData' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiError' + '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': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiError' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/transfer: + post: + summary: Namf_Communication UEContextTransfer service Operation + tags: + - Individual ueContext (Document) + operationId: UEContextTransfer + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextTransferReqData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextTransferReqData' + binaryDataN1Message: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + required: true + responses: + '200': + description: UE context transfer successfully initiated. + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextTransferRspData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextTransferRspData' + binaryDataN2Information: + type: string + format: binary + binaryDataN2InformationExt1: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/transfer-update: + post: + summary: Namf_Communication RegistrationStatusUpdate service Operation + tags: + - Individual ueContext (Document) + operationId: RegistrationStatusUpdate + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UeRegStatusUpdateReqData' + required: true + responses: + '200': + description: UE context transfer status successfully updated. + content: + application/json: + schema: + $ref: '#/components/schemas/UeRegStatusUpdateRspData' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /ue-contexts/{ueContextId}/n1-n2-messages: + post: + summary: Namf_Communication N1N2 Message Transfer (UE Specific) service Operation + tags: + - n1N2Message collection (Document) + operationId: N1N2MessageTransfer + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|cid-.{1,255}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferReqData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N1N2MessageTransferReqData' + binaryDataN1Message: + type: string + format: binary + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + required: true + responses: + '202': + description: N1N2 Message Transfer accepted. + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferRspData' + '200': + description: N1N2 Message Transfer successfully initiated. + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferRspData' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI of the resource located on the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + 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' + '409': + description: Conflicts + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferError' + '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': + description: Gateway Timeout + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferError' + default: + description: Unexpected error + callbacks: + onN1N2TransferFailure: + '{$request.body#/n1n2FailureTxfNotifURI}': + post: + summary: Namf_Communication N1N2Transfer Failure Notification service Operation + tags: + - N1N2 Transfer Failure Notification + operationId: N1N2TransferFailureNotification + requestBody: + description: N1N2Transfer Failure Notification + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MsgTxfrFailureNotification' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /ue-contexts/{ueContextId}/n1-n2-messages/subscriptions: + post: + summary: Namf_Communication N1N2 Message Subscribe (UE Specific) service Operation + tags: + - N1N2 Subscriptions Collection for Individual UE Contexts (Document) + operationId: N1N2MessageSubscribe + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UeN1N2InfoSubscriptionCreateData' + required: true + responses: + '201': + description: N1N2 Message Subscription successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//{ueContextId}/n1-n2-messages/subscriptions/{subscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/UeN1N2InfoSubscriptionCreatedData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + default: + description: Unexpected error + callbacks: + onN1N2MessageNotify: + '{$request.body#/n1NotifyCallbackUri}': + post: + summary: Namf_Communication N1 Message Notify service Operation + tags: + - N1 Message Notify + operationId: N1MessageNotify + requestBody: + description: N1 Message Notification + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N1MessageNotification' + binaryDataN1Message: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + '{$request.body#/n2NotifyCallbackUri}': + post: + summary: Namf_Communication N2 Info Notify (UE Specific) service Operation + tags: + - N2 Info Notify + operationId: N2InfoNotify + requestBody: + description: UE Specific N2 Informaiton Notification + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InformationNotification' + binaryDataN1Message: + type: string + format: binary + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /ue-contexts/{ueContextId}/n1-n2-messages/subscriptions/{subscriptionId}: + delete: + summary: Namf_Communication N1N2 Message UnSubscribe (UE Specific) service Operation + tags: + - N1N2 Individual Subscription (Document) + operationId: N1N2MessageUnSubscribe + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + - name: subscriptionId + in: path + description: Subscription Identifier + required: true + schema: + type: string + responses: + '204': + description: N1N2 Message Subscription successfully removed. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /non-ue-n2-messages/transfer: + post: + summary: Namf_Communication Non UE N2 Message Transfer service Operation + tags: + - Non UE N2Messages collection (Document) + operationId: NonUeN2MessageTransfer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferReqData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InformationTransferReqData' + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + required: true + responses: + '200': + description: Non UE N2 Message Transfer successfully initiated. + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferRspData' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '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': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '503': + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + default: + description: Unexpected error + /non-ue-n2-messages/subscriptions: + post: + summary: Namf_Communication Non UE N2 Info Subscribe service Operation + tags: + - Non UE N2Messages Subscriptions collection (Document) + operationId: NonUeN2InfoSubscribe + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NonUeN2InfoSubscriptionCreateData' + required: true + responses: + '201': + description: Non UE N2 Info Subscription successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//non-ue-n2-messages/subscriptions/{n2NotifySubscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/NonUeN2InfoSubscriptionCreatedData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + callbacks: + onN2InfoNotify: + '{$request.body#/n2NotifyCallbackUri}': + post: + summary: Namf_Communication Non UE N2 Info Notify service Operation + tags: + - Non UE N2 Info Notify + operationId: NonUeN2InfoNotify + requestBody: + description: Non UE N2 Informaiton Notification + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationNotification' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InformationNotification' + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /non-ue-n2-messages/subscriptions/{n2NotifySubscriptionId}: + delete: + summary: Namf_Communication Non UE N2 Info UnSubscribe service Operation + tags: + - Non UE N2 Message Notification Individual Subscription (Document) + operationId: NonUeN2InfoUnSubscribe + parameters: + - name: n2NotifySubscriptionId + in: path + description: N2 info Subscription Identifier + required: true + schema: + type: string + responses: + '204': + description: Non UE N2 INfo Subscription successfully removed. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + /subscriptions: + post: + summary: Namf_Communication AMF Status Change Subscribe service Operation + tags: + - subscriptions collection (Document) + operationId: AMFStatusChangeSubscribe + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + required: true + responses: + '201': + description: N1N2 Message Subscription successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//subscriptions/{subscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + callbacks: + onAmfStatusChange: + '{$request.body#/amfStatusUri}': + post: + summary: Amf Status Change Notify service Operation + tags: + - Amf Status Change Notify + operationId: AmfStatusChangeNotify + requestBody: + description: Amf Status Change Notification + content: + application/json: + schema: + $ref: '#/components/schemas/AmfStatusChangeNotification' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /subscriptions/{subscriptionId}: + delete: + summary: Namf_Communication AMF Status Change UnSubscribe service Operation + tags: + - individual subscription (Document) + operationId: AMFStatusChangeUnSubscribe + parameters: + - name: subscriptionId + in: path + description: AMF Status Change Subscription Identifier + required: true + schema: + type: string + responses: + '204': + description: N1N2 Message Subscription successfully removed. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + put: + summary: Namf_Communication AMF Status Change Subscribe Modify service Operation + tags: + - individual subscription (Document) + operationId: AMFStatusChangeSubscribeModfy + parameters: + - name: subscriptionId + in: path + description: AMF Status Change Subscription Identifier + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + required: true + responses: + '202': + description: N1N2 Message Subscription successfully updated. + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + callbacks: + OnAmfStatusChange: + '{$request.body#/amfStatusUri}': + post: + summary: Amf Status Change Notify service Operation + tags: + - Amf Status Change Notify + operationId: AmfStatusChangeNOtify + requestBody: + description: Amf Status Change Notification + content: + application/json: + schema: + $ref: '#/components/schemas/AmfStatusChangeNotification' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + namf-comm: Access to the Namf_Communication API + schemas: +# +# STRUCTURED DATA TYPES +# + SubscriptionData: + type: object + properties: + amfStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + required: + - amfStatusUri + AmfStatusChangeNotification: + type: object + properties: + amfStatusInfoList: + type: array + items: + $ref: '#/components/schemas/AmfStatusInfo' + minItems: 1 + required: + - amfStatusInfoList + AmfStatusInfo: + type: object + properties: + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + statusChange: + $ref: '#/components/schemas/StatusChange' + targetAmfRemoval: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + targetAmfFailure: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + required: + - guamiList + - statusChange + AssignEbiData: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + arpList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + releasedEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + required: + - pduSessionId + AssignedEbiData: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + assignedEbiList: + type: array + items: + $ref: 'TS29502_Nsmf_PDUSession.yaml#/components/schemas/EbiArpMapping' + minItems: 0 + failedArpList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + releasedEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + required: + - pduSessionId + - assignedEbiList + AssignEbiFailed: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + failedArpList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + required: + - pduSessionId + UEContextRelease: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + ngapCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + required: + - ngapCause + N2InformationTransferReqData: + type: object + properties: + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + ratSelector: + $ref: '#/components/schemas/RatSelector' + ecgiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ecgi' + minItems: 1 + ncgiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ncgi' + minItems: 1 + globalRanNodeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + minItems: 1 + n2Information: + $ref: '#/components/schemas/N2InfoContainer' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n2Information + NonUeN2InfoSubscriptionCreateData: + type: object + properties: + globalRanNodeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + minItems: 1 + anTypeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + n2InformationClass: + $ref: '#/components/schemas/N2InformationClass' + n2NotifyCallbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n2InformationClass + - n2NotifyCallbackUri + NonUeN2InfoSubscriptionCreatedData: + type: object + properties: + n2NotifySubscriptionId: + type: string + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n2NotifySubscriptionId + UeN1N2InfoSubscriptionCreateData: + type: object + properties: + n2InformationClass: + $ref: '#/components/schemas/N2InformationClass' + n2NotifyCallbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + n1MessageClass: + $ref: '#/components/schemas/N1MessageClass' + n1NotifyCallbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + UeN1N2InfoSubscriptionCreatedData: + type: object + properties: + n1n2NotifySubscriptionId: + type: string + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n1n2NotifySubscriptionId + N2InformationNotification: + type: object + properties: + n2NotifySubscriptionId: + type: string + n2InfoContainer: + $ref: '#/components/schemas/N2InfoContainer' + toReleaseSessionList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + minItems: 1 + lcsCorrelationId: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CorrelationID' + notifyReason: + $ref: '#/components/schemas/N2InfoNotifyReason' + smfChangeInd: + $ref: '#/components/schemas/SmfChangeIndication' + required: + - n2NotifySubscriptionId + N2InfoContainer: + type: object + properties: + n2InformationClass: + $ref: '#/components/schemas/N2InformationClass' + smInfo: + $ref: '#/components/schemas/N2SmInformation' + ranInfo: + $ref: '#/components/schemas/N2RanInformation' + nrppaInfo: + $ref: '#/components/schemas/NrppaInformation' + pwsInfo: + $ref: '#/components/schemas/PwsInformation' + required: + - n2InformationClass + N1MessageNotification: + type: object + properties: + n1NotifySubscriptionId: + type: string + n1MessageContainer: + $ref: '#/components/schemas/N1MessageContainer' + lcsCorrelationId: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CorrelationID' + registrationCtxtContainer: + $ref: '#/components/schemas/RegistrationContextContainer' + required: + - n1MessageContainer + N1MessageContainer: + type: object + properties: + n1MessageClass: + $ref: '#/components/schemas/N1MessageClass' + n1MessageContent: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + serviceInstanceId: + type: string + required: + - n1MessageClass + - n1MessageContent + N1N2MessageTransferReqData: + type: object + properties: + n1MessageContainer: + $ref: '#/components/schemas/N1MessageContainer' + n2InfoContainer: + $ref: '#/components/schemas/N2InfoContainer' + skipInd: + type: boolean + default: false + lastMsgIndication: + type: boolean + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + lcsCorrelationId: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CorrelationID' + ppi: + $ref: '#/components/schemas/Ppi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + n1n2FailureTxfNotifURI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfReallocationInd: + type: boolean + default: false + areaOfValidity: + $ref: '#/components/schemas/AreaOfValidity' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + N1N2MessageTransferRspData: + type: object + properties: + cause: + $ref: '#/components/schemas/N1N2MessageTransferCause' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - cause + RegistrationContextContainer: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + localTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + anN2ApId: + type: integer + ranNodeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + initialAmfName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + userLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + rrcEstCause: + type: string + pattern: '^[0-9a-fA-F]+$' + ueContextRequest: + type: boolean + default: false + anN2IPv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + anN2IPv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + allowedNssai: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/AllowedNssai' + configuredNssai: + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/ConfiguredSnssai' + minItems: 1 + rejectedNssaiInPlmn: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + rejectedNssaiInTa: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + required: + - ueContext + - anType + - anN2ApId + - ranNodeId + - initialAmfName + - userLocation + AreaOfValidity: + type: object + properties: + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 0 + required: + - taiList + UeContextTransferReqData: + type: object + properties: + reason: + $ref: '#/components/schemas/TransferReason' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + regRequest: + $ref: '#/components/schemas/N1MessageContainer' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - reason + - accessType + UeContextTransferRspData: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + ueRadioCapability: + $ref: '#/components/schemas/N2InfoContent' + ueNbiotRadioCapability: + $ref: '#/components/schemas/N2InfoContent' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - ueContext + UeContext: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + supiUnauthInd: + type: boolean + gpsiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + minItems: 1 + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + ausfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + groupList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + minItems: 1 + drxParameter: + $ref: '#/components/schemas/DrxParameter' + subRfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + usedRfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + subUeAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + smsSupport: + $ref: '#/components/schemas/SmsSupport' + smsfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + seafData: + $ref: '#/components/schemas/SeafData' + 5gMmCapability: + $ref: '#/components/schemas/5GMmCapability' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfAmPolicyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + amPolicyReqTriggerList: + type: array + items: + $ref: '#/components/schemas/PolicyReqTrigger' + minItems: 1 + pcfUePolicyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + uePolicyReqTriggerList: + type: array + items: + $ref: '#/components/schemas/PolicyReqTrigger' + minItems: 1 + hpcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + restrictedRatList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 1 + forbiddenAreaList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Area' + minItems: 1 + serviceAreaRestriction: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + restrictedCoreNwTypeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CoreNetworkType' + minItems: 1 + eventSubscriptionList: + type: array + items: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/AmfEventSubscription' + minItems: 1 + mmContextList: + type: array + items: + $ref: '#/components/schemas/MmContext' + minItems: 1 + maxItems: 2 + sessionContextList: + type: array + items: + $ref: '#/components/schemas/PduSessionContext' + minItems: 1 + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + remainingServiceGapTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + N2SmInformation: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + n2InfoContent: + $ref: '#/components/schemas/N2InfoContent' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + homePlmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + subjectToHo: + type: boolean + required: + - pduSessionId + N2InfoContent: + type: object + properties: + ngapMessageType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + ngapIeType: + $ref: '#/components/schemas/NgapIeType' + ngapData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + required: + - ngapData + NrppaInformation: + type: object + properties: + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nrppaPdu: + $ref: '#/components/schemas/N2InfoContent' + serviceInstanceId: + type: string + required: + - nfId + - nrppaPdu + PwsInformation: + type: object + properties: + messageIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint16' + serialNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint16' + pwsContainer: + $ref: '#/components/schemas/N2InfoContent' + sendRanResponse: + type: boolean + default: false + omcId: + $ref: '#/components/schemas/OmcIdentifier' + required: + - messageIdentifier + - serialNumber + - pwsContainer + N1N2MsgTxfrFailureNotification: + type: object + properties: + cause: + $ref: '#/components/schemas/N1N2MessageTransferCause' + n1n2MsgDataUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + required: + - cause + - n1n2MsgDataUri + N1N2MessageTransferError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + errInfo: + $ref: '#/components/schemas/N1N2MsgTxfrErrDetail' + required: + - error + N1N2MsgTxfrErrDetail: + type: object + properties: + retryAfter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + highestPrioArp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + N2InformationTransferRspData: + type: object + properties: + result: + $ref: '#/components/schemas/N2InformationTransferResult' + pwsRspData: + $ref: '#/components/schemas/PWSResponseData' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - result + MmContext: + type: object + properties: + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + nasSecurityMode: + $ref: '#/components/schemas/NasSecurityMode' + nasDownlinkCount: + $ref: '#/components/schemas/NasCount' + nasUplinkCount: + $ref: '#/components/schemas/NasCount' + ueSecurityCapability: + $ref: '#/components/schemas/UeSecurityCapability' + s1UeNetworkCapability: + $ref: '#/components/schemas/S1UeNetworkCapability' + allowedNssai: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + nssaiMappingList: + type: array + items: + $ref: '#/components/schemas/NssaiMapping' + minItems: 1 + nsInstanceList: + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/NsiId' + minItems: 1 + expectedUEbehavior: + $ref: '#/components/schemas/ExpectedUeBehavior' + required: + - accessType + SeafData: + type: object + properties: + ngKsi: + $ref: '#/components/schemas/NgKsi' + keyAmf: + $ref: '#/components/schemas/KeyAmf' + nh: + type: string + pattern: '^[A-Fa-f0-9]+$' + ncc: + type: integer + minimum: 0 + maximum: 7 + keyAmfChangeInd: + type: boolean + keyAmfHDerivationInd: + type: boolean + required: + - ngKsi + - keyAmf + NasSecurityMode: + type: object + properties: + integrityAlgorithm: + $ref: '#/components/schemas/IntegrityAlgorithm' + cipheringAlgorithm: + $ref: '#/components/schemas/CipheringAlgorithm' + required: + - integrityAlgorithm + - cipheringAlgorithm + PduSessionContext: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + smContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + allocatedEbiList: + type: array + items: + $ref: 'TS29502_Nsmf_PDUSession.yaml#/components/schemas/EbiArpMapping' + minItems: 1 + hsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + vsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nsInstance: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/NsiId' + smfServiceInstanceId: + type: string + required: + - pduSessionId + - smContextRef + - sNssai + - dnn + - accessType + NssaiMapping: + type: object + properties: + mappedSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + required: + - mappedSnssai + - hSnssai + UeRegStatusUpdateReqData: + type: object + properties: + transferStatus: + $ref: '#/components/schemas/UeContextTransferStatus' + toReleaseSessionList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + minItems: 1 + pcfReselectedInd: + type: boolean + required: + - transferStatus + UeRegStatusUpdateRspData: + type: object + properties: + regStatusTransferComplete: + type: boolean + required: + - regStatusTransferComplete + AssignEbiError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + failureDetails: + $ref: '#/components/schemas/AssignEbiFailed' + required: + - error + - failureDetails + UeContextCreateData: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + targetId: + $ref: '#/components/schemas/NgRanTargetId' + sourceToTargetData: + $ref: '#/components/schemas/N2InfoContent' + pduSessionList: + type: array + items: + $ref: '#/components/schemas/N2SmInformation' + minItems: 1 + mmeControlFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + n2NotifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + ueRadioCapability: + $ref: '#/components/schemas/N2InfoContent' + ngapCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - ueContext + - targetId + - sourceToTargetData + - pduSessionList + UeContextCreatedData: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + targetToSourceData: + $ref: '#/components/schemas/N2InfoContent' + pduSessionList: + type: array + items: + $ref: '#/components/schemas/N2SmInformation' + minItems: 1 + failedSessionList: + type: array + items: + $ref: '#/components/schemas/N2SmInformation' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + pcfReselectedInd: + type: boolean + required: + - ueContext + - targetToSourceData + - pduSessionList + UeContextCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + ngapCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + required: + - error + NgRanTargetId: + type: object + properties: + ranNodeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + tai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + required: + - ranNodeId + - tai + PWSResponseData: + type: object + properties: + ngapMessageType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + serialNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint16' + messageIdentifier: + type: integer + unknownTaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + required: + - ngapMessageType + - serialNumber + - messageIdentifier + PWSErrorData: + type: object + properties: + namfCause: + type: integer + required: + - namfCause + N2InformationTransferError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pwdErrorInfo: + $ref: '#/components/schemas/PWSErrorData' + required: + - error + NgKsi: + type: object + properties: + tsc: + $ref: '#/components/schemas/ScType' + ksi: + type: integer + minimum: 0 + maximum: 6 + required: + - tsc + - ksi + KeyAmf: + type: object + properties: + keyType: + $ref: '#/components/schemas/KeyAmfType' + keyVal: + type: string + required: + - keyType + - keyVal + ExpectedUeBehavior: + type: object + properties: + expMoveTrajectory: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + minItems: 1 + validityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - expMoveTrajectory + - validityTime + N2RanInformation: + type: object + properties: + n2InfoContent: + $ref: '#/components/schemas/N2InfoContent' + required: + - n2InfoContent + N2InfoNotificationRspData: + type: object + properties: + n2InfoContent: + $ref: '#/components/schemas/N2InfoContent' +# +# SIMPLE DATA TYPES +# + EpsBearerId: + type: integer + minimum: 0 + maximum: 15 + Ppi: + type: integer + minimum: 0 + maximum: 7 + NasCount: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + 5GMmCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + UeSecurityCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + S1UeNetworkCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + DrxParameter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + OmcIdentifier: + type: string + +# +# ENUMERATIONS +# + StatusChange: + anyOf: + - type: string + enum: + - AMF_UNAVAILABLE + - AMF_AVAILABLE + - type: string + N2InformationClass: + anyOf: + - type: string + enum: + - SM + - NRPPa + - PWS + - PWS-BCAL + - PWS-RF + - RAN + - type: string + N1MessageClass: + anyOf: + - type: string + enum: + - 5GMM + - SM + - LPP + - SMS + - UPDP + - type: string + N1N2MessageTransferCause: + anyOf: + - type: string + enum: + - ATTEMPTING_TO_REACH_UE + - N1_N2_TRANSFER_INITIATED + - WAITING_FOR_ASYNCHRONOUS_TRANSFER + - UE_NOT_RESPONDING + - N1_MSG_NOT_TRANSFERRED + - UE_NOT_REACHABLE_FOR_SESSION + - type: string + UeContextTransferStatus: + anyOf: + - type: string + enum: + - TRANSFERRED + - NOT_TRANSFERRED + - type: string + N2InformationTransferResult: + anyOf: + - type: string + enum: + - N2_INFO_TRANSFER_INITIATED + - type: string + CipheringAlgorithm: + anyOf: + - type: string + enum: + - NEA0 + - NEA1 + - NEA2 + - NEA3 + - type: string + IntegrityAlgorithm: + anyOf: + - type: string + enum: + - NIA0 + - NIA1 + - NIA2 + - NIA3 + - type: string + SmsSupport: + anyOf: + - type: string + enum: + - 3GPP + - NON_3GPP + - BOTH + - NONE + - type: string + ScType: + anyOf: + - type: string + enum: + - NATIVE + - MAPPED + - type: string + KeyAmfType: + anyOf: + - type: string + enum: + - KAMF + - KPRIMEAMF + - type: string + TransferReason: + anyOf: + - type: string + enum: + - INIT_REG + - MOBI_REG + - MOBI_REG_UE_VALIDATED + - type: string + PolicyReqTrigger: + anyOf: + - type: string + enum: + - LOCATION_CHANGE + - PRA_CHANGE + - SARI_CHANGE + - RFSP_INDEX_CHANGE + - ALLOWED_NSSAI_CHANGE + - type: string + RatSelector: + anyOf: + - type: string + enum: + - E-UTRA + - NR + - type: string + NgapIeType: + anyOf: + - type: string + enum: + - PDU_RES_SETUP_REQ + - PDU_RES_REL_CMD + - PDU_RES_MOD_REQ + - HANDOVER_CMD + - HANDOVER_REQUIRED + - HANDOVER_PREP_FAIL + - SRC_TO_TAR_CONTAINER + - TAR_TO_SRC_CONTAINER + - RAN_STATUS_TRANS_CONTAINER + - SON_CONFIG_TRANSFER + - NRPPA_PDU + - UE_RADIO_CAPABILITY + - type: string + N2InfoNotifyReason: + anyOf: + - type: string + enum: + - HANDOVER_COMPLETED + - type: string + SmfChangeIndication: + anyOf: + - type: string + enum: + - INSERTED + - CHANGED + - REMOVED + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29518_Namf_EventExposure.yaml b/lib/sbi/support/3gpp-spec/TS29518_Namf_EventExposure.yaml new file mode 100644 index 000000000..9d9d8fb76 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29518_Namf_EventExposure.yaml @@ -0,0 +1,529 @@ +openapi: 3.0.0 +info: + version: 1.0.2 + title: Namf_EventExposure + description: | + AMF Event Exposure Service + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved.security: + - {} + - oAuth2ClientCredentials: + - namf-evts +externalDocs: + description: 3GPP TS 29.518 V15.4.0; 5G System; Access and Mobility Management Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.518/' +servers: + - url: '{apiRoot}/namf-evts/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +paths: + /subscriptions: + post: + summary: Namf_EventExposure Subscribe service Operation + tags: + - Subscriptions collection (Document) + operationId: CreateSubscription + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AmfCreateEventSubscription' + required: true + responses: + '201': + description: Subsription Created + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-evts//subscriptions/{subscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/AmfCreatedEventSubscription' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + callbacks: + onEventReport: + '{$request.body#/subscription/eventNotifyUri}': + post: + summary: Event Notificaiton Delivery + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AmfEventNotification' + required: true + responses: + '204': + description: Successful acknowledgement + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + default: + description: Unexpected error + onSubscriptionIdChangeEvtReport: + '{$request.body#/subscription/subsChangeNotifyUri}': + post: + summary: Event Notificaiton Delivery For Subscription Id Change + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AmfEventNotification' + required: true + responses: + '204': + description: Successful acknowledgement + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + default: + description: Unexpected error + /subscriptions/{subscriptionId}: + patch: + summary: Namf_EventExposure Subscribe Modify service Operation + tags: + - Individual subscription (Document) + operationId: ModifySubscription + parameters: + - name: subscriptionId + in: path + required: true + description: Unique ID of the subscription to be modified + schema: + type: string + requestBody: + content: + application/json-patch+json: + schema: + oneOf: + - $ref: '#/components/schemas/AmfUpdateEventSubscriptionItem' + - $ref: '#/components/schemas/AmfUpdateEventOptionItem' + required: true + responses: + '200': + description: Subsription modified successfully + content: + application/json: + schema: + $ref: '#/components/schemas/AmfUpdatedEventSubscription' + '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' + default: + description: Unexpected error + delete: + summary: Namf_EventExposure Unsubscribe service Operation + tags: + - Individual subscription (Document) + operationId: DeleteSubscription + parameters: + - name: subscriptionId + in: path + required: true + description: Unique ID of the subscription to be deleted + schema: + type: string + responses: + '204': + description: Subsription deleted successfully + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + default: + description: Unexpected error +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + namf-evts: Access to the Namf_EventExposure API + schemas: + AmfEventSubscription: + type: object + properties: + eventList: + type: array + items: + $ref: '#/components/schemas/AmfEvent' + minItems: 1 + eventNotifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifyCorrelationId: + type: string + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + subsChangeNotifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + subsChangeNotifyCorrelationId: + type: string + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + anyUE: + type: boolean + options: + $ref: '#/components/schemas/AmfEventMode' + required: + - eventList + - eventNotifyUri + - notifyCorrelationId + - nfId + AmfEvent: + type: object + properties: + type: + $ref: '#/components/schemas/AmfEventType' + immediateFlag: + type: boolean + areaList: + type: array + items: + $ref: '#/components/schemas/AmfEventArea' + minItems: 1 + locationFilterList: + type: array + items: + $ref: '#/components/schemas/LocationFilter' + minItems: 1 + refId: + $ref: 'TS29503_Nudm_EE.yaml#/components/schemas/ReferenceId' + required: + - type + AmfEventNotification: + type: object + properties: + notifyCorrelationId: + type: string + subsChangeNotifyCorrelationId: + type: string + reportList: + type: array + items: + $ref: '#/components/schemas/AmfEventReport' + minItems: 1 + AmfEventReport: + type: object + properties: + type: + $ref: '#/components/schemas/AmfEventType' + state: + $ref: '#/components/schemas/AmfEventState' + timeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + subscriptionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + anyUe: + type: boolean + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + areaList: + type: array + items: + $ref: '#/components/schemas/AmfEventArea' + minItems: 1 + refId: + $ref: 'TS29503_Nudm_EE.yaml#/components/schemas/ReferenceId' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + location: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + timezone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + accessTypeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + rmInfoList: + type: array + items: + $ref: '#/components/schemas/RmInfo' + minItems: 1 + cmInfoList: + type: array + items: + $ref: '#/components/schemas/CmInfo' + minItems: 1 + reachability: + $ref: '#/components/schemas/UeReachability' + commFailure: + $ref: '#/components/schemas/CommunicationFailure' + numberOfUes: + type: integer + required: + - type + - state + - timeStamp + AmfEventMode: + type: object + properties: + trigger: + $ref: '#/components/schemas/AmfEventTrigger' + maxReports: + type: integer + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - trigger + AmfEventState: + type: object + properties: + active: + type: boolean + remainReports: + type: integer + remainDuration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + required: + - active + RmInfo: + type: object + properties: + rmState: + $ref: '#/components/schemas/RmState' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + required: + - rmState + - accessType + CmInfo: + type: object + properties: + cmState: + $ref: '#/components/schemas/CmState' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + required: + - cmState + - accessType + CommunicationFailure: + type: object + properties: + nasReleaseCode: + type: string + ranReleaseCode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + AmfCreateEventSubscription: + type: object + properties: + subscription: + $ref: '#/components/schemas/AmfEventSubscription' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - subscription + AmfCreatedEventSubscription: + type: object + properties: + subscription: + $ref: '#/components/schemas/AmfEventSubscription' + subscriptionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + reportList: + type: array + items: + $ref: '#/components/schemas/AmfEventReport' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - subscription + - subscriptionId + AmfUpdateEventSubscriptionItem: + type: array + items: + type: object + properties: + op: + type: string + enum: + - add + - remove + - replace + path: + type: string + pattern: '\/eventList\/[0-]$|\/eventList\/[1-9][0-9]*$' + value: + $ref: '#/components/schemas/AmfEvent' + required: + - op + - path + minItems: 1 + AmfUpdateEventOptionItem: + type: object + properties: + op: + type: string + enum: + - replace + path: + type: string + pattern: '\/options\/expiry$' + value: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - op + - path + - value + AmfUpdatedEventSubscription: + type: object + properties: + subscription: + $ref: '#/components/schemas/AmfEventSubscription' + required: + - subscription + AmfEventArea: + type: object + properties: + presenceInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + ladnInfo: + $ref: '#/components/schemas/LadnInfo' + LadnInfo: + type: object + properties: + ladn: + type: string + presence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState' + required: + - ladn + 5gGuti: + type: string + AmfEventType: + anyOf: + - type: string + enum: + - LOCATION_REPORT + - PRESENCE_IN_AOI_REPORT + - TIMEZONE_REPORT + - ACCESS_TYPE_REPORT + - REGISTRATION_STATE_REPORT + - CONNECTIVITY_STATE_REPORT + - REACHABILITY_REPORT + - COMMUNICATION_FAILURE_REPORT + - UES_IN_AREA_REPORT + - SUBSCRIPTION_ID_CHANGE + - SUBSCRIPTION_ID_ADDITION + - LOSS_OF_CONNECTIVITY + - type: string + AmfEventTrigger: + anyOf: + - type: string + enum: + - ONE_TIME + - CONTINUOUS + - type: string + LocationFilter : + anyOf: + - type: string + enum: + - TAI + - CELL_ID + - N3IWF + - UE_IP + - UDP_PORT + - type: string + UeReachability: + anyOf: + - type: string + enum: + - UNREACHABLE + - REACHABLE + - REGULATORY_ONLY + - type: string + RmState: + anyOf: + - type: string + enum: + - REGISTERED + - DEREGISTERED + - type: string + CmState: + anyOf: + - type: string + enum: + - IDLE + - CONNECTED + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29518_Namf_Location.yaml b/lib/sbi/support/3gpp-spec/TS29518_Namf_Location.yaml new file mode 100644 index 000000000..1ad5651d7 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29518_Namf_Location.yaml @@ -0,0 +1,311 @@ +openapi: 3.0.0 +info: + version: 1.0.2 + title: Namf_Location + description: | + AMF Location Service + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - {} + - oAuth2ClientCredentials: + - namf-loc +externalDocs: + description: 3GPP TS 29.518 V15.3.0; 5G System; Access and Mobility Management Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.518/' +servers: + - url: '{apiRoot}/namf-loc/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +paths: + /{ueContextId}/provide-pos-info: + post: + summary: Namf_Location ProvidePositioningInfo service Operation + tags: + - Individual UE context (Document) + operationId: ProvidePositioningInfo + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RequestPosInfo' + required: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/ProvidePosInfo' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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: + description: Unexpected error + callbacks: + onUELocationNotification: + '{$request.body#/locationNotificationUri}': + post: + requestBody: + description: UE Location Event Notification + content: + application/json: + schema: + $ref: '#/components/schemas/NotifiedPosInfo' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + /{ueContextId}/provide-loc-info: + post: + summary: Namf_Location ProvideLocationInfo service Operation + tags: + - Individual UE context (Document) + operationId: ProvideLocationInfo + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RequestLocInfo' + required: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/ProvideLocInfo' + '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' + default: + description: Unexpected error +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + namf-loc: Access to the Namf_Location API + schemas: + RequestPosInfo: + type: object + properties: + lcsClientType: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/ExternalClientType' + lcsLocation: + $ref: '#/components/schemas/LocationType' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + priority: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/LcsPriority' + lcsQoS: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/LocationQoS' + velocityRequested: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/VelocityRequested' + lcsSupportedGADShapes: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/SupportedGADShapes' + locationNotificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - lcsClientType + - lcsLocation + ProvidePosInfo: + type: object + properties: + locationEstimate: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + accuracyFulfilmentIndicator: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/AccuracyFulfilmentIndicator' + ageOfLocationEstimate: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/AgeOfLocationEstimate' + velocityEstimate: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/VelocityEstimate' + positioningDataList: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/PositioningMethodAndUsage' + minItems: 0 + maxItems: 9 + gnssPositioningDataList: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GnssPositioningMethodAndUsage' + minItems: 0 + maxItems: 9 + ecgi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ecgi' + ncgi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ncgi' + targetServingNode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + civicAddress: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CivicAddress' + barometricPressure: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/BarometricPressure' + altitude: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/Altitude' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + NotifiedPosInfo: + type: object + properties: + locationEvent: + $ref: '#/components/schemas/LocationEvent' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + locationEstimate: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + ageOfLocationEstimate: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/AgeOfLocationEstimate' + velocityEstimate: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/VelocityEstimate' + positioningDataList: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/PositioningMethodAndUsage' + minItems: 0 + maxItems: 9 + gnssPositioningDataList: + type: array + items: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GnssPositioningMethodAndUsage' + minItems: 0 + maxItems: 9 + ecgi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ecgi' + ncgi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ncgi' + servingNode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + civicAddress: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CivicAddress' + barometricPressure: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/BarometricPressure' + altitude: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/Altitude' + required: + - locationEvent + RequestLocInfo: + type: object + properties: + req5gsLoc: + type: boolean + default: false + reqCurrentLoc: + type: boolean + default: false + reqRatType: + type: boolean + default: false + reqTimeZone: + type: boolean + default: false + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + ProvideLocInfo: + type: object + properties: + currentLoc: + type: boolean + location: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + geoInfo: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/GeographicArea' + locatoinAge: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/AgeOfLocationEstimate' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + timezone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + LocationType: + anyOf: + - type: string + enum: + - CURRENT_LOCATION + - CURRENT_OR_LAST_KNOWN_LOCATION + - INITIAL_LOCATION + - type: string + LocationEvent: + anyOf: + - type: string + enum: + - EMERGENCY_CALL_ORIGINATION + - EMERGENCY_CALL_RELEASE + - EMERGENCY_CALL_HANDOVER + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29518_Namf_MT.yaml b/lib/sbi/support/3gpp-spec/TS29518_Namf_MT.yaml new file mode 100644 index 000000000..727120c1a --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29518_Namf_MT.yaml @@ -0,0 +1,190 @@ +openapi: 3.0.0 +info: + version: 1.0.2 + title: Namf_MT + description: | + AMF Mobile Termination Service + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - {} + - oAuth2ClientCredentials: + - namf-mt +externalDocs: + description: 3GPP TS 29.518 V15.3.0; 5G System; Access and Mobility Management Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.518/' +servers: + - url: '{apiRoot}/namf-mt/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +paths: + '/ue-contexts/{ueContextId}': + get: + summary: Namf_MT Provide Domain Selection Info service Operation + tags: + - ueContext (Document) + operationId: Provide Domain Selection Info + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|.+)$' + - name: info-class + in: query + description: UE Context Information Class + schema: + $ref: '#/components/schemas/UeContextInfoClass' + - name: supported-features + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Requested UE Context Information returned + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextInfo' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI of the resource located on the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + 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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/ue-reachind: + put: + summary: Namf_MT EnableUEReachability service Operation + tags: + - ueReachInd (Document) + operationId: EnableUeReachability + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EnableUeReachabilityReqData' + required: true + responses: + '200': + description: UE has become reachable as desired + content: + application/json: + schema: + $ref: '#/components/schemas/EnableUeReachabilityRspData' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI of the resource located on the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + 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: + description: Unexpected error +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + namf-mt: Access to the Namf_MT API + schemas: + EnableUeReachabilityReqData: + type: object + properties: + reachability: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/UeReachability' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - reachability + EnableUeReachabilityRspData: + type: object + properties: + reachability: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/UeReachability' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - reachability + UeContextInfo: + type: object + properties: + supportVoPS: + type: boolean + supportVoPSn3gpp: + type: boolean + lastActTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + UeContextInfoClass: + anyOf: + - type: string + enum: + - TADS + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29519_Application_Data.yaml b/lib/sbi/support/3gpp-spec/TS29519_Application_Data.yaml new file mode 100644 index 000000000..f72356b5f --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29519_Application_Data.yaml @@ -0,0 +1,2001 @@ +openapi: 3.0.0 +info: + version: '-' + title: Unified Data Repository Service API file for Application Data + description: | + The API version is defined in 3GPP TS 29.504 + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.519 V16.3.0; 5G System; Usage of the Unified Data Repository Service for Policy Data, Application Data and Structured Data for Exposure. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.519/' + +paths: + /application-data/pfds: + get: + summary: Retrieve PFDs for application identifier(s) + operationId: ReadPFDData + tags: + - PFD Data (Store) + parameters: + - name: appId + in: query + description: Contains the information of the application identifier(s) for the querying PFD Data resource. If none appId is included in the URI, it applies to all application identifier(s) for the querying PFD Data resource. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + responses: + '200': + description: A representation of PFDs for request applications is returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdDataForAppExt' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/pfds/{appId}: + get: + summary: Retrieve the corresponding PFDs of the specified application identifier + operationId: ReadIndividualPFDData + tags: + - Individual PFD Data (Document) + parameters: + - name: appId + in: path + description: Indicate the application identifier for the request pfd(s). It shall apply the format of Data type ApplicationId. + required: true + schema: + type: string + responses: + '200': + description: A representation of PFDs for the request application identified by the application identifier is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdDataForAppExt' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete the corresponding PFDs of the specified application identifier + operationId: DeleteIndividualPFDData + tags: + - Individual PFD Data (Document) + parameters: + - name: appId + in: path + description: Indicate the application identifier for the request pfd(s). It shall apply the format of Data type ApplicationId. + required: true + schema: + type: string + responses: + '204': + description: Successful case. The Individual PFD Data resource related to the application identifier was deleted. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Create or update the corresponding PFDs for the specified application identifier + operationId: CreateOrReplaceIndividualPFDData + tags: + - Individual PFD Data (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PfdDataForAppExt' + parameters: + - name: appId + in: path + description: Indicate the application identifier for the request pfd(s). It shall apply the format of Data type ApplicationId. + required: true + schema: + type: string + responses: + '201': + description: The creation of an Individual PFD Data resource related to the application-identifier is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdDataForAppExt' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr/{apiVersion}/application-data/pfds/{appId}' + required: true + schema: + type: string + '200': + description: Successful case. The upgrade of an Individual PFD Data resource related to the application identifier is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdDataForAppExt' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/influenceData: + get: + summary: Retrieve Traffic Influence Data + operationId: ReadInfluenceData + tags: + - Influence Data (Store) + parameters: + - name: influence-Ids + in: query + description: Each element identifies a service. + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: dnns + in: query + description: Each element identifies a DNN. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + - name: snssais + in: query + description: Each element identifies a slice. + required: false + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + - name: internal-Group-Ids + in: query + description: Each element identifies a group of users. + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: supis + in: query + description: Each element identifies the user. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + - name: supp-feat + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: The Traffic Influence Data stored in the UDR are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TrafficInfluData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/influenceData/{influenceId}: + put: + summary: Create or update an individual Influence Data resource + operationId: CreateOrReplaceIndividualInfluenceData + tags: + - Individual Influence Data (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluData' + parameters: + - name: influenceId + in: path + description: The Identifier of an Individual Influence Data to be created or updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '201': + description: The creation of an Individual Traffic Influence Data resource is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluData' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr/{apiVersion}/application-data/influenceData/{influenceId}' + required: true + schema: + type: string + '200': + description: The update of an Individual Traffic Influence Data resource is confirmed and a response body containing Traffic Influence Data shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluData' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Modify part of the properties of an individual Influence Data resource + operationId: UpdateIndividualInfluenceData + tags: + - Individual Influence Data (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluDataPatch' + parameters: + - name: influenceId + in: path + description: The Identifier of an Individual Influence Data to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '200': + description: The update of an Individual Traffic Influence Data resource is confirmed and a response body containing Traffic Influence Data shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluData' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete an individual Influence Data resource + operationId: DeleteIndividualInfluenceData + tags: + - Individual Influence Data (Document) + parameters: + - name: influenceId + in: path + description: The Identifier of an Individual Influence Data to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '204': + description: The Individual Influence Data was deleted successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/influenceData/subs-to-notify: + post: + summary: Create a new Individual Influence Data Subscription resource + operationId: CreateIndividualInfluenceDataSubscription + tags: + - Influence Data Subscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + responses: + '201': + description: The subscription was created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + trafficInfluenceDataChangeNotification: + '{$request.body#/notificationUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + oneOf: + - $ref: '#/components/schemas/TrafficInfluData' + - $ref: '#/components/schemas/TrafficInfluDataNotif' + minItems: 1 + responses: + '204': + description: No Content, Notification was successful + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: + summary: Read Influence Data Subscriptions + operationId: ReadInfluenceDataSubscriptions + tags: + - Influence Data Subscriptions (Collection) + parameters: + - name: dnn + in: query + description: Identifies a DNN. + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + - name: snssai + in: query + description: Identifies a slice. + required: false + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + - name: internal-Group-Id + in: query + description: Identifies a group of users. + required: false + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + - name: supi + in: query + description: Identifies a user. + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + responses: + '200': + description: The subscription information as request in the request URI query parameter(s) are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TrafficInfluSub' + minItems: 0 + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/influenceData/subs-to-notify/{subscriptionId}: + get: + summary: Get an existing individual Influence Data Subscription resource + operationId: ReadIndividualInfluenceDataSubscription + tags: + - Individual Influence Data Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Influence Data Subscription + required: true + schema: + type: string + responses: + '200': + description: The subscription information is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Modify an existing individual Influence Data Subscription resource + operationId: ReplaceIndividualInfluenceDataSubscription + tags: + - Individual Influence Data Subscription (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Influence Data Subscription + required: true + schema: + type: string + responses: + '200': + description: The subscription was updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete an individual Influence Data Subscription resource + operationId: DeleteIndividualInfluenceDataSubscription + tags: + - Individual Influence Data Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Individual Influence Data Subscription + required: true + schema: + type: string + responses: + '204': + description: The subscription was terminated successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/bdtPolicyData: + get: + summary: Retrieve applied BDT Policy Data + operationId: ReadBdtPolicyData + tags: + - BdtPolicy Data (Store) + parameters: + - name: bdt-policy-ids + in: query + description: Each element identifies a service. + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: internal-group-ids + in: query + description: Each element identifies a group of users. + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: supis + in: query + description: Each element identifies the user. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + responses: + '200': + description: The applied BDT policy Data stored in the UDR are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/BdtPolicyData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/bdtPolicyData/{bdtPolicyId}: + put: + summary: Create an individual applied BDT Policy Data resource + operationId: CreateIndividualAppliedBdtPolicyData + tags: + - Individual BDT Policy Data (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BdtPolicyData' + parameters: + - name: bdtPolicyId + in: path + description: The Identifier of an Individual Applied BDT Policy Data to be created or updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '201': + description: The creation of an Individual Applied BDT Policy Data resource is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/BdtPolicyData' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr/{apiVersion}/application-data/bdtPolicyData/{bdtPolicyId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Modify part of the properties of an individual Applied BDT Policy Data resource + operationId: UpdateIndividualAppliedBdtPolicyData + tags: + - Individual Applied BDT Policy Data (Document) + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/BdtPolicyDataPatch' + parameters: + - name: bdtPolicyId + in: path + description: The Identifier of an Individual Applied BDT Policy Data to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '200': + description: The update of an Individual Applied BDT Policy Data resource is confirmed and a response body containing Applied BDT Policy Data shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/BdtPolicyData' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete an individual Applied BDT Policy Data resource + operationId: DeleteIndividualAppliedBdtPolicyData + tags: + - Individual Applied BDT Policy Data (Document) + parameters: + - name: bdtPolicyId + in: path + description: The Identifier of an Individual Applied BDT Policy Data to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '204': + description: The Individual Applied BDT Policy Data was deleted successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /application-data/iptvConfigData: + get: + summary: Retrieve IPTV configuration Data + operationId: ReadIPTVCongifurationData + tags: + - IPTV Configuration Data (Store) + parameters: + - name: config-ids + in: query + description: Each element identifies a configuration. + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: dnns + in: query + description: Each element identifies a DNN. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + - name: snssais + in: query + description: Each element identifies a slice. + required: false + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + - name: supis + in: query + description: Each element identifies the user. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + - name: inter-group-ids + in: query + description: Each element identifies a group of users. + required: false + schema: + type: array + items: + type: string + minItems: 1 + responses: + '200': + description: The IPTV configuration data stored in the UDR are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/IptvConfigData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/iptvConfigData/{configurationId}: + put: + summary: Create or update an individual IPTV configuration resource + operationId: CreateOrReplaceIndividualIPTVConfigurationData + tags: + - Individual IPTV Configuration Data (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + parameters: + - name: configurationId + in: path + description: The Identifier of an Individual IPTV Configuration Data to be created or updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '201': + description: The creation of an Individual IPTV Configuration Data resource is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '200': + description: The update of an Individual IPTV configuration resource. + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Partial update an individual IPTV configuration resource + operationId: PartialReplaceIndividualIPTVConfigurationData + tags: + - Individual IPTV Configuration Data + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/IptvConfigDataPatch' + parameters: + - name: configurationId + in: path + description: The Identifier of an Individual IPTV Configuration Data to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '200': + description: The update of an Individual IPTV configuration resource. + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete an individual IPTV configuration resource + operationId: DeleteIndividualIPTVConfigurationData + tags: + - Individual IPTV Configuration Data (Document) + parameters: + - name: configurationId + in: path + description: The Identifier of an Individual IPTV Configuration to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '204': + description: The resource was deleted successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/serviceParamData: + get: + summary: Retrieve Service Parameter Data + operationId: ReadServiceParameterData + tags: + - Service Parameter Data (Store) + parameters: + - name: service-param-ids + in: query + description: Each element identifies a service. + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: dnns + in: query + description: Each element identifies a DNN. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + - name: snssais + in: query + description: Each element identifies a slice. + required: false + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + - name: internal-group-ids + in: query + description: Each element identifies a group of users. + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: supis + in: query + description: Each element identifies the user. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + - name: ue-ipv4s + in: query + description: Each element identifies the user. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + - name: ue-ipv6s + in: query + description: Each element identifies the user. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + - name: ue-mac + in: query + description: Each element identifies the user. + required: false + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + minItems: 1 + - name: supp-feat + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: The Service Parameter Data stored in the UDR are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ServiceParameterData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/serviceParamData/{serviceParamId}: + put: + summary: Create or update an individual Service Parameter Data resource + operationId: CreateOrReplaceServiceParameterData + tags: + - Individual Service Parameter Data (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + parameters: + - name: serviceParamId + in: path + description: The Identifier of an Individual Service Parameter Data to be created or updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '201': + description: The creation of an Individual Service Parameter Data resource is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nudr-dr/{apiVersion}/application-data/serviceParamData/{serviceParamId}' + required: true + schema: + type: string + '200': + description: The update of an Individual Service Parameter Data resource is confirmed and a response body containing Service Parameter Data shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Modify part of the properties of an individual Service Parameter Data resource + operationId: UpdateIndividualServiceParameterData + tags: + - Individual Service Parameter Data (Document) + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: 'TS29522_ServiceParameter.yaml#/components/schemas/ServiceParameterDataPatch' + parameters: + - name: serviceParamId + in: path + description: The Identifier of an Individual Service Parameter Data to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '200': + description: The update of an Individual Service Parameter Data resource is confirmed and a response body containing Service Parameter Data shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + '204': + description: No content + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete an individual Service Parameter Data resource + operationId: DeleteIndividualServiceParameterData + tags: + - Individual Service Parameter Data (Document) + parameters: + - name: serviceParamId + in: path + description: The Identifier of an Individual Service Parameter Data to be updated. It shall apply the format of Data type string. + required: true + schema: + type: string + responses: + '204': + description: The Individual Service Parameter Data was deleted successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /application-data/subs-to-notify: + post: + summary: Create a subscription to receive notification of application data changes + operationId: CreateIndividualApplicationDataSubscription + tags: + - ApplicationDataSubscriptions (Collection) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationDataSubs' + responses: + '201': + description: Upon success, a response body containing a representation of each Individual subscription resource shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationDataSubs' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + applicationDataChangeNotif: + '{$request.body#/notificationUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ApplicationDataChangeNotif' + minItems: 1 + responses: + '204': + description: No Content, Notification was successful + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: + summary: Read Application Data change Subscriptions + operationId: ReadApplicationDataChangeSubscriptions + tags: + - ApplicationDataSubscriptions (Collection) + parameters: + - name: data-filter + in: query + description: The data filter for the query. + required: false + schema: + $ref: '#/components/schemas/DataFilter' + responses: + '200': + description: The subscription information as request in the request URI query parameter(s) are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ApplicationDataSubs' + minItems: 0 + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /application-data/subs-to-notify/{subsId}: + parameters: + - name: subsId + in: path + required: true + schema: + type: string + put: + summary: Modify a subscription to receive notification of application data changes + operationId: ReplaceIndividualApplicationDataSubscription + tags: + - IndividualApplicationDataSubscription (Document) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationDataSubs' + responses: + '200': + description: The individual subscription resource was updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationDataSubs' + '204': + description: The individual subscription resource was updated successfully and no additional content is to be sent in the response message. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete the individual Application Data subscription + operationId: DeleteIndividualApplicationDataSubscription + tags: + - IndividualApplicationDataSubscription (Document) + responses: + '204': + description: Upon success, an empty response body shall be returned. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: + summary: Get an existing individual Application Data Subscription resource + operationId: ReadIndividualApplicationDataSubscription + tags: + - IndividualApplicationDataSubscription (Document) + parameters: + - name: subsId + in: path + description: String identifying a subscription to the Individual Application Data Subscription + required: true + schema: + type: string + responses: + '200': + description: The subscription information is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/ApplicationDataSubs' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + +components: + schemas: + TrafficInfluData: + type: object + properties: + upPathChgNotifCorreId: + type: string + description: Contains the Notification Correlation Id allocated by the NEF for the UP path change notification. + appReloInd: + type: boolean + description: Identifies whether an application can be relocated once a location of the application has been selected. + afAppId: + type: string + description: Identifies an application. + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + ethTrafficFilters: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet filters. Either "trafficFilters" or "ethTrafficFilters" shall be included if applicable. + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + interGroupId: + type: string + description: Identifies a group of users. + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + trafficFilters: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Identifies IP packet filters. Either "trafficFilters" or "ethTrafficFilters" shall be included if applicable. + trafficRoutes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + minItems: 1 + description: Identifies the N6 traffic routing requirement. + traffCorreInd: + type: boolean + validStartTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + validEndTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + tempValidities: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/TemporalValidity' + minItems: 1 + description: Identifies the temporal validities for the N6 traffic routing requirement. + nwAreaInfo: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + upPathChgNotifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + subscribedEvents: + type: array + items: + $ref: 'TS29522_TrafficInfluence.yaml#/components/schemas/SubscribedEvent' + minItems: 1 + dnaiChgType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DnaiChangeType' + afAckInd: + type: boolean + addrPreserInd: + type: boolean + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + allOf: + - oneOf: + - required: [afAppId] + - required: [trafficFilters] + - required: [ethTrafficFilters] + - oneOf: + - required: [supi] + - required: [interGroupId] + TrafficInfluDataPatch: + type: object + properties: + upPathChgNotifCorreId: + type: string + description: Contains the Notification Correlation Id allocated by the NEF for the UP path change notification. + appReloInd: + type: boolean + description: Identifies whether an application can be relocated once a location of the application has been selected. + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + ethTrafficFilters: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet filters. Either "trafficFilters" or "ethTrafficFilters" shall be included if applicable. + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + internalGroupId: + type: string + description: Identifies a group of users. + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + trafficFilters: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Identifies IP packet filters. Either "trafficFilters" or "ethTrafficFilters" shall be included if applicable. + trafficRoutes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + minItems: 1 + description: Identifies the N6 traffic routing requirement. + traffCorreInd: + type: boolean + validStartTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + validEndTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + tempValidities: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/TemporalValidity' + minItems: 1 + nullable: true + description: Identifies the temporal validities for the N6 traffic routing requirement. + nwAreaInfo: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + upPathChgNotifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + afAckInd: + type: boolean + addrPreserInd: + type: boolean + TrafficInfluSub: + type: object + properties: + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + description: Each element identifies a DNN. + snssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + description: Each element identifies a slice. + internalGroupIds: + type: array + items: + type: string + minItems: 1 + description: Each element identifies a group of users. + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + description: Each element identifies the user. + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notificationUri + oneOf: + - required: [dnns] + - required: [snssais] + - required: [internalGroupIds] + - required: [supis] + TrafficInfluDataNotif: + type: object + properties: + resUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + trafficInfluData: + $ref: '#/components/schemas/TrafficInfluData' + required: + - resourceId + PfdDataForAppExt: + allOf: + - $ref: 'TS29551_Nnef_PFDmanagement.yaml#/components/schemas/PfdDataForApp' + - type: object + properties: + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + BdtPolicyData: + type: object + properties: + interGroupId: + type: string + description: Identifies a group of users. + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + required: + - bdtRefId + BdtPolicyDataPatch: + type: object + properties: + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + required: + - bdtRefId + IptvConfigData: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + interGroupId: + type: string + description: Identifies a group of users. + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + afAppId: + type: string + multiAccCtrls: + type: object + additionalProperties: + $ref: 'TS29522_IPTVConfiguration.yaml#/components/schemas/MulticastAccessControl' + minProperties: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - afAppId + - multiAccCtrls + - suppFeat + oneOf: + - required: [interGroupId] + - required: [supi] + IptvConfigDataPatch: + type: object + properties: + multiAccCtrls: + type: object + additionalProperties: + $ref: 'TS29522_IPTVConfiguration.yaml#/components/schemas/MulticastAccessControl' + minProperties: 1 + ServiceParameterData: + type: object + properties: + appId: + type: string + description: Identifies an application. + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + interGroupId: + type: string + description: Identifies a group of users. + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + ipv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + macAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + paramOverPc5: + $ref: 'TS29522_ServiceParameter.yaml#/components/schemas/ParameterOverPc5' + paramOverUu: + $ref: 'TS29522_ServiceParameter.yaml#/components/schemas/ParameterOverUu' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + ApplicationDataSubs: + description: Identifies a subscription to application data change notification. + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + dataFilters: + type: array + items: + $ref: '#/components/schemas/DataFilter' + minItems: 1 + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notificationUri + ApplicationDataChangeNotif: + description: Contains changed application data for which notification was requested. + type: object + properties: + iptvConfigData: + $ref: '#/components/schemas/IptvConfigData' + pfdData: + $ref: 'TS29551_Nnef_PFDmanagement.yaml#/components/schemas/PfdChangeNotification' + bdtPolicyData: + $ref: '#/components/schemas/BdtPolicyData' + resUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + serParamData: + $ref: '#/components/schemas/ServiceParameterData' + required: + - resUri + DataFilter: + description: Identifies a data filter. + type: object + properties: + dataInd: + $ref: '#/components/schemas/DataInd' + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + snssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + internalGroupIds: + type: array + items: + type: string + minItems: 1 + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + ueIpv4s: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ueIpv6s: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + ueMacs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + minItems: 1 + required: + - dataInd + oneOf: + - required: [dnns] + - required: [snssais] + - required: [internalGroupIds] + - required: [supis] + - required: [ueIpv4s] + - required: [ueIpv6s] + - required: [ueMacs] + DataInd: + anyOf: + - type: string + enum: + - PFD + - IPTV + - BDT + - SVC_PARAM + - 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 + - PFD + - IPTV + - BDT + - SVC_PARAM diff --git a/lib/sbi/support/3gpp-spec/TS29519_Exposure_Data.yaml b/lib/sbi/support/3gpp-spec/TS29519_Exposure_Data.yaml new file mode 100644 index 000000000..9f4586aea --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29519_Exposure_Data.yaml @@ -0,0 +1,656 @@ +openapi: 3.0.0 +info: + version: '-' + title: Unified Data Repository Service API file for structured data for exposure + description: | + The API version is defined in 3GPP TS 29.504 + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.519 V16.3.0; 5G System; Usage of the Unified Data Repository Service for Policy Data, Application Data and Structured Data for Exposure. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.519/' + +paths: + /exposure-data/{ueId}/access-and-mobility-data: + put: + summary: Creates and updates the access and mobility exposure data for a UE + operationId: CreateOrReplaceAccessAndMobilityData + tags: + - AccessAndMobilityData + 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/AccessAndMobilityData' + responses: + '201': + description: Upon success, a response body is returned containing a representation of the access and mobility data + content: + application/json: + schema: + $ref: '#/components/schemas/AccessAndMobilityData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: + summary: Retrieves the access and mobility exposure data for a UE + operationId: QueryAccessAndMobilityData + tags: + - AccessAndMobilityData + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: supp-feat + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: The response body contains the access and mobility data + content: + application/json: + schema: + $ref: '#/components/schemas/AccessAndMobilityData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes the access and mobility exposure data for a UE + operationId: DeleteAccessAndMobilityData + tags: + - AccessAndMobilityData + 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 + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Updates the access and mobility exposure data for a UE + operationId: UpdateAccessAndMobilityData + tags: + - AccessAndMobilityData + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/AccessAndMobilityData' + responses: + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /exposure-data/{ueId}/session-management-data/{pduSessionId}: + put: + summary: Creates and updates the session management data for a UE and for an individual PDU session + operationId: CreateOrReplaceSessionManagementData + tags: + - PduSessionManagementData + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: pduSessionId + in: path + description: PDU session id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PduSessionManagementData' + responses: + '201': + description: Upon success, a response body is returned containing a representation of the session management data + content: + application/json: + schema: + $ref: '#/components/schemas/PduSessionManagementData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: + summary: Retrieves the session management data for a UE and for an individual PDU session + operationId: QuerySessionManagementData + tags: + - PduSessionManagementData + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: pduSessionId + in: path + description: PDU session id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + - name: ipv4-addr + in: query + description: IPv4 Address of the UE + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + - name: ipv6-prefix + in: query + description: IPv6 Address Prefix of the UE + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + - name: dnn + in: query + description: DNN of the UE + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: supp-feat + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: The response body contains the session management data + content: + application/json: + schema: + $ref: '#/components/schemas/PduSessionManagementData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes the session management data for a UE and for an individual PDU session + operationId: DeleteSessionManagementData + tags: + - PduSessionManagementData + parameters: + - name: ueId + in: path + description: UE id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: pduSessionId + in: path + description: PDU session id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + responses: + '204': + description: Upon success, an empty response body shall be returned + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /exposure-data/subs-to-notify: + post: + summary: Create a subscription to receive notification of exposure data changes + operationId: CreateIndividualExposureDataSubscription + tags: + - ExposureDataSubscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ExposureDataSubscription' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/ExposureDataSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + exposureDataChangeNotification: + '{$request.body#/notificationUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ExposureDataChangeNotification' + minItems: 1 + responses: + '204': + description: No Content, Notification was successful + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /exposure-data/subs-to-notify/{subId}: + put: + summary: updates a subscription to receive notifications of exposure data changes + operationId: ReplaceIndividualExposureDataSubscription + tags: + - IndividualExposureDataSubscription (Document) + parameters: + - name: subId + in: path + description: Subscription id + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ExposureDataSubscription' + responses: + '200': + description: Resource was successfully modified and a body with the modified subscription to notifications about exposure data is returned.. + content: + application/json: + schema: + $ref: '#/components/schemas/ExposureDataSubscription' + '204': + description: The individual subscription resource was successfully modified. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes the individual Exposure Data subscription + operationId: DeleteIndividualExposureDataSubscription + tags: + - IndividualExposureDataSubscription (Document) + parameters: + - name: subId + in: path + description: Subscription id + required: true + schema: + type: string + responses: + '204': + description: Resource was successfully deleted. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + schemas: + AccessAndMobilityData: + type: object + properties: + location: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + locationTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + timeZoneTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + regStates: + type: array + items: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/RmInfo' + regStatesTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + connStates: + type: array + items: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/CmInfo' + connStatesTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + reachabilityStatus: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/UeReachability' + reachabilityStatusTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + smsOverNasStatus: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/SmsSupport' + smsOverNasStatusTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + roamingStatus: + type: boolean + description: True The serving PLMN of the UE is different from the HPLMN of the UE; False The serving PLMN of the UE is the HPLMN of the UE. + roamingStatusTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + currentPlmn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + currentPlmnTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ratType: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + ratTypesTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + PduSessionManagementData: + type: object + properties: + pduSessionStatus: + $ref: '#/components/schemas/PduSessionStatus' + pduSessionStatusTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + dnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + dnaiTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + n6TrafficRoutingInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + n6TrafficRoutingInfoTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Prefix: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + minItems: 1 + description: UE IPv6 prefix. + ipv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + pduSessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + ipAddrTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + ExposureDataSubscription: + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + monitoredResourceUris: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notificationUri + - monitoredResourceUris + ExposureDataChangeNotification: + type: object + properties: + ueId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + accessAndMobilityData: + $ref: '#/components/schemas/AccessAndMobilityData' + pduSessionManagementData: + type: array + items: + $ref: '#/components/schemas/PduSessionManagementData' + minItems: 1 + delResources: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + PduSessionStatus: + anyOf: + - type: string + enum: + - "ACTIVE" + - "RELEASED" + - 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 + - "ACTIVE" + - "RELEASED" diff --git a/lib/sbi/support/3gpp-spec/TS29519_Policy_Data.yaml b/lib/sbi/support/3gpp-spec/TS29519_Policy_Data.yaml new file mode 100644 index 000000000..c2395ce67 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29519_Policy_Data.yaml @@ -0,0 +1,1503 @@ +openapi: 3.0.0 +info: + version: '-' + title: Unified Data Repository Service API file for policy data + description: | + The API version is defined in 3GPP TS 29.504 + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.519 V16.3.0; 5G System; Usage of the Unified Data Repository Service for Policy Data, Application Data and Structured Data for Exposure. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.519/' + +paths: + /policy-data/ues/{ueId}/am-data: + parameters: + - name: ueId + in: path + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + get: + summary: Retrieves the access and mobility policy data for a subscriber + operationId: ReadAccessAndMobilityPolicyData + tags: + - AccessAndMobilityPolicyData (Document) + responses: + '200': + description: Upon success, a response body containing access and mobility policies shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/AmPolicyData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/ues/{ueId}/ue-policy-set: + parameters: + - name: ueId + in: path + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + get: + summary: Retrieves the UE policy set data for a subscriber + operationId: ReadUEPolicySet + tags: + - UEPolicySet (Document) + responses: + '200': + description: Upon success, a response body containing UE policies shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/UePolicySet' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Create or modify the UE policy set data for a subscriber + operationId: CreateOrReplaceUEPolicySet + tags: + - UEPolicySet (Document) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UePolicySet' + responses: + '201': + description: Successful case. The resource has been successfully created and a response body containing a representation of the created UEPolicySet resource shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/UePolicySet' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '200': + description: Successful case. The resource has been successfully created and a response body containing UE policies shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/UePolicySet' + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Modify the UE policy set data for a subscriber + operationId: UpdateUEPolicySet + tags: + - UEPolicySet (Document) + requestBody: + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/UePolicySetPatch' + responses: + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/ues/{ueId}/sm-data: + get: + summary: Retrieves the session management policy data for a subscriber + operationId: ReadSessionManagementPolicyData + tags: + - SessionManagementPolicyData (Document) + parameters: + - name: ueId + in: path + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: snssai + in: query + required: false + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + - name: dnn + in: query + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + - name: fields + in: query + description: attributes to be retrieved + required: false + schema: + type: array + items: + type: string + minItems: 1 + - name: supp-feat + in: query + description: Supported Features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: Upon success, a response body containing SmPolicyData shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Modify the session management policy data for a subscriber + operationId: UpdateSessionManagementPolicyData + tags: + - SessionManagementPolicyData (Document) + parameters: + - name: ueId + in: path + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/SmPolicyDataPatch' + responses: + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/SmPolicyData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/ues/{ueId}/sm-data/{usageMonId}: + get: + summary: Retrieve a usage monitoring resource + operationId: ReadUsageMonitoringInformation + tags: + - UsageMonitoringInformation (Document) + parameters: + - name: ueId + in: path + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: usageMonId + in: path + required: true + schema: + type: string + responses: + '200': + description: Successful case. The usage monitoring data is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageMonData' + '204': + description: The resource was found but no usage monitoring data is available. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Create a usage monitoring resource + operationId: CreateUsageMonitoringResource + tags: + - UsageMonitoringInformation (Document) + parameters: + - name: ueId + in: path + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: usageMonId + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UsageMonData' + responses: + '201': + description: Successful case. The resource has been successfully created and a response body is returned containing a representation of the resource. + content: + application/json: + schema: + $ref: '#/components/schemas/UsageMonData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete a usage monitoring resource + operationId: DeleteUsageMonitoringInformation + tags: + - UsageMonitoringInformation (Document) + parameters: + - name: ueId + in: path + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + - name: usageMonId + in: path + required: true + schema: + type: string + responses: + '204': + description: Successful case. The resource has been successfully deleted. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/sponsor-connectivity-data/{sponsorId}: + parameters: + - name: sponsorId + in: path + required: true + schema: + type: string + get: + summary: Retrieves the sponsored connectivity information for a given sponsorId + operationId: ReadSponsorConnectivityData + tags: + - SponsorConnectivityData (Document) + responses: + '200': + description: Upon success, a response body containing Sponsor Connectivity Data shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/SponsorConnectivityData' + '204': + description: The resource was found but no Sponsor Connectivity Data is available. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/bdt-data: + get: + summary: Retrieves the BDT data collection + operationId: ReadBdtData + tags: + - BdtData (Store) + parameters: + - name: bdt-ref-ids + in: query + description: List of the BDT reference identifiers. + schema: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + minItems: 1 + style: form + explode: false + responses: + '200': + description: Upon success, a response body containing the BDT data shall be returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/BdtData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/bdt-data/{bdtReferenceId}: + parameters: + - name: bdtReferenceId + in: path + required: true + schema: + type: string + get: + summary: Retrieves the BDT data information associated with a BDT reference Id + operationId: ReadIndividualBdtData + tags: + - IndividualBdtData (Document) + responses: + '200': + description: Upon success, a response body containing the BDT data shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/BdtData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Creates an BDT data resource associated with an BDT reference Id + operationId: CreateIndividualBdtData + tags: + - IndividualBdtData (Document) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BdtData' + responses: + '201': + description: Successful case. The resource has been successfully created. + content: + application/json: + schema: + $ref: '#/components/schemas/BdtData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes an BDT data resource associated with an BDT reference Id + operationId: DeleteIndividualBdtData + tags: + - IndividualBdtData (Document) + responses: + '204': + description: Successful case. The resource has been successfully deleted. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/subs-to-notify: + post: + summary: Create a subscription to receive notification of policy data changes + operationId: CreateIndividualPolicyDataSubscription + tags: + - PolicyDataSubscriptions (Collection) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyDataSubscription' + responses: + '201': + description: Upon success, a response body containing a representation of each Individual subscription resource shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyDataSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + policyDataChangeNotification: + '{$request.body#/notificationUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PolicyDataChangeNotification' + minItems: 1 + responses: + '204': + description: No Content, Notification was successful + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/subs-to-notify/{subsId}: + parameters: + - name: subsId + in: path + required: true + schema: + type: string + put: + summary: Modify a subscription to receive notification of policy data changes + operationId: ReplaceIndividualPolicyDataSubscription + tags: + - IndividualPolicyDataSubscription (Document) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyDataSubscription' + responses: + '200': + description: The individual subscription resource was updated successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyDataSubscription' + '204': + description: The individual subscription resource was updated successfully and no additional content is to be sent in the response message. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Delete the individual Policy Data subscription + operationId: DeleteIndividualPolicyDataSubscription + tags: + - IndividualPolicyDataSubscription (Document) + responses: + '204': + description: Upon success, an empty response body shall be returned. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /policy-data/ues/{ueId}/operator-specific-data: + get: + summary: Retrieve the operator specific policy data of an UE + operationId: ReadOperatorSpecificData + tags: + - OperatorSpecificData (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 + - name: supp-feat + 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: + type: object + additionalProperties: + $ref: 'TS29505_Subscription_Data.yaml#/components/schemas/OperatorSpecificDataContainer' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + patch: + summary: Modify the operator specific policy data of an UE + operationId: UpdateOperatorSpecificData + tags: + - OperatorSpecificData (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' + required: true + responses: + '204': + description: No content. Response to successful modification. + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchResult' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Modify the operator specific policy data of an UE + operationId: ReplaceOperatorSpecificData + tags: + - OperatorSpecificData (Document) + parameters: + - name: ueId + in: path + description: UE Id + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: + $ref: 'TS29505_Subscription_Data.yaml#/components/schemas/OperatorSpecificDataContainer' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + additionalProperties: + $ref: 'TS29505_Subscription_Data.yaml#/components/schemas/OperatorSpecificDataContainer' + '204': + description: The resource has been successfully updated. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /policy-data/plmns/{plmnId}/ue-policy-set: + parameters: + - name: plmnId + in: path + required: true + schema: + $ref: 'TS29505_Subscription_Data.yaml#/components/schemas/VarPlmnId' + get: + summary: Retrieve the UE policy set data for an H-PLMN + operationId: ReadPlmnUePolicySet + tags: + - PlmnUePolicySet (Document) + responses: + '200': + description: Upon success, a response body containing UE policies shall be returned. + content: + application/json: + schema: + $ref: '#/components/schemas/UePolicySet' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '412': + $ref: 'TS29571_CommonData.yaml#/components/responses/412' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + schemas: + AmPolicyData: + description: Contains the AM policy data for a given subscriber. + type: object + properties: + praInfos: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + subscCats: + type: array + items: + type: string + minItems: 1 + UePolicySet: + description: Contains the UE policy data for a given subscriber. + type: object + properties: + praInfos: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + subscCats: + type: array + items: + type: string + minItems: 1 + uePolicySections: + type: object + additionalProperties: + $ref: '#/components/schemas/UePolicySection' + minProperties: 1 + upsis: + type: array + items: + type: string + minItems: 1 + allowedRouteSelDescs: + type: object + additionalProperties: + $ref: '#/components/schemas/PlmnRouteSelectionDescriptor' + minProperties: 1 + andspInd: + type: boolean + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + osIds: + type: array + items: + $ref: '#/components/schemas/OsId' + minItems: 1 + UePolicySetPatch: + description: Contains the UE policy set for a given subscriber. + type: object + properties: + uePolicySections: + type: object + additionalProperties: + $ref: '#/components/schemas/UePolicySection' + minProperties: 1 + upsis: + type: array + items: + type: string + minItems: 1 + andspInd: + type: boolean + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + osIds: + type: array + items: + $ref: '#/components/schemas/OsId' + minItems: 1 + UePolicySection: + description: Contains the UE policy section. + type: object + properties: + uePolicySectionInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + upsi: + type: string + required: + - uePolicySectionInfo + - upsi + SmPolicyData: + description: Contains the SM policy data for a given subscriber. + type: object + properties: + smPolicySnssaiData: + type: object + additionalProperties: + $ref: '#/components/schemas/SmPolicySnssaiData' + minProperties: 1 + umDataLimits: + type: object + additionalProperties: + $ref: '#/components/schemas/UsageMonDataLimit' + minProperties: 1 + umData: + type: object + additionalProperties: + $ref: '#/components/schemas/UsageMonData' + minProperties: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - smPolicySnssaiData + SmPolicySnssaiData: + description: Contains the SM policy data for a given subscriber and S-NSSAI. + type: object + properties: + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + smPolicyDnnData: + type: object + additionalProperties: + $ref: '#/components/schemas/SmPolicyDnnData' + minProperties: 1 + required: + - snssai + SmPolicyDnnData: + description: Contains the SM policy data for a given DNN (and S-NSSAI). + type: object + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + allowedServices: + type: array + items: + type: string + minItems: 1 + subscCats: + type: array + items: + type: string + minItems: 1 + gbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + gbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + adcSupport: + type: boolean + subscSpendingLimits: + type: boolean + ipv4Index: + $ref: '#/components/schemas/IpIndex' + ipv6Index: + $ref: '#/components/schemas/IpIndex' + offline: + type: boolean + online: + type: boolean + chfInfo: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/ChargingInformation' + refUmDataLimitIds: + type: object + additionalProperties: + $ref: '#/components/schemas/LimitIdToMonitoringKey' + minProperties: 1 + mpsPriority: + type: boolean + mcsPriority: + type: boolean + imsSignallingPrio: + type: boolean + mpsPriorityLevel: + type: integer + mcsPriorityLevel: + type: integer + praInfos: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + bdtRefIds: + type: object + additionalProperties: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceIdRm' + minProperties: 1 + nullable: true + required: + - dnn + UsageMonDataLimit: + description: Contains usage monitoring control data for a subscriber. + type: object + properties: + limitId: + type: string + scopes: + type: object + additionalProperties: + $ref: '#/components/schemas/UsageMonDataScope' + minProperties: 1 + umLevel: + $ref: '#/components/schemas/UsageMonLevel' + startDate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endDate: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + usageLimit: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + resetPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - limitId + UsageMonData: + description: Contains remain allowed usage data for a subscriber. + type: object + properties: + limitId: + type: string + scopes: + type: object + additionalProperties: + $ref: '#/components/schemas/UsageMonDataScope' + minProperties: 1 + umLevel: + $ref: '#/components/schemas/UsageMonLevel' + allowedUsage: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + resetTime: + $ref: '#/components/schemas/TimePeriod' + required: + - limitId + LimitIdToMonitoringKey: + description: Contains the limit identifier and the corresponding monitoring key for a given S-NSSAI and DNN. + type: object + properties: + limitId: + type: string + monkey: + type: array + items: + type: string + minItems: 1 + required: + - limitId + nullable: true + UsageMonDataScope: + description: Contains a SNSSAI and DNN combinations to which the UsageMonData instance belongs to. + type: object + properties: + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnn: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + required: + - snssai + TimePeriod: + description: Contains the periodicity for the defined usage monitoring data limits. + type: object + properties: + period: + $ref: '#/components/schemas/Periodicity' + maxNumPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - period + SponsorConnectivityData: + description: Contains the sponsored data connectivity related information for a sponsor identifier. + type: object + properties: + aspIds: + type: array + items: + type: string + required: + - aspIds + BdtData: + description: Contains the background data transfer data. + type: object + properties: + aspId: + type: string + transPolicy: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/TransferPolicy' + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + nwAreaInfo: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + numOfUes: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + volPerUe: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + required: + - aspId + - transPolicy + PolicyDataSubscription: + description: Identifies a subscription to policy data change notification. + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifId: + type: string + monitoredResourceUris: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + monResItems: + type: array + items: + $ref: '#/components/schemas/ResourceItem' + minItems: 1 + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notificationUri + - monitoredResourceUris + PolicyDataChangeNotification: + description: Contains changed policy data for which notification was requested. + type: object + properties: + amPolicyData: + $ref: '#/components/schemas/AmPolicyData' + uePolicySet: + $ref: '#/components/schemas/UePolicySet' + plmnUePolicySet: + $ref: '#/components/schemas/UePolicySet' + smPolicyData: + $ref: '#/components/schemas/SmPolicyData' + usageMonData: + $ref: '#/components/schemas/UsageMonData' + SponsorConnectivityData: + $ref: '#/components/schemas/SponsorConnectivityData' + bdtData: + $ref: '#/components/schemas/BdtData' + opSpecData: + $ref: 'TS29505_Subscription_Data.yaml#/components/schemas/OperatorSpecificDataContainer' + ueId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/VarUeId' + sponsorId: + type: string + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + usageMonId: + type: string + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + delResources: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + minItems: 1 + notifId: + type: string + reportedFragments: + type: array + items: + $ref: '#/components/schemas/NotificationItem' + minItems: 1 + PlmnRouteSelectionDescriptor: + description: Contains the route selection descriptors (combinations of SNSSAI, DNNs, PDU session types, and SSC modes) allowed by subscription to the UE for a serving PLMN + type: object + properties: + servingPlmn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + snssaiRouteSelDescs: + type: array + items: + $ref: '#/components/schemas/SnssaiRouteSelectionDescriptor' + minItems: 1 + required: + - servingPlmn + SnssaiRouteSelectionDescriptor: + description: Contains the route selector parameters (DNNs, PDU session types and SSC modes) per SNSSAI + type: object + properties: + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnnRouteSelDescs: + type: array + items: + $ref: '#/components/schemas/DnnRouteSelectionDescriptor' + minItems: 1 + required: + - snssai + DnnRouteSelectionDescriptor: + description: Contains the route selector parameters (PDU session types and SSC modes) per DNN + type: object + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + sscModes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SscMode' + minItems: 1 + pduSessTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + minItems: 1 + required: + - dnn + SmPolicyDataPatch: + description: Contains the SM policy data for a given subscriber. + type: object + properties: + umData: + type: object + additionalProperties: + $ref: '#/components/schemas/UsageMonData' + minProperties: 1 + nullable: true + smPolicySnssaiData: + type: object + additionalProperties: + $ref: '#/components/schemas/SmPolicySnssaiDataPatch' + minProperties: 1 + SmPolicySnssaiDataPatch: + description: Contains the SM policy data for a given subscriber and S-NSSAI. + type: object + properties: + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + smPolicyDnnData: + type: object + additionalProperties: + $ref: '#/components/schemas/SmPolicyDnnDataPatch' + minProperties: 1 + required: + - snssai + SmPolicyDnnDataPatch: + description: Contains the SM policy data for a given DNN (and S-NSSAI). + type: object + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + bdtRefIds: + type: object + additionalProperties: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceIdRm' + minProperties: 1 + nullable: true + required: + - dnn +# + ResourceItem: + description: Identifies a subscription to policy data change notification when the change occurs in a fragment (subset of resource data) of a given resource. + type: object + properties: + monResourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + items: + type: array + items: + $ref: '#/components/schemas/ItemPath' + minItems: 1 + required: + - monResourceUri + - items +# + + NotificationItem: + description: Identifies a data change notification when the change occurs in a fragment (subset of resource data) of a given resource. + type: object + properties: + resourceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifItems: + type: array + items: + $ref: '#/components/schemas/UpdatedItem' + minItems: 1 + required: + - resourceId + - notifItems +# + UpdatedItem: + description: Identifies a fragment of a resource. + type: object + properties: + item: + $ref: '#/components/schemas/ItemPath' + value: {} + required: + - item + - value +# + + IpIndex: + type: integer + OsId: + type: string + format: uuid + UsageMonLevel: + anyOf: + - type: string + enum: + - SESSION_LEVEL + - SERVICE_LEVEL + - type: string + Periodicity: + anyOf: + - type: string + enum: + - YEARLY + - MONTHLY + - WEEKLY + - DAILY + - HOURLY + - type: string +# + + ItemPath: + description: Identifies a fragment (subset of resource data) of a given resource. + type: string diff --git a/lib/sbi/support/3gpp-spec/TS29520_Nnwdaf_AnalyticsInfo.yaml b/lib/sbi/support/3gpp-spec/TS29520_Nnwdaf_AnalyticsInfo.yaml new file mode 100644 index 000000000..6147ca1f6 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29520_Nnwdaf_AnalyticsInfo.yaml @@ -0,0 +1,264 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-3 + title: Nnwdaf_AnalyticsInfo + description: | + Nnwdaf_AnalyticsInfo Service API. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.520 V16.3.0; 5G System; Network Data Analytics Services. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.520/' +security: + - {} + - oAuth2ClientCredentials: + - nnwdaf-analyticsinfo +servers: + - url: '{apiRoot}/nnwdaf-analyticsinfo/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +paths: + /analytics: + get: + summary: Read a NWDAF Analytics + operationId: GetNWDAFAnalytics + tags: + - NWDAF Analytics (Document) + parameters: + - name: event-id + in: query + description: Identify the analytics. + required: true + schema: + $ref: '#/components/schemas/EventId' + - name: ana-req + in: query + description: Identifies the analytics reporting requirement information. + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsReportingRequirement' + - name: event-filter + in: query + description: Identify the analytics. + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/EventFilter' + - name: supported-features + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: tgt-ue + in: query + description: Identify the target UE information. + required: false + content: + application/json: + schema: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/TargetUeInformation' + responses: + '200': + description: Containing the analytics with parameters as relevant for the requesting NF service consumer. + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsData' + '204': + description: No Content (The request NWDAF Analytics data does not exist) + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + description: Indicates that the NWDAF Analytics resource does not exist. + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnwdaf-analyticsinfo: Access to the Nnwdaf_AnalyticsInfo API + schemas: + AnalyticsData: + type: object + properties: + sliceLoadLevelInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/SliceLoadLevelInformation' + minItems: 1 + description: The slices and their load level information. + nfLoadLevelInfo: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NfLoadLevelInformation' + minItems: 1 + nwPerfs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NetworkPerfInfo' + minItems: 1 + svcExps: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ServiceExperienceInfo' + minItems: 1 + qosSustainInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/QosSustainabilityInfo' + minItems: 1 + ueMobs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UeMobility' + minItems: 1 + ueComms: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UeCommunication' + minItems: 1 + userDataCongInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UserDataCongestionInfo' + minItems: 1 + abnorBehavrs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/AbnormalBehaviour' + minItems: 1 + EventFilter: + type: object + properties: + anySlice: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/AnySlice' + snssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + description: Identification(s) of network slice to which the subscription belongs. + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + dnais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + nfInstanceIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + nfSetIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + minItems: 1 + nfTypes: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + minItems: 1 + maxAnaEntry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + qosRequ: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/QosRequirement' + nwPerfTypes: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NetworkPerfType' + minItems: 1 + bwRequs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/BwRequirement' + minItems: 1 + excepIds: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ExceptionId' + minItems: 1 + exptAnaType: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ExpectedAnalyticsType' + exptUeBehav: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExpectedUeBehaviourData' + not: + required: [anySlice, snssais] + AnalyticsReportingRequirement: + type: object + properties: + accuracy: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/Accuracy' + startTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + sampRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + EventId: + anyOf: + - type: string + enum: + - LOAD_LEVEL_INFORMATION + - NETWORK_PERFORMANCE + - NF_LOAD + - SERVICE_EXPERIENCE + - UE_MOBILITY + - UE_COMMUNICATION + - QOS_SUSTAINABILITY + - ABNORMAL_BEHAVIOUR + - USER_DATA_CONGESTION + - 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 + - LOAD_LEVEL_INFORMATION: Represent the analytics of load level information of corresponding network slice instance. + - NETWORK_PERFORMANCE: Represent the analytics of network performance information. + - NF_LOAD: Indicates that the event subscribed is NF Load. + - SERVICE_EXPERIENCE: Represent the analytics of service experience information of the specific applications. + - UE_MOBILITY: Represent the analytics of UE mobility. + - UE_COMMUNICATION: Represent the analytics of UE communication. + - QOS_SUSTAINABILITY: Represent the analytics of QoS sustainability information in the certain area. + - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour information. + - USER_DATA_CONGESTION: Represent the analytics of the user data congestion in the certain area. diff --git a/lib/sbi/support/3gpp-spec/TS29520_Nnwdaf_EventsSubscription.yaml b/lib/sbi/support/3gpp-spec/TS29520_Nnwdaf_EventsSubscription.yaml new file mode 100644 index 000000000..bcdff8b62 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29520_Nnwdaf_EventsSubscription.yaml @@ -0,0 +1,950 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-4 + title: Nnwdaf_EventsSubscription + description: | + Nnwdaf_EventsSubscription Service API. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.520 V16.3.0; 5G System; Network Data Analytics Services. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.520/' +security: + - {} + - oAuth2ClientCredentials: + - nnwdaf-eventssubscription +servers: + - url: '{apiRoot}/nnwdaf-eventssubscription/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +paths: + /subscriptions: + post: + summary: Create a new Individual NWDAF Events Subscription + operationId: CreateNWDAFEventsSubscription + tags: + - NWDAF Events Subscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + responses: + '201': + description: Create a new Individual NWDAF Event Subscription resource. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnwdaf-eventssubscription/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + myNotification: + '{$request.body#/notificationURI}': + post: + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NnwdafEventsSubscriptionNotification' + minItems: 1 + responses: + '204': + description: The receipt of the Notification is acknowledged. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionId}: + delete: + summary: Delete an existing Individual NWDAF Events Subscription + operationId: DeleteNWDAFEventsSubscription + tags: + - Individual NWDAF Events Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Nnwdaf_EventsSubscription Service + required: true + schema: + type: string + responses: + '204': + description: No Content. The Individual NWDAF Event Subscription resource matching the subscriptionId was deleted. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + description: The Individual NWDAF Event Subscription resource does not exist. + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Update an existing Individual NWDAF Events Subscription + operationId: UpdateNWDAFEventsSubscription + tags: + - Individual NWDAF Events Subscription (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Nnwdaf_EventsSubscription Service + required: true + schema: + type: string + responses: + '200': + description: The Individual NWDAF Event Subscription resource was modified successfully and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + '204': + description: The Individual NWDAF Event Subscription resource was modified successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + description: The Individual NWDAF Event Subscription resource does not exist. + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnwdaf-eventssubscription: Access to the Nnwdaf_EventsSubscription API + schemas: + NnwdafEventsSubscription: + type: object + properties: + eventSubscriptions: + type: array + items: + $ref: '#/components/schemas/EventSubscription' + minItems: 1 + description: Subscribed events + evtReq: + $ref: '#/components/schemas/EventReportingRequirement' + notificationURI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - eventSubscriptions + EventSubscription: + type: object + properties: + anySlice: + $ref: '#/components/schemas/AnySlice' + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + description: Identification(s) of application to which the subscription applies. When subscribed event is "SERVICE_EXPERIENCE", the absence of applicationIds means subscription to all applications. + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + description: Identification(s) of DNN to which the subscription applies. When subscribed event is "SERVICE_EXPERIENCE", the absence of dnns means subscription to all DNNs. + dnais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + event: + $ref: '#/components/schemas/NwdafEvent' + loadLevelThreshold: + type: integer + description: Shall be supplied for notification method "THRESHOLD". Indicates that the NWDAF shall report the corresponding network slice load level to the NF service consumer where the load level of the network slice instance identified by snssai is reached. + notificationMethod: + $ref: '#/components/schemas/NotificationMethod' + matchingDir: + $ref: '#/components/schemas/MatchingDirection' + nfLoadLvlThds: + type: array + items: + $ref: '#/components/schemas/ThresholdLevel' + minItems: 1 + description: Shall be supplied in order to start reporting when an average load level is reached. + nfInstanceIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + nfSetIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + minItems: 1 + nfTypes: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + minItems: 1 + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + qosRequ: + $ref: '#/components/schemas/QosRequirement' + qosFlowRetThds: + type: array + items: + $ref: '#/components/schemas/RetainabilityThreshold' + minItems: 1 + ranUeThrouThds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + minItems: 1 + repetitionPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + snssaia: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + description: Identification(s) of network slice to which the subscription applies. When subscribed event is "SLICE_LOAD_LEVEL", either information about slice(s) identified by snssai, or anySlice set to "TRUE" shall be included. It corresponds to snssais in the data model definition of 3GPP TS 29.520. When subscribed is "QOS_SUSTAINABILITY", the identifications of network slices is optional. + maxAnaEntry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + tgtUe: + $ref: '#/components/schemas/TargetUeInformation' + congThresholds: + type: array + items: + $ref: '#/components/schemas/ThresholdLevel' + minItems: 1 + nwPerfRequs: + type: array + items: + $ref: '#/components/schemas/NetworkPerfRequirement' + minItems: 1 + bwRequs: + type: array + items: + $ref: '#/components/schemas/BwRequirement' + minItems: 1 + excepRequs: + type: array + items: + $ref: '#/components/schemas/Exception' + minItems: 1 + exptAnaType: + $ref: '#/components/schemas/ExpectedAnalyticsType' + exptUeBehav: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExpectedUeBehaviourData' + required: + - event + NnwdafEventsSubscriptionNotification: + type: object + properties: + eventNotifications: + type: array + items: + $ref: '#/components/schemas/EventNotification' + minItems: 1 + description: Notifications about Individual Events + subscriptionId: + type: string + description: String identifying a subscription to the Nnwdaf_EventsSubscription Service + required: + - eventNotifications + - subscriptionId + EventNotification: + type: object + properties: + event: + $ref: '#/components/schemas/NwdafEvent' + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + nfLoadLevelInfo: + type: array + items: + $ref: '#/components/schemas/NfLoadLevelInformation' + minItems: 1 + sliceLoadLevelInfo: + $ref: '#/components/schemas/SliceLoadLevelInformation' + svcExps: + type: array + items: + $ref: '#/components/schemas/ServiceExperienceInfo' + minItems: 1 + qosSustainInfos: + type: array + items: + $ref: '#/components/schemas/QosSustainabilityInfo' + minItems: 1 + ueComms: + type: array + items: + $ref: '#/components/schemas/UeCommunication' + minItems: 1 + ueMobs: + type: array + items: + $ref: '#/components/schemas/UeMobility' + minItems: 1 + userDataCongInfos: + type: array + items: + $ref: '#/components/schemas/UserDataCongestionInfo' + minItems: 1 + abnorBehavrs: + type: array + items: + $ref: '#/components/schemas/AbnormalBehaviour' + minItems: 1 + nwPerfs: + type: array + items: + $ref: '#/components/schemas/NetworkPerfInfo' + minItems: 1 + required: + - event + ServiceExperienceInfo: + type: object + properties: + svcExprc: + $ref: 'TS29517_Naf_EventExposure.yaml#/components/schemas/SvcExperience' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + required: + - svcExprc + BwRequirement: + type: object + properties: + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + marBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + marBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + mirBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + mirBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + required: + - appId + SliceLoadLevelInformation: + type: object + properties: + loadLevelInformation: + $ref: '#/components/schemas/LoadLevelInformation' + snssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + description: Identification(s) of network slice to which the subscription. + required: + - loadLevelInformation + - snssais + EventReportingRequirement: + allOf: + - $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation' + - type: object + properties: + accuracy: + $ref: '#/components/schemas/Accuracy' + startTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + TargetUeInformation: + type: object + properties: + anyUe: + type: boolean + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + intGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + UeMobility: + type: object + properties: + ts: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + recurringTime: + $ref: 'TS29122_CpProvisioning.yaml#/components/schemas/ScheduledCommunicationTime' + duration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + durationVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + locInfo: + type: array + items: + $ref: '#/components/schemas/LocationInfo' + minItems: 1 + required: + - duration + - locInfo + LocationInfo: + type: object + properties: + loc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - loc + UeCommunication: + type: object + properties: + commDur: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + commDurVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + perioTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + perioTimeVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + ts: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + recurringTime: + $ref: 'TS29122_CpProvisioning.yaml#/components/schemas/ScheduledCommunicationTime' + trafChar: + $ref: '#/components/schemas/TrafficCharacterization' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - commDur + - trafChar + TrafficCharacterization: + type: object + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + ethfDescs: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + maxItems: 2 + fDescs: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/FlowDescription' + minItems: 1 + maxItems: 2 + ulVol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + ulVolVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + dlVol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + dlVolVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + UserDataCongestionInfo: + type: object + properties: + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + congestionInfo: + $ref: '#/components/schemas/CongestionInfo' + CongestionInfo: + type: object + properties: + congType: + $ref: '#/components/schemas/CongestionType' + timeIntev: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + nsi: + $ref: '#/components/schemas/ThresholdLevel' + required: + - congType + - timeIntev + - nsi + QosSustainabilityInfo: + type: object + properties: + areaInfo: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + startTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qosFlowRetThd: + $ref: '#/components/schemas/RetainabilityThreshold' + ranUeThrouThd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + QosRequirement: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + gfbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + gfbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + pdb: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudget' + per: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketErrRate' + ThresholdLevel: + type: object + properties: + congLevel: + type: integer + nfLoadLevel: + type: integer + nfCpuUsage: + type: integer + nfMemoryUsage: + type: integer + nfStorageUsage: + type: integer + NfLoadLevelInformation: + type: object + properties: + nfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + nfStatus: + $ref: '#/components/schemas/NfStatus' + nfCpuUsage: + type: integer + nfMemoryUsage: + type: integer + nfStorageUsage: + type: integer + nfLoadLevelAverage: + type: integer + nfLoadLevelpeak: + type: integer + required: + - nfType + - nfInstanceId + NfStatus: + type: object + properties: + statusRegistered: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + statusUnregistered: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + statusUndiscoverable: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + AnySlice: + type: boolean + description: FALSE represents not applicable for all slices. TRUE represents applicable for all slices. + LoadLevelInformation: + type: integer + description: Load level information of the network slice instance. + AbnormalBehaviour: + type: object + properties: + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + excep: + $ref: '#/components/schemas/Exception' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + addtMeasInfo: + $ref: '#/components/schemas/AdditionalMeasurement' + required: + - excep + Exception: + type: object + properties: + excepId: + $ref: '#/components/schemas/ExceptionId' + excepLevel: + type: integer + excepTrend: + $ref: '#/components/schemas/ExceptionTrend' + required: + - excepId + AdditionalMeasurement: + type: object + properties: + unexpLoc: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + unexpFlowTep: + $ref: '#/components/schemas/FlowDescription' + unexpWake: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ddosAttack: + $ref: '#/components/schemas/AddressList' + wrgDest: + $ref: '#/components/schemas/AddressList' + circums: + type: array + items: + $ref: '#/components/schemas/CircumstanceDescription' + FlowDescription: + type: object + properties: + ipTrafficFilter: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + ethTrafficFilter: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + AddressList: + type: object + properties: + ipv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + CircumstanceDescription: + type: object + properties: + freq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + tm: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + locArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + vol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + RetainabilityThreshold: + type: object + properties: + relFlowNum: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + relTimeUnit: + $ref: '#/components/schemas/TimeUnit' + relFlowRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + NetworkPerfRequirement: + type: object + properties: + nwPerfType: + $ref: '#/components/schemas/NetworkPerfType' + relativeRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + absoluteNum: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - nwPerfType + NetworkPerfInfo: + type: object + properties: + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + nwPerfType: + $ref: '#/components/schemas/NetworkPerfType' + relativeRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + absoluteNum: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - networkArea + - nwPerfType + NotificationMethod: + anyOf: + - type: string + enum: + - PERIODIC + - THRESHOLD + - 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 + - PERIODIC: The subscribe of NWDAF Event is periodically. The periodic of the notification is identified by repetitionPeriod defined in subclause 5.1.6.2.3. + - THRESHOLD: The subscribe of NWDAF Event is upon threshold exceeded. The threshold of the notification is identified by loadLevelThreshold defined in subclause 5.1.6.2.3. + NwdafEvent: + anyOf: + - type: string + enum: + - SLICE_LOAD_LEVEL + - NETWORK_PERFORMANCE + - NF_LOAD + - SERVICE_EXPERIENCE + - UE_MOBILITY + - UE_COMMUNICATION + - QOS_SUSTAINABILITY + - ABNORMAL_BEHAVIOUR + - USER_DATA_CONGESTION + - 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 + - SLICE_LOAD_LEVEL: Indicates that the event subscribed is load level information of Network Slice instance + - NETWORK_PERFORMANCE: Indicates that the event subscribed is network performance information. + - NF_LOAD: Indicates that the event subscribed is load level and status of one or several Network Functions. + - SERVICE_EXPERIENCE: Indicates that the event subscribed is service experience. + - UE_MOBILITY: Indicates that the event subscribed is UE mobility information. + - UE_COMMUNICATION: Indicates that the event subscribed is UE communication information. + - QOS_SUSTAINABILITY: Indicates that the event subscribed is QoS sustainability. + - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour. + - USER_DATA_CONGESTION: Indicates that the event subscribed is user data congestion information. + Accuracy: + anyOf: + - type: string + enum: + - LOW + - HIGH + - 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 + - LOW: Low accuracy. + - HIGH: High accuracy. + CongestionType: + anyOf: + - type: string + enum: + - USER_PLANE + - CONTROL_PLANE + - USER_AND_CONTROL_PLANE + - 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 + - USER_PLANE: The congestion analytics type is User Plane. + - CONTROL_PLANE: The congestion analytics type is Control Plane. + - USER_AND_CONTROL_PLANE: The congestion analytics type is User Plane and Control Plane. + ExceptionId: + anyOf: + - type: string + enum: + - UNEXPECTED_UE_LOCATION + - UNEXPECTED_LONG_LIVE_FLOW + - UNEXPECTED_LARGE_RATE_FLOW + - UNEXPECTED_WAKEUP + - SUSPICION_OF_DDOS_ATTACK + - WRONG_DESTINATION_ADDRESS + - TOO_FREQUENT_SERVICE_ACCESS + - ABNORMAL_TRAFFIC_VOLUME + - UNEXPECTED_RADIO_LINK_FAILURES + - PING_PONG_ACROSS_CELLS + - 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 + - UNEXPECTED_UE_LOCATION: Unexpected UE location + - UNEXPECTED_LONG_LIVE_FLOW: Unexpected long-live rate flows + - UNEXPECTED_LARGE_RATE_FLOW: Unexpected large rate flows + - UNEXPECTED_WAKEUP: Unexpected wakeup + - SUSPICION_OF_DDOS_ATTACK: Suspicion of DDoS attack + - WRONG_DESTINATION_ADDRESS: Wrong destination address + - TOO_FREQUENT_SERVICE_ACCESS: Too frequent Service Access + - ABNORMAL_TRAFFIC_VOLUME: Abnormal traffic volume + - UNEXPECTED_RADIO_LINK_FAILURES: Unexpected radio link failures + - PING_PONG_ACROSS_CELLS: Ping-ponging across neighbouring cells + ExceptionTrend: + anyOf: + - type: string + enum: + - UP + - DOWN + - UNKNOW + - STABLE + - 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 + - UP: Up trend of the exception level. + - DOWN: Down trend of the exception level. + - UNKNOW: Unknown trend of the exception level. + - STABLE: Stable trend of the exception level. + TimeUnit: + anyOf: + - type: string + enum: + - MINUTE + - HOUR + - DAY + - 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 + - MINUTE: Time unit is per minute. + - HOUR: Time unit is per hour. + - DAY: Time unit is per day. + NetworkPerfType: + anyOf: + - type: string + enum: + - GNB_ACTIVE_RATIO + - GNB_COMPUTING_USAGE + - GNB_MEMORY_USAGE + - GNB_DISK_USAGE + - NUM_OF_UE + - SESS_SUCC_RATIO + - HO_SUCC_RATIO + - 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 + - GNB_ACTIVE_RATIO: Indicates that the network performance requirement is gNodeB active (i.e. up and running) rate. Indicates the ratio of gNB active (i.e. up and running) number to the total number of gNB + - GNB_COMPUTING_USAGE: Indicates gNodeB computing resource usage. + - GNB_MEMORY_USAGE: Indicates gNodeB memory usage. + - GNB_DISK_USAGE: Indicates gNodeB disk usage. + - NUM_OF_UE: Indicates number of UEs. + - SESS_SUCC_RATIO: Indicates ratio of successful setup of PDU sessions to total PDU session setup attempts. + - SESS_SUCC_RATIO: Indicates Ratio of successful handovers to the total handover attempts. + ExpectedAnalyticsType: + anyOf: + - type: string + enum: + - MOBILITY + - COMMUN + - MOBILITY_AND_COMMUN + - 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 + - MOBILITY: Mobility related abnormal behaviour analytics is expected by the consumer. + - COMMUN: Communication related abnormal behaviour analytics is expected by the consumer. + - MOBILITY_AND_COMMUN: Both mobility and communication related abnormal behaviour analytics is expected by the consumer. + MatchingDirection: + anyOf: + - type: string + enum: + - ASCENDING + - DESCENDING + - CROSSED + - 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 + - ASCENDING: Threshold is crossed in ascending direction. + - DESCENDING: Threshold is crossed in descending direction. + - CROSSED: Threshold is crossed either in ascending or descending direction. diff --git a/lib/sbi/support/3gpp-spec/TS29521_Nbsf_Management.yaml b/lib/sbi/support/3gpp-spec/TS29521_Nbsf_Management.yaml new file mode 100644 index 000000000..d672f60eb --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29521_Nbsf_Management.yaml @@ -0,0 +1,382 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-4 + title: Nbsf_Management + description: | + Binding Support Management Service API. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.521 V16.3.0; 5G System; Binding Support Management Service. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.521/' +servers: + - url: '{apiRoot}/nbsf-management/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +security: + - {} + - oAuth2ClientCredentials: + - nbsf-management +paths: + /pcfBindings: + post: + summary: Create a new Individual PCF binding information + operationId: CreatePCFBinding + tags: + - PCF Bindings (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PcfBinding' + responses: + '201': + description: The creation of an individual PCF session binding. + content: + application/json: + schema: + $ref: '#/components/schemas/PcfBinding' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nbsf-management/v1/pcfBindings/{bindingId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + description: The existing PCF binding information stored in the BSF for the indicated combination is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/ExtProblemDetails' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + get: + summary: Read PCF Bindings information + operationId: GetPCFBindings + tags: + - PCF Bindings (Collection) + parameters: + - name: ipv4Addr + in: query + description: The IPv4 Address of the served UE. + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + - name: ipv6Prefix + in: query + description: The IPv6 Address of the served UE. The NF service consumer shall append '/128' to the IPv6 address in the attribute value. E.g. '2001:db8:85a3::8a2e:370:7334/128'. + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + - name: macAddr48 + in: query + description: The MAC Address of the served UE. + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + - name: dnn + in: query + description: DNN. + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + - name: supi + in: query + description: Subscription Permanent Identifier. + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: gpsi + in: query + description: Generic Public Subscription Identifier + required: false + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + - name: snssai + in: query + description: The identification of slice. + required: false + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + - name: ipDomain + in: query + description: The IPv4 address domain identifier. + required: false + schema: + type: string + - name: supp-feat + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: The individual PCF session binding session binding information resource matching the query parameter(s) is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PcfBinding' + '204': + description: There is no PCF session binding information matching the query parameter(s). + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /pcfBindings/{bindingId}: + delete: + summary: Delete an existing Individual PCF Binding information + operationId: DeleteIndPCFBinding + tags: + - Individual PCF Binding (Document) + parameters: + - name: bindingId + in: path + description: Represents the individual PCF Session Binding. + required: true + schema: + type: string + responses: + '204': + description: No Content. The Individual PCF session binding information resource is deleted. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Update an existing Individual PCF Binding information + operationId: UpdateIndPCFBinding + tags: + - Individual PCF Binding (Document) + parameters: + - name: bindingId + in: path + description: Represents the individual PCF Session Binding. + required: true + schema: + type: string + requestBody: + description: Parameters to update the existing session binding + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/PcfBindingPatch' + responses: + '200': + description: OK (Successful update of the session binding) + content: + application/json: + schema: + $ref: '#/components/schemas/PcfBinding' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nbsf-management: Access to the Nbsf_Management API + schemas: + PcfBinding: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + addIpv6Prefixes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + minItems: 1 + description: The additional IPv6 Address Prefixes of the served UE. + ipDomain: + type: string + macAddr48: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + addMacAddrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + minItems: 1 + description: The additional MAC Addresses of the served UE. + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + pcfFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + pcfIpEndPoints: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/IpEndPoint' + minItems: 1 + description: IP end points of the PCF hosting the Npcf_PolicyAuthorization service. + pcfDiamHost: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + pcfDiamRealm: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + pcfSmFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + pcfSmIpEndPoints: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/IpEndPoint' + minItems: 1 + description: IP end points of the PCF hosting the Npcf_SMPolicyControl service. + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + paraCom: + $ref: '#/components/schemas/ParameterCombination' + required: + - dnn + - snssai + oneOf: + - anyOf: + - required: [ipv4Addr] + - required: [ipv6Prefix] + - required: [addIpv6Prefixes] + - anyOf: + - required: [macAddr48] + - required: [addMacAddrs] + anyOf: + - anyOf: + - required: [pcfFqdn] + - required: [pcfIpEndPoints] + - required: [pcfDiamHost, pcfDiamRealm] + PcfBindingPatch: + type: object + properties: + ipv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4AddrRm' + ipDomain: + type: string + nullable: true + ipv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6PrefixRm' + addIpv6Prefixes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + minItems: 1 + description: The additional IPv6 Address Prefixes of the served UE. + nullable: true + macAddr48: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48Rm' + addMacAddrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + minItems: 1 + description: The additional MAC Addresses of the served UE. + nullable: true + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + ParameterCombination: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + ExtProblemDetails: + allOf: + - $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + - $ref: '#/components/schemas/BindingResp' + BindingResp: + type: object + properties: + pcfSmFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + pcfSmIpEndPoints: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/IpEndPoint' + minItems: 1 + description: IP end points of the PCF hosting the Npcf_SMPolicyControl service. diff --git a/lib/sbi/support/3gpp-spec/TS29522_5GLANParameterProvision.yaml b/lib/sbi/support/3gpp-spec/TS29522_5GLANParameterProvision.yaml new file mode 100644 index 000000000..d8f4da8cb --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_5GLANParameterProvision.yaml @@ -0,0 +1,389 @@ +openapi: 3.0.0 +info: + title: 3gpp-5glan-pp + version: 1.0.0.alpha-2 + description: | + API for 5G LAN Parameter Provision. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-5glan-pp/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{afId}/subscriptions: + get: + summary: read all of the active subscriptions for the AF + tags: + - AF level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get all of the active subscriptions for the AF) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/5GLanParametersProvision' + minItems: 0 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new subscription resource + tags: + - subscription level POST Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + requestBody: + description: new subscription creation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/5GLanParametersProvision' + responses: + '201': + description: Created (Successful creation) + content: + application/json: + schema: + $ref: '#/components/schemas/5GLanParametersProvision' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '204': + description: Successful case. The resource has been successfully created and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/subscriptions/{subscriptionId}: + get: + summary: read an active subscription for the AF and the subscription Id + tags: + - Subscription level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/5GLanParametersProvision' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing subscription resource + tags: + - Subscription level PUT Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/5GLanParametersProvision' + responses: + '200': + description: OK (Successful deletion of the existing subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/5GLanParametersProvision' + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Partial updates an existing subscription resource + tags: + - Subscription level PATCH Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/5GLanParametersProvisionPatch' + responses: + '200': + description: OK. The subscription was modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/5GLanParametersProvision' + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing subscription + tags: + - Subscription level DELETE Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + 5GLanParametersProvision: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + 5gLanParams: + $ref: '#/components/schemas/5GLanParameters' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - 5gLanParams + - suppFeat + 5GLanParametersProvisionPatch: + type: object + properties: + 5gLanParamsPatch: + $ref: '#/components/schemas/5GLanParametersPatch' + 5GLanParameters: + type: object + properties: + exterGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + gpsis: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + minProperties: 1 + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + sessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + appDesps: + type: object + additionalProperties: + $ref: '#/components/schemas/AppDescriptor' + minProperties: 1 + required: + - exterGroupId + - gpsis + - dnn + - snssai + - sessionType + - appDesps + 5GLanParametersPatch: + type: object + properties: + gpsis: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + minProperties: 1 + appDesps: + type: object + additionalProperties: + $ref: '#/components/schemas/AppDescriptor' + minProperties: 1 + AppDescriptor: + type: object + properties: + osId: + $ref: 'TS29519_Policy_Data.yaml#/components/schemas/OsId' + appIds: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minProperties: 1 + required: + - osId + - appIds diff --git a/lib/sbi/support/3gpp-spec/TS29522_AnalyticsExposure.yaml b/lib/sbi/support/3gpp-spec/TS29522_AnalyticsExposure.yaml new file mode 100644 index 000000000..18df99d68 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_AnalyticsExposure.yaml @@ -0,0 +1,701 @@ +openapi: 3.0.0 +info: + title: 3gpp-analyticsexposure + version: 1.0.0.alpha-2 + description: | + API for Analytics Exposure. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-analyticsexposure/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{afId}/subscriptions: + get: + summary: read all of the active subscriptions for the AF + tags: + - AF level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get all of the active subscriptions for the AF) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/AnalyticsExposureSubsc' + minItems: 0 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new subscription resource + tags: + - subscription level POST Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + requestBody: + description: new subscription creation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsExposureSubsc' + callbacks: + notification: + '{request.body#/notifUri}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsEventNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Created (Successful creation) + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsExposureSubsc' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '204': + description: Successful case. The resource has been successfully created and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/subscriptions/{subscriptionId}: + get: + summary: read an active subscription for the AF and the subscription Id + tags: + - Subscription level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsExposureSubsc' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing subscription resource + tags: + - Subscription level PUT Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsExposureSubsc' + responses: + '200': + description: OK (Successful deletion of the existing subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsExposureSubsc' + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing subscription + tags: + - Subscription level DELETE Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/fetch: + post: + summary: Fetch analytics information + tags: + - custom operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsRequest' + responses: + '200': + description: The requested information was returned successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsData' + '204': + description: No Content (The requested Analytics data does not exist) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + AnalyticsExposureSubsc: + type: object + properties: + analyEventsSubs: + type: array + items: + $ref: '#/components/schemas/AnalyticsEventSubsc' + minItems: 1 + analyRepInfo: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/EventReportingRequirement' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifId: + type: string + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - analyEventsSubs + - notifUri + - notifId + AnalyticsEventNotification: + type: object + properties: + notifId: + type: string + analyEventNotifs: + type: array + items: + $ref: '#/components/schemas/AnalyticsEventNotif' + minItems: 1 + AnalyticsEventNotif: + type: object + properties: + analyEvent: + $ref: '#/components/schemas/AnalyticsEvent' + timeStamp: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + ueMobilityInfos: + type: array + items: + $ref: '#/components/schemas/UeMobilityExposure' + minItems: 1 + ueCommInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UeCommunication' + minItems: 1 + abnormalInfos: + type: array + items: + $ref: '#/components/schemas/AbnormalExposure' + minItems: 1 + congestInfos: + type: array + items: + $ref: '#/components/schemas/CongestInfo' + minItems: 1 + nwPerfInfos: + type: array + items: + $ref: '#/components/schemas/NetworkPerfExposure' + minItems: 1 + qosSustainInfos: + type: array + items: + $ref: '#/components/schemas/QosSustainabilityExposure' + minItems: 1 + required: + - analyEvent + - timeStamp + AnalyticsEventSubsc: + type: object + properties: + analyEvent: + $ref: '#/components/schemas/AnalyticsEvent' + analyEventFilter: + $ref: '#/components/schemas/AnalyticsEventFilterSubsc' + tgtUe: + $ref: '#/components/schemas/TargetUeId' + required: + - analyEvent + - tgtUe + AnalyticsEventFilterSubsc: + type: object + properties: + nwPerfReqs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NetworkPerfRequirement' + minItems: 1 + locArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + excepRequs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/Exception' + minItems: 1 + exptAnaType: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ExpectedAnalyticsType' + exptUeBehav: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExpectedUeBehaviourData' + reptThlds: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ThresholdLevel' + minItems: 1 + maxAnaEntry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + qosReq: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/QosRequirement' + qosFlowRetThds: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/RetainabilityThreshold' + minItems: 1 + ranUeThrouThds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + minItems: 1 + TargetUeId: + type: object + properties: + anyUeInd: + type: boolean + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + exterGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + UeMobilityExposure: + type: object + properties: + ts: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime' + recurringTime: + $ref: 'TS29122_CpProvisioning.yaml#/components/schemas/ScheduledCommunicationTime' + duration: + $ref: 'TS29122_CommonData.yaml#/components/schemas/DurationSec' + durationVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + locInfo: + type: array + items: + $ref: '#/components/schemas/UeLocationInfo' + minItems: 1 + required: + - duration + - locInfo + UeLocationInfo: + type: object + properties: + loc: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - loc + AnalyticsRequest: + type: object + properties: + analyEvent: + $ref: '#/components/schemas/AnalyticsEvent' + analyEventFilter: + $ref: '#/components/schemas/AnalyticsEventFilter' + analyRep: + $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/AnalyticsReportingRequirement' + tgtUe: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/TargetUeInformation' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - analyEvent + - suppFeat + AnalyticsEventFilter: + type: object + properties: + locArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + maxAnaEntry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + nwPerfTypes: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NetworkPerfType' + minItems: 1 + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + excepIds: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ExceptionId' + minItems: 1 + exptAnaType: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ExpectedAnalyticsType' + exptUeBehav: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExpectedUeBehaviourData' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + qosReq: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/QosRequirement' + AnalyticsData: + type: object + properties: + ueMobilityInfos: + type: array + items: + $ref: '#/components/schemas/UeMobilityExposure' + minItems: 1 + ueCommInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UeCommunication' + minItems: 1 + nwPerfInfos: + type: array + items: + $ref: '#/components/schemas/NetworkPerfExposure' + minItems: 1 + abnormalInfos: + type: array + items: + $ref: '#/components/schemas/AbnormalExposure' + minItems: 1 + congestInfos: + type: array + items: + $ref: '#/components/schemas/CongestInfo' + minItems: 1 + qosSustainInfos: + type: array + items: + $ref: '#/components/schemas/QosSustainabilityExposure' + minItems: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - suppFeat + NetworkPerfExposure: + type: object + properties: + locArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + nwPerfType: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NetworkPerfType' + relativeRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + absoluteNum: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - locArea + - nwPerfType + AbnormalExposure: + type: object + properties: + gpsis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + minItems: 1 + excep: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/Exception' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + addtMeasInfo: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/AdditionalMeasurement' + required: + - excep + CongestInfo: + type: object + properties: + locArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + cngAnas: + type: array + items: + $ref: '#/components/schemas/CongestionAnalytics' + required: + - locArea + - cngAnas + CongestionAnalytics: + type: object + properties: + cngType: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/CongestionType' + tmWdw: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + nsi: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ThresholdLevel' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - cngType + - tmWdw + - nsi + QosSustainabilityExposure: + type: object + properties: + locArea: + $ref: 'TS29122_CommonData.yaml#/components/schemas/LocationArea5G' + startTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qosFlowRetThd: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/RetainabilityThreshold' + ranUeThrouThd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - locArea + - startTs + - endTs + AnalyticsEvent: + anyOf: + - type: string + enum: + - UE_MOBILITY + - UE_COMM + - ABNORMAL_BEHAVIOR + - CONGESTION + - NETWORK_PERFORMANCE + - QOS_SUSTAINABILITY + - 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 + - UE_MOBILITY: The AF requests to be notified about analytics information of UE mobility. + - UE_COMM: The AF requests to be notified about analytics information of UE communication. + - ABNORMAL_BEHAVIOR: The AF requests to be notified about analytics information of UE's abnormal behavior. + - CONGESTION: The AF requests to be notified about analytics information of user data congestion information. + - NETWORK_PERFORMANCE: The AF requests to be notified about analytics information of network performance. + - QOS_SUSTAINABILITY: The AF requests to be notified about analytics information of QoS sustainability. diff --git a/lib/sbi/support/3gpp-spec/TS29522_ApplyingBdtPolicy.yaml b/lib/sbi/support/3gpp-spec/TS29522_ApplyingBdtPolicy.yaml new file mode 100644 index 000000000..a2a1eecf2 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_ApplyingBdtPolicy.yaml @@ -0,0 +1,249 @@ +openapi: 3.0.0 +info: + title: 3gpp-applying-bdt-policy + version: 1.0.0.alpha-3 + description: | + API for applicying BDT policy + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-appliying-bdt-policy/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. + +paths: + /{afId}/subscriptions: + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + get: + summary: read all of the active subscriptions for the AF + tags: + - ApplyingBdtPolicy API AF level GET Operation + responses: + '200': + description: OK. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/AppliedBdtPolicy' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new subscription resource + tags: + - ApplyingBdtPolicy API Subscription level POST Operation + requestBody: + description: Request to create a new subscription resource + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AppliedBdtPolicy' + responses: + '201': + description: Created (Successful creation of subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/AppliedBdtPolicy' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/subscriptions/{subscriptionId}: + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + get: + summary: read an active subscriptions for the SCS/AS and the subscription Id + tags: + - ApplyingBdtPolicy API Subscription level GET Operation + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/AppliedBdtPolicy' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates/replaces an existing subscription resource + tags: + - ApplyingBdtPolicy API subscription level PATCH Operation + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/AppliedBdtPolicyPatch' + responses: + '200': + description: OK. The subscription was modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/AppliedBdtPolicy' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes an already existing subscription + tags: + - ApplyingBdtPolicy API Subscription level DELETE Operation + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + AppliedBdtPolicy: + type: object + properties: + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - bdtRefId + - suppFeat + oneOf: + - required: [gpsi] + - required: [externalGroupId] + AppliedBdtPolicyPatch: + type: object + properties: + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + required: + - bdtRefId diff --git a/lib/sbi/support/3gpp-spec/TS29522_IPTVConfiguration.yaml b/lib/sbi/support/3gpp-spec/TS29522_IPTVConfiguration.yaml new file mode 100644 index 000000000..28ce13045 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_IPTVConfiguration.yaml @@ -0,0 +1,380 @@ +openapi: 3.0.0 +info: + title: 3gpp-iptvconfiguration + version: 1.0.0.alpha-2 + description: | + API for IPTV configuration. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-iptvconfiguration/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{afId}/configurations: + get: + summary: read all of the active configurations for the AF + tags: + - AF level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get all of the active configurations for the AF) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/IptvConfigData' + minItems: 0 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new configuration resource + tags: + - Configuration level POST Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + requestBody: + description: new configuration creation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + responses: + '201': + description: Created (Successful creation of configuration) + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '204': + description: Successful case. The resource has been successfully created and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/configurations/{configurationId}: + get: + summary: read an active configuration for the AF and the configuration Id + tags: + - Configuration level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active configuration) + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing configuration resource + tags: + - Configuration level PUT Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing configuration + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + responses: + '200': + description: OK (Successful deletion of the existing configuration) + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Partial updates an existing configuration resource + tags: + - Configuration level PATCH Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/IptvConfigDataPatch' + responses: + '200': + description: OK. The configuration was modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/IptvConfigData' + '204': + description: Successful case. The resource has been successfully updated and no additional content is to be sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing configuration + tags: + - Configuration level DELETE Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: configurationId + in: path + description: Identifier of the configuration resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing configuration) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + IptvConfigData: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + exterGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + afAppId: + type: string + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + multiAccCtrls: + type: object + additionalProperties: + $ref: '#/components/schemas/MulticastAccessControl' + minProperties: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - afAppId + - multiAccCtrls + - suppFeat + IptvConfigDataPatch: + type: object + properties: + multiAccCtrls: + type: object + additionalProperties: + $ref: '#/components/schemas/MulticastAccessControl' + minProperties: 1 + MulticastAccessControl: + type: object + properties: + srcIpv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + srcIpv6Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + multicastV4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + multicastV6Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + accStatus: + $ref: '#/components/schemas/AccessRightStatus' + required: + - accStatus + AccessRightStatus: + anyOf: + - type: string + enum: + - FULLY_ALLOWED + - PREVIEW_ALLOWED + - NO_ALLOWED + - type: string + description: > + Possible values are + - FULLY_ALLOWED: The User is fully allowed to access to the channel. + - PREVIEW_ALLOWED: The User is preview allowed to access to the channel. + - NO_ALLOWED: The User is not allowed to access to the channel. diff --git a/lib/sbi/support/3gpp-spec/TS29522_LpiParameterProvision.yaml b/lib/sbi/support/3gpp-spec/TS29522_LpiParameterProvision.yaml new file mode 100644 index 000000000..8b83f4a16 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_LpiParameterProvision.yaml @@ -0,0 +1,277 @@ +openapi: 3.0.0 +info: + title: 3gpp-lpi-pp + version: 1.0.0.alpha-1 + description: | + API for Location Privacy Indication Parameters Provisioning. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-lpi-pp/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /{afId}/provisionedLpis: + get: + summary: read all of the active LPI Parameters Provisioning resources for the AF + tags: + - Resource collection level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get all of the active resources for the AF) + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/LpiParametersProvision' + minItems: 1 + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new LPI Parameters Provisioning resource + tags: + - Resource collection level POST Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + requestBody: + description: new resource creation + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LpiParametersProvision' + responses: + '201': + description: Created (Successful creation) + content: + application/json: + schema: + $ref: '#/components/schemas/LpiParametersProvision' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/provisionedLpis/{provisionedLpiId}: + get: + summary: read an active LPI Parameters Provisioning resource for the AF and the provisioned LPI Id + tags: + - Individual resource level GET Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: provisionedLpiId + in: path + description: Identifier of the provisioned LPI parameter resource + required: true + schema: + type: string + responses: + '200': + description: OK (Successful get the active resource) + content: + application/json: + schema: + $ref: '#/components/schemas/LpiParametersProvision' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing LPI Parameters Provisioning resource + tags: + - Individual resource level PUT Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: provisionedLpiId + in: path + description: Identifier of the provisioned LPI parameter resource + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing resource + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LpiParametersProvision' + responses: + '200': + description: OK (Successful update of the existing resource) + content: + application/json: + schema: + $ref: '#/components/schemas/LpiParametersProvision' + '204': + description: Successful case. The resource has been successfully updated and no additional content is sent in the response message. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing LPI Parameters Provisioning resource + tags: + - Individual resource level DELETE Operation + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: provisionedLpiId + in: path + description: Identifier of the provisioned LPI parameter resource + required: true + schema: + type: string + responses: + '204': + description: No Content (Successful deletion of the existing resource) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + LpiParametersProvision: + type: object + properties: + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + exterGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + lpi: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/Lpi' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - lpi + - suppFeat diff --git a/lib/sbi/support/3gpp-spec/TS29522_NIDDConfigurationTrigger.yaml b/lib/sbi/support/3gpp-spec/TS29522_NIDDConfigurationTrigger.yaml new file mode 100644 index 000000000..b342a9310 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_NIDDConfigurationTrigger.yaml @@ -0,0 +1,93 @@ +openapi: 3.0.0 +info: + title: 3gpp-nidd-configuration-trigger + version: 1.0.0.alpha-1 + description: | + API for NIDD Configuration Trigger. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. +paths: + /: + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NiddConfigurationTrigger' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/NiddConfigurationTriggerReply' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + NiddConfigurationTrigger: + type: object + properties: + afId: + type: string + description: Identifies the trigger receiving entity. + nefId: + type: string + description: Identifies the trigger sending entity. + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - afId + - nefId + - gpsi + - suppFeat + NiddConfigurationTriggerReply: + type: object + properties: + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - suppFeat diff --git a/lib/sbi/support/3gpp-spec/TS29522_ServiceParameter.yaml b/lib/sbi/support/3gpp-spec/TS29522_ServiceParameter.yaml new file mode 100644 index 000000000..8b7a71eb4 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_ServiceParameter.yaml @@ -0,0 +1,637 @@ +openapi: 3.0.0 +info: + title: 3gpp-service-parameter + version: 1.0.0.alpha-1 + description: | + API for AF service paramter + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-service-parameter/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. + +paths: + /{afId}/subscriptions: + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + get: + summary: read all of the active subscriptions for the AF + tags: + - ServiceParameter API SCS/AS level GET Operation + responses: + '200': + description: OK. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ServiceParameterData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new subscription resource + tags: + - ServiceParameter API Subscription level POST Operation + requestBody: + description: Request to create a new subscription resource + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + responses: + '201': + description: Created (Successful creation of subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/subscriptions/{subscriptionId}: + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + get: + summary: read an active subscriptions for the SCS/AS and the subscription Id + tags: + - ServiceParameter API Subscription level GET Operation + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing subscription resource + tags: + - TrafficInfluence API subscription level PUT Operation + requestBody: + description: Parameters to update/replace the existing subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + responses: + '200': + description: OK (Successful update of the subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates/replaces an existing subscription resource + tags: + - ServiceParameter API subscription level PATCH Operation + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/ServiceParameterDataPatch' + responses: + '200': + description: OK. The subscription was modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceParameterData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing subscription + tags: + - ServiceParameter API Subscription level DELETE Operation + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + ServiceParameterData: + type: object + properties: + afServiceId: + type: string + description: Identifies a service on behalf of which the AF is issuing the request. + appId: + type: string + description: Identifies an application. + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + anyUeInd: + type: boolean + description: Identifies whether the AF request applies to any UE. This attribute shall set to "true" if applicable for any UE, otherwise, set to "false". + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + ueIpv4: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + ueMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + paramOverPc5: + $ref: '#/components/schemas/ParameterOverPc5' + paramOverUu: + $ref: '#/components/schemas/ParameterOverUu' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + ServiceParameterDataPatch: + type: object + properties: + paramOverPc5: + $ref: '#/components/schemas/ParameterOverPc5Rm' + ParamOverUu: + $ref: '#/components/schemas/ParameterOverUuRm' + ParameterOverPc5: + type: object + properties: + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + plmmRatServed: + type: array + items: + $ref: '#/components/schemas/PlmnRatServed' + minItems: 1 + authNotServed: + type: boolean + radioParamsNotServed: + type: array + items: + $ref: '#/components/schemas/RadioParameterNotServed' + minItems: 1 + serToTx: + type: array + items: + $ref: '#/components/schemas/ServiceToTx' + minItems: 1 + privacyParams: + type: array + items: + $ref: '#/components/schemas/PrivacyParameter' + minItems: 1 + configParaEutra: + $ref: '#/components/schemas/ConfigurationParametersEutra' + configParaNr: + $ref: '#/components/schemas/ConfigurationParametersNr' + ParameterOverUu: + type: object + properties: + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + serToPduSess: + type: array + items: + $ref: '#/components/schemas/ServiceToPduSession' + minItems: 1 + serToAppAddr: + type: array + items: + $ref: '#/components/schemas/ServiceApplicationServerAddress' + minItems: 1 + PlmnRatServed: + type: object + properties: + plmn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + rats: + type: array + items: + $ref: '#/components/schemas/V2xRatType' + required: + - plmn + - rats + RadioParameterNotServed: + type: object + properties: + radioParams: + type: string + rat: + $ref: '#/components/schemas/V2xRatType' + geographicalArea: + type: string + operManaged: + $ref: '#/components/schemas/OperatorManaged' + required: + - radioParams + - geographicalArea + - operManaged + - rat + ServiceToTx: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + txProfile: + type: string + rat: + $ref: '#/components/schemas/V2xRatType' + required: + - serIds + - txProfile + - rat + PrivacyParameter: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + geographicalArea: + type: string + timer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + required: + - serIds + - geographicalArea + - timer + ConfigurationParametersEutra: + type: object + properties: + serToLayer2Ids: + type: array + items: + $ref: '#/components/schemas/ServiceIdToLayer2Id' + minItems: 1 + ppppToPdbs: + type: array + items: + $ref: '#/components/schemas/PpppToPdb' + minItems: 1 + serIdToFrequs: + type: array + items: + $ref: '#/components/schemas/ServiceIdToFrequency' + minItems: 1 + serIdToPpprs: + type: array + items: + $ref: '#/components/schemas/ServiceIdToPppr' + minItems: 1 + ConfigurationParametersNr: + type: object + properties: + serToBroLayer2Ids: + type: array + items: + $ref: '#/components/schemas/ServiceIdToLayer2Id' + minItems: 1 + serToGroLayer2Ids: + type: array + items: + $ref: '#/components/schemas/ServiceIdToLayer2Id' + minItems: 1 + serToDefLayer2Ids: + type: array + items: + $ref: '#/components/schemas/ServiceIdToLayer2Id' + minItems: 1 + serIdToFrequs: + type: array + items: + $ref: '#/components/schemas/ServiceIdToFrequency' + minItems: 1 + pc5QosMappings: + type: array + items: + $ref: '#/components/schemas/Pc5QosMapping' + minItems: 1 + slrbConfigs: + type: array + items: + $ref: '#/components/schemas/SlrbConfigurations' + minItems: 1 + ServiceIdToLayer2Id: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + desLayer2Id: + type: string + required: + - serIds + - desLayer2Id + PpppToPdb: + type: object + properties: + pppp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + pdb: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudget' + required: + - pppp + - pdb + ServiceIdToFrequency: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + frequency: + type: number + geographicalArea: + type: string + required: + - serIds + - frequency + - geopraphicalArea + ServiceIdToPppr: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + pppr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - serIds + - pppr + Pc5QosMapping: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + pc5QoSFlowParam: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pc5QosFlowItem' + required: + - serIds + - pc5QosFlowParam + SlrbConfigurations: + type: object + properties: + pc5QosPara: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pc5QoSPara' + slrb: + type: string + required: + - pc5QosPara + - slrb + ServiceToPduSession: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + pduSessionType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SscMode' + sliceInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + required: + - serIds + ServiceApplicationServerAddress: + type: object + properties: + serIds: + type: array + items: + type: string + minItems: 1 + fqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + Ipv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + Ipv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + udpPortNumbers: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + minItems: 1 + tcpPortNumbers: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + minItems: 1 + plmns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + geopraphicalArea: + type: string + required: + - serIds + - plmns + - geographicalArea + ParameterOverPc5Rm: + type: string +# Editor's note: Type is FFS. String only used to pass Syntax check. + ParameterOverUuRm: + type: string +# Editor's note: Type is FFS. String only used to pass Syntax check. + OperatorManaged: + anyOf: + - type: string + enum: + - OPERATOR_MANAGED + - NON_OPERATOR_MANAGED + - type: string + description: > + Possible values are + - OPERATOR_MANAGED: The radio parameters are "operator managed". + - NON_OPERATOR_MANAGED: The radio parameters are "non-operator managed". + V2xRatType: + anyOf: + - type: string + enum: + - PC5_LTE + - PC5_NR + - type: string + description: > + Possible values are + - PC5_LTE: Indicates the LTE RAT type over PC5 interface. + - PC5_NR: Indicates the NR RAT type over NR interface. diff --git a/lib/sbi/support/3gpp-spec/TS29522_TrafficInfluence.yaml b/lib/sbi/support/3gpp-spec/TS29522_TrafficInfluence.yaml new file mode 100644 index 000000000..670d660fc --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29522_TrafficInfluence.yaml @@ -0,0 +1,564 @@ +openapi: 3.0.0 +info: + title: 3gpp-traffic-influence + version: 1.1.0.alpha-4 + description: | + API for AF traffic influence + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.522 V16.3.0; 5G System; Network Exposure Function Northbound APIs. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.522/' +security: + - {} + - oAuth2ClientCredentials: [] +servers: + - url: '{apiRoot}/3gpp-traffic-influence/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 5.2.4 of 3GPP TS 29.122. + +paths: + /{afId}/subscriptions: + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + get: + summary: read all of the active subscriptions for the AF + tags: + - TrafficInfluence API SCS/AS level GET Operation + responses: + '200': + description: OK. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TrafficInfluSub' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + post: + summary: Creates a new subscription resource + tags: + - TrafficInfluence API Subscription level POST Operation + requestBody: + description: Request to create a new subscription resource + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/EventNotification' + callbacks: + afAcknowledgement: + '{request.body#/afAckUri}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AfAckInfo' + responses: + '204': + description: No Content (successful acknowledgement) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: Created (Successful creation of subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /{afId}/subscriptions/{subscriptionId}: + parameters: + - name: afId + in: path + description: Identifier of the AF + required: true + schema: + type: string + - name: subscriptionId + in: path + description: Identifier of the subscription resource + required: true + schema: + type: string + get: + summary: read an active subscriptions for the SCS/AS and the subscription Id + tags: + - TrafficInfluence API Subscription level GET Operation + responses: + '200': + description: OK (Successful get the active subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + summary: Updates/replaces an existing subscription resource + tags: + - TrafficInfluence API subscription level PUT Operation + requestBody: + description: Parameters to update/replace the existing subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + responses: + '200': + description: OK (Successful update of the subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + patch: + summary: Updates/replaces an existing subscription resource + tags: + - TrafficInfluence API subscription level PATCH Operation + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/TrafficInfluSubPatch' + responses: + '200': + description: OK. The subscription was modified successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/TrafficInfluSub' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + delete: + summary: Deletes an already existing subscription + tags: + - TrafficInfluence API Subscription level DELETE Operation + responses: + '204': + description: No Content (Successful deletion of the existing subscription) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + TrafficInfluSub: + type: object + properties: + afServiceId: + type: string + description: Identifies a service on behalf of which the AF is issuing the request. + afAppId: + type: string + description: Identifies an application. + afTransId: + type: string + description: Identifies an NEF Northbound interface transaction, generated by the AF. + appReloInd: + type: boolean + description: Identifies whether an application can be relocated once a location of the application has been selected. + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + externalGroupId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ExternalGroupId' + anyUeInd: + type: boolean + description: Identifies whether the AF request applies to any UE. This attribute shall set to "true" if applicable for any UE, otherwise, set to "false". + subscribedEvents: + type: array + items: + $ref: '#/components/schemas/SubscribedEvent' + minItems: 1 + description: Identifies the requirement to be notified of the event(s). + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + ipv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv6Addr' + macAddr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + dnaiChgType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DnaiChangeType' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + requestTestNotification: + type: boolean + description: Set to true by the SCS/AS to request the NEF to send a test notification as defined in subclause 5.2.5.3. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + self: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + trafficFilters: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Identifies IP packet filters. + ethTrafficFilters: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet filters. + trafficRoutes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + minItems: 1 + description: Identifies the N6 traffic routing requirement. + tfcCorrInd: + type: boolean + tempValidities: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/TemporalValidity' + validGeoZoneIds: + type: array + items: + type: string + minItems: 1 + description: Identifies a geographic zone that the AF request applies only to the traffic of UE(s) located in this specific zone. + afAckInd: + type: boolean + addrPreserInd: + type: boolean + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + allOf: + - oneOf: + - required: [afAppId] + - required: [trafficFilters] + - required: [ethTrafficFilters] + - oneOf: + - required: [ipv4Addr] + - required: [ipv6Addr] + - required: [macAddr] + - required: [gpsi] + - required: [externalGroupId] + - required: [anyUeInd] + anyOf: + - not: + required: [subscribedEvents] + - required: [notificationDestination] + TrafficInfluSubPatch: + type: object + properties: + appReloInd: + type: boolean + description: Identifies whether an application can be relocated once a location of the application has been selected. + nullable: true + trafficFilters: + type: array + items: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + minItems: 1 + description: Identifies IP packet filters. + ethTrafficFilters: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + description: Identifies Ethernet packet filters. + trafficRoutes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + minItems: 1 + description: Identifies the N6 traffic routing requirement. + tfcCorrInd: + type: boolean + nullable: true + tempValidities: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/TemporalValidity' + minItems: 1 + nullable: true + validGeoZoneIds: + type: array + items: + type: string + minItems: 1 + description: Identifies a geographic zone that the AF request applies only to the traffic of UE(s) located in this specific zone. + nullable: true + afAckInd: + type: boolean + nullable: true + addrPreserInd: + type: boolean + nullable: true + EventNotification: + type: object + properties: + afTransId: + type: string + description: Identifies an NEF Northbound interface transaction, generated by the AF. + dnaiChgType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DnaiChangeType' + sourceTrafficRoute: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + subscribedEvent: + $ref: '#/components/schemas/SubscribedEvent' + targetTrafficRoute: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + sourceDnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + targetDnai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + srcUeIpv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + srcUeIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + tgtUeIpv4Addr: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Ipv4Addr' + tgtUeIpv6Prefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + ueMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + afAckUri: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Link' + required: + - dnaiChgType + - subscribedEvent + AfResultInfo: + type: object + properties: + afStatus: + $ref: '#/components/schemas/AfResultStatus' + trafficRoute: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RouteToLocation' + required: + - afStatus + AfAckInfo: + type: object + properties: + afTransId: + type: string + ackResult: + $ref: '#/components/schemas/AfResultInfo' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + required: + - ackResult + SubscribedEvent: + anyOf: + - type: string + enum: + - UP_PATH_CHANGE + - type: string + description: > + Possible values are + - UP_PATH_CHANGE: The AF requests to be notified when the UP path changes for the PDU session. + AfResultStatus: + anyOf: + - type: string + enum: + - SUCCESS + - TEMPORARY_CONGESTION + - RELOC_NO_ALLOWED + - OTHER + - type: string + description: > + Possible values are + - SUCCESS: The application layer is ready or the relocation is completed. + - TEMPORARY_CONGESTION: The application relocation fails due to temporary congestion. + - RELOC_NO_ALLOWED: The application relocation fails because application relocation is not allowed. + - OTHER: The application relocation fails due to other reason. diff --git a/lib/sbi/support/3gpp-spec/TS29523_Npcf_EventExposure.yaml b/lib/sbi/support/3gpp-spec/TS29523_Npcf_EventExposure.yaml new file mode 100644 index 000000000..7f672a5e3 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29523_Npcf_EventExposure.yaml @@ -0,0 +1,425 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-1 + title: Npcf_EventExposure + description: | + PCF Event Exposure Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +externalDocs: + description: 3GPP TS 29.523 V16.0.0; 5G System; Policy Control Event Exposure Service; Stage 3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.523/ + +servers: + - url: '{apiRoot}/npcf-eventexposure/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 + +security: + - {} + - oAuth2ClientCredentials: + - npcf-eventexposure + +paths: + /subscriptions: + post: + summary: Creates a new Individual Policy Control Events Subscription resource + operationId: PostPcEventExposureSubsc + tags: + - Policy Control Events Subscription (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PcEventExposureSubsc' + responses: + '201': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/PcEventExposureSubsc' + headers: + Location: + description: 'Contains the URI of the created individual policy control events subscription resource, according to the structure: {apiRoot}/npcf-eventexposure/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + PcEventNotification: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PcEventExposureNotif' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionId}: + get: + summary: "Reads an existing Individual Policy Control Events Subscription" + operationId: GetPcEventExposureSubsc + tags: + - Individual Policy Control Events Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: Policy Control Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/PcEventExposureSubsc' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: "Modifies an existing Individual Policy Control Events Subscription " + operationId: PutPcEventExposureSubsc + tags: + - Individual Policy Control Events Subscription (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PcEventExposureSubsc' + parameters: + - name: subscriptionId + in: path + description: Policy Control Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource was succesfully modified and representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/PcEventExposureSubsc' + '204': + description: No Content. Resource was succesfully modified + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: "Cancels an existing Individual Policy Control Events Subscription " + operationId: DeletePcEventExposureSubsc + tags: + - Individual Policy Control Events Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: Policy Control Event Subscription ID + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + npcf-eventexposure: Access to the Npcf_EventExposure API. + + schemas: + + PcEventExposureNotif: + type: object + properties: + notifId: + type: string + eventNotifs: + type: array + items: + $ref: '#/components/schemas/PcEventNotification' + minItems: 1 + required: + - notifId + - eventNotifs + + + PcEventExposureSubsc: + type: object + properties: + eventSubs: + type: array + items: + $ref: '#/components/schemas/PcEvent' + minItems: 1 + eventsRepInfo: + $ref: '#/components/schemas/ReportingInformation' + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + filterDnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + filterSnssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + filterServices: + type: array + items: + $ref: '#/components/schemas/ServiceIdentification' + minItems: 1 + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifId: + type: string + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - eventSubs + - notifId + - notifUri + + ReportingInformation: + type: object + properties: + immRep: + type: boolean + notifMethod: + $ref: 'TS29508_Nsmf_EventExposure.yaml#/components/schemas/NotificationMethod' + maxReportNbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + monDur: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + repPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + sampRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + grpRepTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + + ServiceIdentification: + type: object + properties: + servEthFlows: + type: array + items: + $ref: '#/components/schemas/EthernetFlowInfo' + minItems: 1 + servIpFlows: + type: array + items: + $ref: '#/components/schemas/IpFlowInfo' + minItems: 1 + afAppId: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/AfAppId' + # All conditions in allOf must be met + allOf: + # First condition is that servEthFlows and servIpFlows are mutually exclusive + - not: + required: [servEthFlows, servIpFlows] + # Second condition is that at least one the servEthFlows, servIpFlows and afAppId shall be present + - anyOf: + - required: [servEthFlows] + - required: [servIpFlows] + - required: [afAppId] + + EthernetFlowInfo: + type: object + properties: + ethFlows: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + maxItems: 2 + flowNumber: + type: integer + required: + - flowNumber + + IpFlowInfo: + type: object + properties: + ipFlows: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/FlowDescription' + minItems: 1 + maxItems: 2 + flowNumber: + type: integer + required: + - flowNumber + + PcEventNotification: + type: object + properties: + event: + $ref: '#/components/schemas/PcEvent' + accType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + anGwAddr: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/AnGwAddress' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + timeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + pduSessionInfo: + $ref: '#/components/schemas/PduSessionInformation' + repServices: + $ref: '#/components/schemas/ServiceIdentification' + required: + - event + - timeStamp + + PduSessionInformation: + type: object + properties: + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + ueIpv4: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ueIpv6: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + ipDomain: + type: string + ueMac: + $ref: 'TS29571_CommonData.yaml#/components/schemas/MacAddr48' + required: + - snssai + - dnn + oneOf: + - required: [ueMac] + - anyOf: + - required: [ueIpv4] + - required: [ueIpv6] + +# Simple data types and Enumerations + + PcEvent: + anyOf: + - type: string + enum: + - AC_TY_CH + - PLMN_CH + - type: string \ No newline at end of file diff --git a/lib/sbi/support/3gpp-spec/TS29525_Npcf_UEPolicyControl.yaml b/lib/sbi/support/3gpp-spec/TS29525_Npcf_UEPolicyControl.yaml new file mode 100644 index 000000000..152bcba93 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29525_Npcf_UEPolicyControl.yaml @@ -0,0 +1,501 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-4 + title: Npcf_UEPolicyControl + description: | + UE Policy Control Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.525 V16.3.0; 5G System; UE Policy Control Service. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.525/' +servers: + - url: '{apiRoot}/npcf-ue-policy-control/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - npcf-ue-policy-control +paths: + /policies: + post: + operationId: CreateIndividualUEPolicyAssociation + summary: Create individual UE policy association. + tags: + - UE Policy Associations (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociationRequest' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociation' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/npcf-ue-policy-control/v1/policies/{polAssoId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + policyUpdateNotification: + '{$request.body#/notificationUri}/update': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyUpdate' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + policyAssocitionTerminationRequestNotification: + '{$request.body#/notificationUri}/terminate': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TerminationNotification' + responses: + '204': + description: No Content, Notification was succesfull + '307': + description: temporary redirect + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /policies/{polAssoId}: + get: + operationId: ReadIndividualUEPolicyAssociation + summary: Read individual UE policy association. + tags: + - Individual UE Policy Association (Document) + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociation' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + operationId: DeleteIndividualUEPolicyAssociation + summary: Delete individual UE policy association. + tags: + - Individual UE Policy Association (Document) + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /policies/{polAssoId}/update: + post: + operationId: ReportObservedEventTriggersForIndividualUEPolicyAssociation + summary: Report obeserved event triggers and possibly obtain updated policies for an individual UE policy association. + tags: + - Individual UE Policy Association (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyAssociationUpdateRequest' + parameters: + - name: polAssoId + in: path + description: Identifier of a policy association + required: true + schema: + type: string + responses: + '200': + description: OK. Updated policies are returned + content: + application/json: + schema: + $ref: '#/components/schemas/PolicyUpdate' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + npcf-ue-policy-control: Access to the Npcf_AMPolicyControl API + schemas: + PolicyAssociation: + type: object + properties: + request: + $ref: '#/components/schemas/PolicyAssociationRequest' + uePolicy: + $ref: '#/components/schemas/UePolicy' + n2Pc5Pol: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N2InfoContent' + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + description: Request Triggers that the PCF subscribes. Only values "LOC_CH" and "PRA_CH" are permitted. + pras: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - suppFeat + PolicyAssociationRequest: + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + altNotifIpv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + description: Alternate or backup IPv4 Address(es) where to send Notifications. + altNotifIpv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + description: Alternate or backup IPv6 Address(es) where to send Notifications. + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + userLoc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + timeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + servingPlmn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnIdNid' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + groupIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + minItems: 1 + hPcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + uePolReq: + $ref: '#/components/schemas/UePolicyRequest' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + serviceName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pc5Capab: + $ref: '#/components/schemas/Pc5Capability' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notificationUri + - suppFeat + - supi + PolicyAssociationUpdateRequest: + type: object + properties: + notificationUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + altNotifIpv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + description: Alternate or backup IPv4 Address(es) where to send Notifications. + altNotifIpv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + description: Alternate or backup IPv6 Address(es) where to send Notifications. + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + description: Request Triggers that the NF service consumer observes. + praStatuses: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + description: Map of PRA status information. + minProperties: 1 + userLoc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uePolDelResult: + $ref: '#/components/schemas/UePolicyDeliveryResult' + uePolTransFailNotif: + $ref: '#/components/schemas/UePolicyTransferFailureNotification' + uePolReq: + $ref: '#/components/schemas/UePolicyRequest' + guami: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + servingNfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + connectState: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/CmState' + PolicyUpdate: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + uePolicy: + $ref: '#/components/schemas/UePolicy' + n2Pc5Pol: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N2InfoContent' + triggers: + type: array + items: + $ref: '#/components/schemas/RequestTrigger' + minItems: 1 + nullable: true + description: Request Triggers that the PCF subscribes. Only values "LOC_CH" and "PRA_CH" are permitted. + pras: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + description: Map of PRA information. + minProperties: 1 + nullable: true + required: + - resourceUri + TerminationNotification: + type: object + properties: + resourceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + cause: + $ref: '#/components/schemas/PolicyAssociationReleaseCause' + required: + - resourceUri + - cause + UePolicyTransferFailureNotification: + type: object + properties: + cause: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N1N2MessageTransferCause' + ptis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + minItems: 1 + required: + - cause + - ptis + UePolicy: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + UePolicyDeliveryResult: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + UePolicyRequest: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + RequestTrigger: + anyOf: + - type: string + enum: + - LOC_CH + - PRA_CH + - UE_POLICY + - PLMN_CH + - CON_STATE_CH + - 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 + - LOC_CH: Location change (tracking area). The tracking area of the UE has changed. + - PRA_CH: Change of UE presence in PRA. The UE is entering/leaving a Presence Reporting Area. + - UE_POLICY: A MANAGE UE POLICY COMPLETE message or a MANAGE UE POLICY COMMAND REJECT message, as defined in Annex D.5 of 3GPP TS 24.501 or a "UE POLICY PROVISIONING REQUEST" message, as defined in subclause 7.2.1.1 of 3GPP TS 24.587 [24], has been received by the AMF and is being forwarded. + - PLMN_CH: PLMN change. the serving PLMN of UE has changed. + - CON_STATE_CH: Connectivity state change: the connectivity state of UE has changed. + PolicyAssociationReleaseCause: + anyOf: + - type: string + enum: + - UNSPECIFIED + - UE_SUBSCRIPTION + - INSUFFICIENT_RES + - 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 + - UNSPECIFIED: This value is used for unspecified reasons. + - UE_SUBSCRIPTION: This value is used to indicate that the policy association needs to be terminated because the subscription of UE has changed (e.g. was removed). + - INSUFFICIENT_RES: This value is used to indicate that the server is overloaded and needs to abort the policy association. + Pc5Capability: + anyOf: + - type: string + enum: + - LTE_PC5 + - NR_PC5 + - LTE_NR_PC5 + - 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 + - LTE_PC5: This value is used to indicate that UE supports PC5 LTE RAT for V2X communication over PC5 reference point. + - NR_PC5: This value is used to indicate that UE supports PC5 NR RAT for V2X communication over PC5 reference point. + - LTE_NR_PC5: This value is used to indicate that UE supports both PC5 LTE and NR RAT for V2X communication over PC5 reference point.. diff --git a/lib/sbi/support/3gpp-spec/TS29540_Nsmsf_SMService.yaml b/lib/sbi/support/3gpp-spec/TS29540_Nsmsf_SMService.yaml new file mode 100644 index 000000000..a094f9df9 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29540_Nsmsf_SMService.yaml @@ -0,0 +1,269 @@ +openapi: 3.0.0 +info: + version: '2.0.1' + title: 'Nsmsf_SMService Service API' + description: | + SMSF SMService. + ? 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - oAuth2ClientCredentials: + - nsmsf-sms + - {} +servers: + - url: '{apiRoot}/nsmsf-sms/v2' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501. +paths: + /ue-contexts/{supi}: + put: + summary: Activate SMS Service for a given UE + operationId: SMServiceActivation + tags: + - UEContext (Document) + parameters: + - name: supi + in: path + required: true + description: Subscriber Permanent Identifier (SUPI) + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UeSmsContextData' + required: true + responses: + '201': + description: UE Context for SMS is created in SMSF + content: + application/json: + schema: + $ref: '#/components/schemas/UeSmsContextData' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nsmsf-sms//ue-contexts/{supi}' + required: true + schema: + type: string + '204': + description: UE Context for SMS is updated in SMSF + '400': + description: Invalid Service Request + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Unable to create/update UE Context for SMS in SMSF + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Unable to found subscription for service user or UE Context for SMS in SMSF + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + default: + description: Unexpected error + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + delete: + summary: Deactivate SMS Service for a given UE + operationId: SMServiceDeactivation + tags: + - UEContext (Document) + parameters: + - name: supi + in: path + required: true + description: Subscriber Permanent Identifier (SUPI) + schema: + type: string + responses: + '204': + description: UE Context for SMS is deleted from SMSF + '400': + description: Invalid Service Request + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Unable to found UE Context for SMS in SMSF + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + /ue-contexts/{supi}/sendsms: + post: + summary: Send SMS payload for a given UE + operationId: SendSMS + tags: + - UEContext (Document) + parameters: + - name: supi + in: path + required: true + description: Subscriber Permanent Identifier (SUPI) + schema: + type: string + requestBody: + content: + multipart/related: + schema: + type: object + properties: + jsonData: + $ref: '#/components/schemas/SmsRecordData' + binaryPayload: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryPayload: + contentType: application/vnd.3gpp.sms + headers: + Content-Id: + schema: + type: string + required: true + responses: + '200': + description: SMS payload is received by SMSF, and is being delivered out + content: + application/json: + schema: + $ref: '#/components/schemas/SmsRecordDeliveryData' + '400': + description: Invalid Service Request + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Unable to deliver SMS at SMSF + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Unable to found UE Context for SMS in SMSF + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nsmsf-sms: Access to the nsmsf-sms API + schemas: + UeSmsContextData: + type: object + required: + - supi + - amfId + - accessType + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + amfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + guamis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + backupAmfInfo: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BackupAmfInfo' + minItems: 1 + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + SmsRecordData: + type: object + required: + - smsRecordId + - smsPayload + properties: + smsRecordId: + $ref: '#/components/schemas/RecordId' + smsPayload: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + ueLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ueTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + RecordId: + type: string + SmsRecordDeliveryData: + type: object + required: + - smsRecordId + - deliveryStatus + properties: + smsRecordId: + $ref: '#/components/schemas/RecordId' + deliveryStatus: + $ref: '#/components/schemas/SmsDeliveryStatus' + SmsDeliveryStatus: + type: string + enum: + - SMS_DELIVERY_PENDING + - SMS_DELIVERY_COMPLETED + - SMS_DELIVERY_FAILED +externalDocs: + description: 3GPP TS 29.540 V15.3.0; 5G System; SMS Services; Stage 3 + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.540/' diff --git a/lib/sbi/support/3gpp-spec/TS29549_SS_Events.yaml b/lib/sbi/support/3gpp-spec/TS29549_SS_Events.yaml new file mode 100644 index 000000000..87ef4283d --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29549_SS_Events.yaml @@ -0,0 +1,263 @@ +openapi: 3.0.0 +info: + title: SS_Events + description: | + API for SEAL Events management. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.0.alpha-1" +externalDocs: + description: 3GPP TS 29.549 V1.1.0 Service Enabler Architecture Layer for Verticals (SEAL); Application Programming Interface (API) specification; Stage 3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.549/ +servers: + - url: '{apiRoot}/ss-events/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 6.5 of 3GPP TS 29.549 +paths: + /subscriptions: + post: + description: Creates a new individual SEAL Event Subscription. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SEALEventSubscription' + callbacks: + notificationDestination: + '{request.body#/notificationDestination}': + post: + requestBody: # contents of the callback message + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SEALEventNotification' + responses: + '204': + description: No Content (successful notification) + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + responses: + '201': + description: SEAL Events subscription resource created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/SEALEventSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/ss-events/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /subscriptions/{subscriptionId}: + delete: + description: Deletes an individual SEAL Event Subscription. + parameters: + - name: subscriptionId + in: path + description: Identifier of an individual Events Subscription + required: true + schema: + type: string + responses: + '204': + description: The individual SEAL Events Subscription matching the subscriptionId is deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + +components: + schemas: + SEALEventSubscription: + type: object + properties: + subscriberId: + type: string + description: String identifying the subscriber of the event. + eventSubs: + type: array + items: + $ref: '#/components/schemas/EventSubscription' + minItems: 1 + description: Subscribed events. + eventReq: + $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation' + notificationDestination: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri' + requestTestNotification: + type: boolean + description: Set to true by Subscriber to request the SEAL server to send a test notification as defined in in clause 6.6. Set to false or omitted otherwise. + websockNotifConfig: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - subscriberId + - eventSubs + - eventReq + - notificationDestination + SEALEventNotification: + type: object + properties: + subscriptionId: + type: string + description: Identifier of the subscription resource to which the notification is related - SEAL resource identifier + eventDetails: + type: array + items: + $ref: '#/components/schemas/SEALEventDetail' + minItems: 1 + description: Detailed notifications of individual events. + required: + - subscriptionId + - eventDetails + EventSubscription: + type: object + properties: + eventId: + $ref: '#/components/schemas/SEALEvent' + valGroups: + type: array + items: + $ref: '#/components/schemas/VALGroupFilter' + minItems: 1 + description: Each element of the array represents the VAL group identifier(s) of a VAL service that the subscriber wants to know in the interested event. This parameter shall be present only if the event subscribed is "GM_GROUP_INFO_CHANGE". + identities: + type: array + items: + $ref: '#/components/schemas/IdentityFilter' + minItems: 1 + description: Each element of the array represents the VAL User / UE IDs of a VAL service that the event subscriber wants to know in the interested event. This parameter shall be present only if the event subscribed is "CM_USER_PROFILE_CHANGE". + required: + - eventId + SEALEventDetail: + type: object + properties: + eventId: + $ref: '#/components/schemas/SEALEvent' + valGroupDocuments: + type: array + items: + $ref: 'TS29549_SS_GroupManagement.yaml#/components/schemas/VALGroupDocument' + minItems: 1 + description: The VAL groups documents with modified membership and configuration information.This parameter shall be present only if the event in event notification is "GM_GROUP_INFO_CHANGE". + profileDocs: + type: array + items: + $ref: 'TS29549_SS_UserProfileRetrieval.yaml#/components/schemas/ProfileDoc' + minItems: 1 + description: Updated profile information associated with VAL Users or VAL UEs. This parameter shall be present only if the event in event notification is "CM_USER_PROFILE_CHANGE". + required: + - eventId + VALGroupFilter: + type: object + properties: + valSvcId: + type: string + description: Identity of the VAL service + valGrpIds: + type: array + items: + type: string + minItems: 1 + description: VAL group identifiers that event subscriber wants to know in the interested event. + required: + - valGrpIds + IdentityFilter: + type: object + properties: + valSvcId: + type: string + description: Identity of the VAL service + valUserIds: + type: array + items: + type: string + minItems: 1 + description: VAL User IDs that the event subscriber wants to know in the interested event. + valUEIds: + type: array + items: + type: string + minItems: 1 + description: VAL UE IDs that the event subscriber wants to know in the interested event. + oneOf: + - required: [valUserIds] + - required: [valUEIds] + SEALEvent: + anyOf: + - type: string + enum: + - LM_LOCATION_INFO + - GM_GROUP_INFO_CHANGE + - CM_USER_PROFILE_CHANGE + - 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 + - LM_LOCATION_INFO: Events related to the location information of VAL Users or VAL UEs from the Location Management Server. + - GM_GROUP_INFO_CHANGE: Events related to the modification of VAL group membership and configuration information from the Group Management Server. + - CM_USER_PROFILE_CHANGE: Events related to update of user profile information from the Configuration Management Server. diff --git a/lib/sbi/support/3gpp-spec/TS29549_SS_GroupManagement.yaml b/lib/sbi/support/3gpp-spec/TS29549_SS_GroupManagement.yaml new file mode 100644 index 000000000..33ba2fd40 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29549_SS_GroupManagement.yaml @@ -0,0 +1,212 @@ +openapi: 3.0.0 +info: + title: SS_GroupManagement + description: | + API for SEAL Group management. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.0.alpha-1" +externalDocs: + description: 3GPP TS 29.549 V1.1.0 Service Enabler Architecture Layer for Verticals (SEAL); Application Programming Interface (API) specification; Stage3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.549/ +servers: + - url: '{apiRoot}/group-management/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 6.5 of 3GPP TS 29.549 +paths: + /group-documents: + post: + description: Creates a new VAL group document. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VALGroupDocument' + responses: + '201': + description: VAL group created sucessfully. + content: + application/json: + schema: + $ref: '#/components/schemas/VALGroupDocument' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/group-management/v1/group-documents/{groupDocId}' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + /group-documents/{groupDocId}: + get: + description: Retrieves VAL group information satisfying filter criteria + parameters: + - name: groupDocId + in: path + description: String identifying an individual VAL group document resource + required: true + schema: + type: string + - name: group-members + in: query + description: When set to true indicates the group management server to send the members list information of the VAL group. + schema: + type: boolean + - name: group-configuration + in: query + description: When set to true indicates the group management server to send the group configuration information of the VAL group. + schema: + type: boolean + responses: + '200': + description: The VAL group information based on the request from the VAL server. Includes VAL group members list if group-members flag is set to true in the request, VAL group configuration information if the group-configuration flag is set to true in the request, VAL group identifier, whole VAL group document resource if both group-members and group-configuration flags are omitted/set to false in the request. + content: + application/json: + schema: + $ref: '#/components/schemas/VALGroupDocument' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + + put: + description: Updates an individual VAL group document. + parameters: + - name: groupDocId + in: path + description: String identifying an individual VAL group document resource + required: true + schema: + type: string + requestBody: + description: VAL group document to be updated in Group management server. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/VALGroupDocument' + responses: + '200': + description: VAL group document updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/VALGroupDocument' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + description: Deletes a VAL Group. + parameters: + - name: groupDocId + in: path + description: String identifying an individual VAL group document resource + required: true + schema: + type: string + responses: + '204': + description: The individual VAL group matching groupDocId was deleted. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + schemas: + VALGroupDocument: + type: object + properties: + valGroupId: + type: string + description: The VAL group idenitity. + grpDesc: + type: string + description: The text description of the VAL group. + membersList: + type: array + description: The list of VAL User IDs and VAL UE IDs, which are members of the VAL group. + items: + type: string + minItems: 1 + valGrpConf: + type: string + description: Configuration data for the VAL group. + valServiceIds: + type: array + description: The list of VAL services enabled on the group. + items: + type: string + minItems: 1 + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - valGroupId diff --git a/lib/sbi/support/3gpp-spec/TS29549_SS_NetworkResourceAdaptation.yaml b/lib/sbi/support/3gpp-spec/TS29549_SS_NetworkResourceAdaptation.yaml new file mode 100644 index 000000000..3c73aa4c1 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29549_SS_NetworkResourceAdaptation.yaml @@ -0,0 +1,294 @@ +openapi: 3.0.0 +info: + version: 1.0.0.alpha-1 + title: SS_NetworkResourceAdaptation + description: | + SS Network Resource Adaptation Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + +externalDocs: + description: 3GPP TS 29.549 V1.1.0; Service Enabler Architecture Layer for Verticals (SEAL); Application Programming Interface (API) specification; Stage3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.549/ + +security: + - {} + - oAuth2ClientCredentials: [] + +servers: + - url: '{apiRoot}/ss-nra/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 + +paths: + /multicast-subscriptions: + post: + summary: Creates a new Individual Multicast Subscription resource + operationId: CreateMulticastSubscription + tags: + - Multicast Subscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MulticastSubscription' + responses: + '201': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/MulticastSubscription' + headers: + Location: + description: 'Contains the URI of the created individual multicast subscription resource' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + UserPlaneNotification: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserPlaneNotification' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /multicast-subscriptions/{multiSubId}: + get: + summary: "Reads an existing Individual Multicast Subscription" + operationId: GetMulticastSubscription + tags: + - Individual Multicast Subscription (Document) + parameters: + - name: multiSubId + in: path + description: Multicast Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/MulticastSubscription' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: "Delete an existing Individual Multicast Subscription" + operationId: DeleteMulticastSubscription + tags: + - Individual Multicast Subscription (Document) + parameters: + - name: multiSubId + in: path + description: Multicast Subscription ID + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + + schemas: + MulticastSubscription: + type: object + properties: + valGroupId: + type: string + anncMode: + $ref: '#/components/schemas/ServiceAnnoucementMode' + qosReq: + $ref: '#/components/schemas/QosRequirement' + locArea: + $ref: 'TS29122_GMDviaMBMSbyMB2.yaml#/components/schemas/MbmsLocArea' + duration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + tmgi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + reqTestNotif: + type: boolean + wsNotifCfg: + $ref: 'TS29122_CommonData.yaml#/components/schemas/WebsockNotifConfig' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - valGroupId + - anncMode + - qosReq + - notifUri + UserPlaneNotification: + type: object + properties: + notifId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + eventNotifs: + type: array + items: + $ref: '#/components/schemas/NrmEventNotification' + minItems: 1 + required: + - notifId + - eventNotifs + NrmEventNotification: + type: object + properties: + event: + $ref: '#/components/schemas/NrmEvent' + ts: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + deliveryMode: + $ref: '#/components/schemas/DeliveryMode' + streamIds: + type: array + items: + type: string + minItems: 1 + required: + - event + - ts + QosRequirement: + type: string +# QoS requirment definition is FFS + +# Simple data types and Enumerations + + ServiceAnnoucementMode: + anyOf: + - type: string + enum: + - NRM + - VAL + - 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 + - NRM: NRM server performs the service announcement. + - VAL: VAL server performs the service announcement. + DeliveryMode: + anyOf: + - type: string + enum: + - UNICAST + - MULTICAST + - 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 + - UNICAST: Unicast delivery. + - MULTICAST: Multicast delivery. + NrmEvent: + anyOf: + - type: string + enum: + - UP_DELIVERY_MODE + - 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 + - UP_DELIVERY_MODE: User Plane delivery mode. diff --git a/lib/sbi/support/3gpp-spec/TS29549_SS_UserProfileRetrieval.yaml b/lib/sbi/support/3gpp-spec/TS29549_SS_UserProfileRetrieval.yaml new file mode 100644 index 000000000..f4af4ca85 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29549_SS_UserProfileRetrieval.yaml @@ -0,0 +1,82 @@ +openapi: 3.0.0 +info: + title: SS_UserProfileRetrieval + description: | + API for SEAL Configuration management. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. + version: "1.0.0.alpha-1" +externalDocs: + description: 3GPP TS 29.549 V1.1.0 Service Enabler Architecture Layer for Verticals (SEAL); Application Programming Interface (API) specification; Stage3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.549/ +servers: + - url: '{apiRoot}/configuration-management/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 6.5 of 3GPP TS 29.549 +paths: + /{valServiceId}: + get: + description: Retrieve a VAL User or VAL UE's profile information belonging to a VAL service. + parameters: + - name: valServiceId + in: path + description: String identifying an individual VAL service resource + required: true + schema: + type: string + - name: valUserId + in: query + description: String identifying a VAL User. Shall be present if valUEId query parameter is not present. + schema: + type: string + - name: valUEId + in: query + description: String identifying a VAL UE. Shall be present if valUserId query parameter is not present. + schema: + type: string + responses: + '200': + description: The Profile information of the VAL User or VAL UE corresponding to the identifier in the request. + content: + application/json: + schema: + $ref: '#/components/schemas/ProfileDoc' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + schemas: + ProfileDoc: + type: object + properties: + profileInformation: + type: string + description: Profile information associated with the valUserId or valUEId. + valUserId: + type: string + description: Unique identifier of a VAL user. + valUEId: + type: string + description: Unique identifuer of a VAL UE. + required: + - profileInformation + oneOf: + - required: [valUserId] + - required: [valUEId] diff --git a/lib/sbi/support/3gpp-spec/TS29551_Nnef_PFDmanagement.yaml b/lib/sbi/support/3gpp-spec/TS29551_Nnef_PFDmanagement.yaml new file mode 100644 index 000000000..9aab99526 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29551_Nnef_PFDmanagement.yaml @@ -0,0 +1,401 @@ +openapi: 3.0.0 +info: + title: Nnef_PFDmanagement Sevice API + version: 1.1.0.alpha-3 + description: | + Packet Flow Description Management Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +# +externalDocs: + description: 3GPP TS 29.551 v16.3.0, 5G System; Packet Flow Description Management Service + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.551/' +# +servers: + - url: '{apiRoot}/nnef-pfdmanagement/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nnef-pfdmanagement +paths: + /applications: + get: + summary: Retrieve PFDs for all applications or for one or multiple applications with query parameter. + tags: + - PFD of applications + operationId: Nnef_PFDmanagement_Fetch + parameters: + - name: application-ids + description: The required application identifier(s) for the returned PFDs. + in: query + required: true + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + - name: supported-features + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: The PFDs for one or more application identifier(s) in the request URI are returned. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdDataForApp' + minItems: 0 + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + + /applications/{appId}: + get: + summary: Retrieve the PFD for an application. + tags: + - Individual application PFD + operationId: Nnef_PFDmanagement_Fetch + parameters: + - name: appId + description: The required application identifier(s) for the returned PFDs. + in: path + required: true + schema: + type: string + - name: supported-features + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + responses: + '200': + description: A representation of PFDs for an application in the request URI is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdDataForApp' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + + /subscriptions: + post: + summary: Subscribe the notification of PFD changes. + tags: + - PFD subscriptions + operationId: Nnef_PFDmanagement_Subscribe + requestBody: + description: a PfdSubscription resource to be created. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PfdSubscription' + callbacks: + PfdChangeNotification: + '{request.body#/notifyUri}': + post: + summary: Notification of PFD change. + tags: + - PfdChangeNotification data + operationId: Nnef_PFDmanagement_Notify + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdChangeNotification' + minItems: 1 + responses: + '200': + description: The PFD operation in the notification is performed and the PfdChangeReport indicates failure reason. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PfdChangeReport' + minItems: 1 + '204': + description: The PFD operation in the notification is performed successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + + + responses: + '201': + description: The creation of a PfdSubscription resource is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/PfdSubscription' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnef-pfdmanagement/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + + /subscriptions/{subscriptionId}: + put: + summary: Updates/replaces an existing subscription resource + tags: + - Individual PFD subscription + operationId: Nnef_PFDmanagement_Subscribe + parameters: + - name: subscriptionId + description: Identify the subscription. + in: path + required: true + schema: + type: string + requestBody: + description: Parameters to update/replace the existing subscription + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PfdSubscription' + responses: + '200': + description: OK (Successful update of the subscription) + content: + application/json: + schema: + $ref: '#/components/schemas/PfdSubscription' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + delete: + summary: Delete a subscription of PFD change notification. + tags: + - Individual PFD subscription + operationId: Nnef_PFDmanagement_Unsubscribe + parameters: + - name: subscriptionId + description: Identify the subscription. + in: path + required: true + schema: + type: string + responses: + '204': + description: The PfdSubscription resource matching the subscriptionId was deleted successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnef-pfdmanagement: Access to the Nnef_PFDmanagement API + schemas: +# +# STRUCTURED DATA TYPES +# + PfdContent: + type: object + properties: + pfdId: + type: string + description: Identifies a PDF of an application identifier. + flowDescriptions: + type: array + items: + type: string + minItems: 1 + description: Represents a 3-tuple with protocol, server ip and server port for UL/DL application traffic. + urls: + type: array + items: + type: string + minItems: 1 + description: Indicates a URL or a regular expression which is used to match the significant parts of the URL. + domainNames: + type: array + items: + type: string + minItems: 1 + description: Indicates an FQDN or a regular expression as a domain name matching criteria. + dnProtocol: + $ref: 'TS29122_PfdManagement.yaml#/components/schemas/DomainNameProtocol' + + + PfdDataForApp: + type: object + properties: + applicationId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + pfds: + type: array + items: + $ref: '#/components/schemas/PfdContent' + minItems: 1 + cachingTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - applicationId + - pfds + + PfdSubscription: + type: object + properties: + applicationIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + notifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - notifyUri + - supportedFeatures + + PfdChangeNotification: + type: object + properties: + applicationId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + removalFlag: + type: boolean + default: false + partialFlag: + type: boolean + default: false + pfds: + type: array + items: + $ref: '#/components/schemas/PfdContent' + minItems: 1 + required: + - applicationId + + PfdChangeReport: + type: object + properties: + pfdError: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + applicationId: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + required: + - pfdError + - applicationId diff --git a/lib/sbi/support/3gpp-spec/TS29554_Npcf_BDTPolicyControl.yaml b/lib/sbi/support/3gpp-spec/TS29554_Npcf_BDTPolicyControl.yaml new file mode 100644 index 000000000..038fe7aa2 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29554_Npcf_BDTPolicyControl.yaml @@ -0,0 +1,383 @@ +openapi: 3.0.0 +info: + title: Npcf_BDTPolicyControl Service API + version: 1.1.0.alpha-4 + description: | + PCF BDT Policy Control Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +# +externalDocs: + description: 3GPP TS 29.554 V16.3.0; 5G System; Background Data Transfer Policy Control Service. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.554/' +# +servers: + - url: '{apiRoot}/npcf-bdtpolicycontrol/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +security: + - {} + - oAuth2ClientCredentials: + - npcf-bdtpolicycontrol +paths: + /bdtpolicies: + post: + summary: Create a new Individual BDT policy + operationId: CreateBDTPolicy + tags: + - BDT policies (Collection) + requestBody: + description: Contains information for the creation of a new Individual BDT policy resource. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BdtReqData' + responses: + '201': + description: Background data transfer policies offered to an ASP. + content: + application/json: + schema: + $ref: '#/components/schemas/BdtPolicy' + headers: + Location: + description: 'Contains the URI of the created individual BDT policy resource, according to the structure: {apiRoot}/npcf-bdtpolicycontrol/v1/bdtpolicies/{bdtPolicyId}' + required: true + schema: + type: string +# +# Error scenarios POST +# + '303': + description: See Other. The result of the POST request would be equivalent to the existing Individual BDT policy resource. The HTTP response shall contain a Location header field set to the URI of the existing individual BDT policy resource. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +# +# End error scenarios POST +# + callbacks: + BdtNotification: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Notification' + responses: + '204': + description: No Content, a reception of the BDT notification was successful. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +# + /bdtpolicies/{bdtPolicyId}: + get: + summary: Read an Individual BDT policy + operationId: GetBDTPolicy + tags: + - Individual BDT policy (Document) + parameters: + - name: bdtPolicyId + description: String identifying the individual BDT policy resource in the PCF. + in: path + required: true + schema: + type: string + responses: + '200': + description: Background data transfer policies offered to and selected by an ASP. + content: + application/json: + schema: + $ref: '#/components/schemas/BdtPolicy' +# +# Error scenarios GET +# + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +# +# End error scenarios GET +# + patch: + summary: Update an Individual BDT policy + operationId: UpdateBDTPolicy + tags: + - Individual BDT policy (Document) + parameters: + - name: bdtPolicyId + description: String identifying the individual BDT policy resource in the PCF. + in: path + required: true + schema: + type: string + requestBody: + description: Contains modification instruction to be performed on the BdtPolicy data structure to select a transfer policy and in addition, may indicate whether the BDT warning notification is enabled or disabled. + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/BdtPolicyDataPatch' + responses: + '200': + description: The Individual BDT Policy resource is modified and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/BdtPolicy' + '204': + description: The Individual BDT Policy resource is modified. +# +# Error scenarios PATCH +# + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +# +# End error scenarios PATCH +# +# +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + npcf-bdtpolicycontrol: Access to the Npcf_BDTPolicyControl API + schemas: +# +# Structured data types +# + BdtPolicy: + description: Represents an Individual BDT policy resource. + type: object + properties: + bdtPolData: + $ref: '#/components/schemas/BdtPolicyData' + bdtReqData: + $ref: '#/components/schemas/BdtReqData' +# + BdtReqData: + description: Contains service requirements for creation a new Individual BDT policy resource. + type: object + required: + - aspId + - desTimeInt + - numOfUes + - volPerUe + properties: + aspId: + $ref: '#/components/schemas/AspId' + desTimeInt: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + interGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nwAreaInfo: + $ref: '#/components/schemas/NetworkAreaInfo' + numOfUes: + description: Indicates a number of UEs. + type: integer + volPerUe: + $ref: 'TS29122_CommonData.yaml#/components/schemas/UsageThreshold' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + warnNotifReq: + description: Indicates whether the BDT warning notification is enabled or disabled. + type: boolean + default: false +# + BdtPolicyData: + description: Describes the authorization data of an Individual BDT policy resource. + type: object + required: + - bdtRefId + - transfPolicies + properties: + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + transfPolicies: + description: Contains transfer policies. + type: array + items: + $ref: '#/components/schemas/TransferPolicy' + minItems: 1 + selTransPolicyId: + description: Contains an identity of the selected transfer policy. + type: integer + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' +# + BdtPolicyDataPatch: + description: A JSON Merge Patch body schema containing modification instruction to be performed on the BdtPolicy data structure to select a transfer policy and in addition, may indicate whether the BDT warning notification is enabled or disabled. Adds selTransPolicyId to BdtPolicyData data structure and modifies warnNotifReq from BdtReqData data structure. + type: object + required: + - selTransPolicyId + properties: + selTransPolicyId: + description: Contains an identity (i.e. transPolicyId value) of the selected transfer policy. + type: integer + warnNotifReq: + description: Indicates whether the BDT warning notification is enabled or disabled. + type: boolean +# + TransferPolicy: + description: Describes a transfer policy. + type: object + required: + - ratingGroup + - recTimeInt + - transPolicyId + properties: + maxBitRateDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + maxBitRateUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + ratingGroup: + description: Indicates a rating group for the recommended time window. + type: integer + recTimeInt: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + transPolicyId: + description: Contains an identity of a transfer policy. + type: integer + NetworkAreaInfo: + description: Describes a network area information in which the NF service consumer requests the number of UEs. + type: object + properties: + ecgis: + description: Contains a list of E-UTRA cell identities. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ecgi' + minItems: 1 + ncgis: + description: Contains a list of NR cell identities. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ncgi' + minItems: 1 + gRanNodeIds: + description: Contains a list of NG RAN nodes. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + minItems: 1 + tais: + description: Contains a list of tracking area identities. + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 +# + Notification: + description: Describes a BDT notification. + type: object + required: + - bdtRefId + properties: + bdtRefId: + $ref: 'TS29122_CommonData.yaml#/components/schemas/BdtReferenceId' + candPolicies: + description: Contains a list of the candidate transfer policies from which the AF may select a new transfer policy due to a network performance is below the criteria set by the operator. + type: array + items: + $ref: '#/components/schemas/TransferPolicy' + minItems: 1 + nwAreaInfo: + $ref: '#/components/schemas/NetworkAreaInfo' + timeWindow: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' +# +# Simple data types +# + AspId: + description: Contains an identity of an application service provider. + type: string +# +# diff --git a/lib/sbi/support/3gpp-spec/TS29571_CommonData.yaml b/lib/sbi/support/3gpp-spec/TS29571_CommonData.yaml new file mode 100644 index 000000000..f6643bdd5 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29571_CommonData.yaml @@ -0,0 +1,1909 @@ +openapi: 3.0.0 +info: + version: '1.2.0.alpha-1' + title: 'Common Data Types' + description: | + Common Data Types for Service Based Interfaces. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.571 Common Data Types for Service Based Interfaces, version 16.0.0 interim + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.571/' + +paths: {} +components: + schemas: + +# +# Common Data Types for Generic usage definitiones as defined in subclause 5.2 +# + +# +# COMMON SIMPLE DATA TYPES +# + Binary: + format: binary + type: string + BinaryRm: + format: binary + type: string + nullable: true + Bytes: + format: byte + type: string + BytesRm: + format: byte + type: string + nullable: true + Date: + format: date + type: string + DateRm: + format: date + type: string + nullable: true + DateTime: + format: date-time + type: string + DateTimeRm: + format: date-time + type: string + nullable: true + DiameterIdentity: + type: string + pattern: '^([A-Za-z0-9]+([-A-Za-z0-9]+)\.)+[a-z]{2,}$' + DiameterIdentityRm: + type: string + pattern: '^([A-Za-z0-9]+([-A-Za-z0-9]+)\.)+[a-z]{2,}$' + nullable: true + Double: + format: double + type: number + DoubleRm: + format: double + type: number + nullable: true + DurationSec: + type: integer + DurationSecRm: + type: integer + nullable: true + Float: + format: float + type: number + FloatRm: + format: float + type: number + nullable: true + Int32: + format: int32 + type: integer + Int32Rm: + format: int32 + type: integer + nullable: true + Int64: + type: integer + format: int64 + Int64Rm: + format: int64 + type: integer + nullable: true + Ipv4Addr: + type: string + pattern: '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$' + example: '198.51.100.1' + Ipv4AddrRm: + type: string + pattern: '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$' + example: '198.51.100.1' + nullable: true + Ipv6Addr: + type: string + allOf: + - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$' + - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$' + example: '2001:db8:85a3::8a2e:370:7334' + Ipv6AddrRm: + type: string + allOf: + - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$' + - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$' + example: '2001:db8:85a3::8a2e:370:7334' + nullable: true + Ipv6Prefix: + type: string + allOf: + - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$' + - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)$' + example: '2001:db8:abcd:12::0/64' + Ipv6PrefixRm: + type: string + allOf: + - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$' + - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)$' + nullable: true + MacAddr48: + type: string + pattern: '^([0-9a-fA-F]{2})((-[0-9a-fA-F]{2}){5})$' + MacAddr48Rm: + type: string + pattern: '^([0-9a-fA-F]{2})((-[0-9a-fA-F]{2}){5})$' + nullable: true + SupportedFeatures: + type: string + pattern: '^[A-Fa-f0-9]*$' + Uinteger: + type: integer + minimum: 0 + UintegerRm: + type: integer + minimum: 0 + nullable: true + Uint16: + type: integer + minimum: 0 + maximum: 65535 + Uint16Rm: + type: integer + minimum: 0 + maximum: 65535 + nullable: true + Uint32: + format: int32 + type: integer + minimum: 0 + Uint32Rm: + format: int32 + type: integer + minimum: 0 + nullable: true + Uint64: + format: int64 + type: integer + minimum: 0 + Uint64Rm: + format: int64 + type: integer + minimum: 0 + nullable: true + Uri: + type: string + UriRm: + type: string + nullable: true + VarUeId: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + VarUeIdRm: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + nullable: true + TimeZone: + type: string + TimeZoneRm: + type: string + nullable: true + +# +# COMMON ENUMERATED DATA TYPES +# + + PatchOperation: + anyOf: + - type: string + enum: + - add + - copy + - move + - remove + - replace + - test + - type: string + UriScheme: + anyOf: + - type: string + enum: + - http + - https + - type: string + ChangeType: + anyOf: + - type: string + enum: + - ADD + - MOVE + - REMOVE + - REPLACE + - type: string + +# +# COMMON STRUCTURED DATA TYPES +# + + ProblemDetails: + type: object + properties: + type: + $ref: '#/components/schemas/Uri' + title: + type: string + status: + type: integer + detail: + type: string + instance: + $ref: '#/components/schemas/Uri' + cause: + type: string + invalidParams: + type: array + items: + $ref: '#/components/schemas/InvalidParam' + minItems: 1 + supportedFeatures: + $ref: '#/components/schemas/SupportedFeatures' + Link: + type: object + properties: + href: + $ref: '#/components/schemas/Uri' + LinkRm: + type: object + properties: + href: + $ref: '#/components/schemas/Uri' + nullable: true + PatchItem: + type: object + properties: + op: + $ref: '#/components/schemas/PatchOperation' + path: + type: string + from: + type: string + value: + nullable: true + required: + - op + - path + LinksValueSchema: + oneOf: + - type: array + items: + $ref: '#/components/schemas/Link' + minItems: 1 + - $ref: '#/components/schemas/Link' + SelfLink: + type: object + properties: + self: + $ref: '#/components/schemas/Link' + required: + - self + InvalidParam: + type: object + properties: + param: + type: string + reason: + type: string + required: + - param + ChangeItem: + type: object + properties: + op: + $ref: '#/components/schemas/ChangeType' + path: + type: string + from: + type: string + origValue: {} + newValue: {} + required: + - op + - path + NotifyItem: + type: object + required: + - resourceId + - changes + properties: + resourceId: + $ref: '#/components/schemas/Uri' + changes: + type: array + items: + $ref: '#/components/schemas/ChangeItem' + minItems: 1 + ComplexQuery: + oneOf: + - $ref: '#/components/schemas/Cnf' + - $ref: '#/components/schemas/Dnf' + Cnf: + type: object + required: + - cnfUnits + properties: + cnfUnits: + type: array + items: + $ref: '#/components/schemas/CnfUnit' + minItems: 1 + Dnf: + type: object + required: + - dnfUnits + properties: + dnfUnits: + type: array + items: + $ref: '#/components/schemas/DnfUnit' + minItems: 1 + CnfUnit: + type: object + required: + - cnfUnit + properties: + cnfUnit: + type: array + items: + $ref: '#/components/schemas/Atom' + minItems: 1 + DnfUnit: + type: object + required: + - dnfUnit + properties: + dnfUnit: + type: array + items: + $ref: '#/components/schemas/Atom' + minItems: 1 + Atom: + type: object + required: + - attr + - value + properties: + attr: + type: string + value: {} + negative: + type: boolean + NFDiscFactors: + type: object + properties: + targetNfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + requesterNfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + serviceNames: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + minItems: 1 + uniqueItems: true + requesterNfInstanceFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + targetPlmnList: + type: array + items: + $ref: '#/components/schemas/PlmnId' + minItems: 1 + requesterPlmnList: + type: array + items: + $ref: '#/components/schemas/PlmnId' + minItems: 1 + targetNfInstanceId: + $ref: '#/components/schemas/NfInstanceId' + targetNfFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + hnrfUri: + $ref: '#/components/schemas/Uri' + snssais: + type: array + items: + $ref: '#/components/schemas/Snssai' + minItems: 1 + plmnSpecificSnssaiList: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' + minItems: 1 + dnn: + $ref: '#/components/schemas/Dnn' + nsiList: + type: array + items: + type: string + minItems: 1 + tai: + $ref: '#/components/schemas/Tai' + amfRegionId: + $ref: '#/components/schemas/AmfRegionId' + amfSetId: + $ref: '#/components/schemas/AmfSetId' + guami: + $ref: '#/components/schemas/Guami' + supi: + $ref: '#/components/schemas/Supi' + ueIpv4Address: + $ref: '#/components/schemas/Ipv4Addr' + ipDomain: + type: string + ueIpv6Prefix: + $ref: '#/components/schemas/Ipv6Prefix' + pgwInd: + type: boolean + pgw: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + gpsi: + $ref: '#/components/schemas/Gpsi' + externalGroupIdentity: + type: string + dataSet: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DataSetId' + routingIndicator: + type: string + pattern: '^[0-9]{1,4}$' + groupIdList: + type: array + items: + $ref: '#/components/schemas/NfGroupId' + minItems: 1 + dnaiList: + type: array + items: + $ref: '#/components/schemas/Dnai' + minItems: 1 + pduSessionTypes: + type: array + items: + $ref: '#/components/schemas/PduSessionType' + minItems: 1 + upfIwkEpsInd: + type: boolean + chfSupportedPlmn: + $ref: '#/components/schemas/PlmnId' + preferredLocality: + type: string + accessType: + $ref: '#/components/schemas/AccessType' + requiredFeatures: + type: array + items: + $ref: '#/components/schemas/SupportedFeatures' + minItems: 1 + complexQuery: + $ref: '#/components/schemas/ComplexQuery' + + + + +# +# Data Types related to Subscription, Identification and Numbering as defined in subclause 5.3 +# + +# +# SIMPLE DATA TYPES +# + Dnn: + type: string + DnnRm: + type: string + nullable: true + Gpsi: + type: string + pattern: '^(msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + GpsiRm: + type: string + pattern: '^(msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + nullable: true + GroupId: + type: string + pattern: '^[A-Fa-f0-9]{8}-[0-9]{3}-[0-9]{2,3}-([A-Fa-f0-9][A-Fa-f0-9]){1,10}$' + GroupIdRm: + type: string + pattern: '^[A-Fa-f0-9]{8}-[0-9]{3}-[0-9]{2,3}-([A-Fa-f0-9][A-Fa-f0-9]){1,10}$' + nullable: true + Pei: + type: string + pattern: '^(imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + PeiRm: + type: string + pattern: '^(imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + nullable: true + Supi: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|.+)$' + SupiRm: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|.+)$' + nullable: true + NfInstanceId: + type: string + format: uuid + AmfId: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + AmfRegionId: + type: string + pattern: '^[A-Fa-f0-9]{2}$' + AmfSetId: + type: string + pattern: '^[0-3][A-Fa-f0-9]{2}$' + RfspIndex: + type: integer + minimum: 1 + maximum: 256 + RfspIndexRm: + type: integer + minimum: 1 + maximum: 256 + nullable: true + NfGroupId: + type: string + MtcProviderInformation: + type: string + +# +# STRUCTURED DATA TYPES +# + Guami: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + 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 + NetworkId: + type: object + properties: + mnc: + $ref: '#/components/schemas/Mnc' + mcc: + $ref: '#/components/schemas/Mcc' + + +# +# Data Types related to 5G Network as defined in subclause 5.4 +# + +# +# SIMPLE DATA TYPES +# + ApplicationId: + type: string + ApplicationIdRm: + type: string + nullable: true + PduSessionId: + type: integer + minimum: 0 + maximum: 255 + Mcc: + type: string + pattern: '^\d{3}$' + MccRm: + type: string + pattern: '^\d{3}$' + nullable: true + Mnc: + type: string + pattern: '^\d{2,3}$' + MncRm: + type: string + pattern: '^\d{2,3}$' + nullable: true + Tac: + type: string + pattern: '(^[A-Fa-f0-9]{4}$)|(^[A-Fa-f0-9]{6}$)' + TacRm: + type: string + pattern: '(^[A-Fa-f0-9]{4}$)|(^[A-Fa-f0-9]{6}$)' + nullable: true + EutraCellId: + type: string + pattern: '^[A-Fa-f0-9]{7}$' + EutraCellIdRm: + type: string + pattern: '^[A-Fa-f0-9]{7}$' + nullable: true + NrCellId: + type: string + pattern: '^[A-Fa-f0-9]{9}$' + NrCellIdRm: + type: string + pattern: '^[A-Fa-f0-9]{9}$' + nullable: true + Dnai: + type: string + DnaiRm: + type: string + nullable: true + 5GMmCause: + $ref: '#/components/schemas/Uinteger' + AmfName: + type: string + AreaCode: + type: string + AreaCodeRm: + type: string + nullable: true + N3IwfId: + 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})$' + +# +# ENUMERATED DATA TYPES +# + + AccessType: + type: string + enum: + - 3GPP_ACCESS + - NON_3GPP_ACCESS + AccessTypeRm: + type: string + enum: + - 3GPP_ACCESS + - NON_3GPP_ACCESS + nullable: true + RatType: + anyOf: + - type: string + enum: + - NR + - EUTRA + - WLAN + - VIRTUAL + - NBIOT + - type: string + RatTypeRm: + anyOf: + - type: string + enum: + - NR + - EUTRA + - WLAN + - VIRTUAL + - NBIOT + - type: string + nullable: true + PduSessionType: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - IPV4V6 + - UNSTRUCTURED + - ETHERNET + - type: string + PduSessionTypeRm: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - IPV4V6 + - UNSTRUCTURED + - ETHERNET + - type: string + nullable: true + UpIntegrity: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + UpIntegrityRm: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + nullable: true + UpConfidentiality: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + UpConfidentialityRm: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + nullable: true + SscMode: + anyOf: + - type: string + enum: + - SSC_MODE_1 + - SSC_MODE_2 + - SSC_MODE_3 + - type: string + SscModeRm: + anyOf: + - type: string + enum: + - SSC_MODE_1 + - SSC_MODE_2 + - SSC_MODE_3 + - type: string + nullable: true + DnaiChangeType: + anyOf: + - type: string + enum: + - EARLY + - EARLY_LATE + - LATE + - 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 + - EARLY: Early notification of UP path reconfiguration. + - EARLY_LATE: Early and late notification of UP path reconfiguration. This value shall only be present in the subscription to the DNAI change event. + - LATE: Late notification of UP path reconfiguration. + DnaiChangeTypeRm: + anyOf: + - type: string + enum: + - EARLY + - EARLY_LATE + - LATE + - type: string + nullable: true + RestrictionType: + anyOf: + - type: string + enum: + - ALLOWED_AREAS + - NOT_ALLOWED_AREAS + - type: string + RestrictionTypeRm: + anyOf: + - type: string + enum: + - ALLOWED_AREAS + - NOT_ALLOWED_AREAS + - type: string + nullable: true + CoreNetworkType: + anyOf: + - type: string + enum: + - 5GC + - EPC + - type: string + CoreNetworkTypeRm: + anyOf: + - type: string + enum: + - 5GC + - EPC + - type: string + nullable: true + PresenceState: + anyOf: + - type: string + enum: + - IN_AREA + - OUT_OF_AREA + - UNKNOWN + - INACTIVE + - type: string + +# +# STRUCTURED DATA TYPES +# + + Snssai: + type: object + properties: + sst: + type: integer + minimum: 0 + maximum: 255 + sd: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + required: + - sst + PlmnId: + type: object + properties: + mcc: + $ref: '#/components/schemas/Mcc' + mnc: + $ref: '#/components/schemas/Mnc' + required: + - mcc + - mnc + PlmnIdRm: + type: object + properties: + mcc: + $ref: '#/components/schemas/Mcc' + mnc: + $ref: '#/components/schemas/Mnc' + required: + - mcc + - mnc + nullable: true + Tai: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + tac: + $ref: '#/components/schemas/Tac' + required: + - plmnId + - tac + TaiRm: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + tac: + $ref: '#/components/schemas/Tac' + required: + - plmnId + - tac + nullable: true + Ecgi: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + # PLMN Identity + eutraCellId: + $ref: '#/components/schemas/EutraCellId' + required: + - plmnId + - eutraCellId + EcgiRm: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + # PLMN Identity + eutraCellId: + $ref: '#/components/schemas/EutraCellId' + required: + - plmnId + - eutraCellId + nullable: true + Ncgi: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + nrCellId: + $ref: '#/components/schemas/NrCellId' + required: + - plmnId + - nrCellId + NcgiRm: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + nrCellId: + $ref: '#/components/schemas/NrCellId' + required: + - plmnId + - nrCellId + nullable: true + UserLocation: + type: object + properties: + eutraLocation: + $ref: '#/components/schemas/EutraLocation' + nrLocation: + $ref: '#/components/schemas/NrLocation' + n3gaLocation: + $ref: '#/components/schemas/N3gaLocation' + EutraLocation: + 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' + required: + - 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' + required: + - tai + - ecgi + nullable: true + NrLocation: + type: object + properties: + tai: + $ref: '#/components/schemas/Tai' + ncgi: + $ref: '#/components/schemas/Ncgi' + 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 + NrLocationRm: + type: object + properties: + tai: + $ref: '#/components/schemas/Tai' + ncgi: + $ref: '#/components/schemas/Ncgi' + 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 + N3gaLocation: + type: object + properties: + n3gppTai: + $ref: '#/components/schemas/Tai' + n3IwfId: + type: string + pattern: '^[A-Fa-f0-9]+$' + ueIpv4Addr: + $ref: '#/components/schemas/Ipv4Addr' + ueIpv6Addr: + $ref: '#/components/schemas/Ipv6Addr' + portNumber: + $ref: '#/components/schemas/Uinteger' + UpSecurity: + type: object + properties: + upIntegr: + $ref: '#/components/schemas/UpIntegrity' + upConfid: + $ref: '#/components/schemas/UpConfidentiality' + required: + - upIntegr + - upConfid + UpSecurityRm: + type: object + properties: + upIntegr: + $ref: '#/components/schemas/UpIntegrity' + upConfid: + $ref: '#/components/schemas/UpConfidentiality' + required: + - upIntegr + - upConfid + nullable: true + NgApCause: + type: object + properties: + group: + $ref: '#/components/schemas/Uinteger' + value: + $ref: '#/components/schemas/Uinteger' + required: + - group + - value + BackupAmfInfo: + type: object + properties: + backupAmf: + $ref: '#/components/schemas/AmfName' + guamiList: + type: array + items: + $ref: '#/components/schemas/Guami' + minItems: 1 + required: + - backupAmf + RefToBinaryData: + type: object + properties: + contentId: + type: string + required: + - contentId + RefToBinaryDataRm: + type: object + properties: + contentId: + type: string + required: + - contentId + nullable: true + RouteToLocation: + type: object + properties: + dnai: + $ref: '#/components/schemas/Dnai' + routeInfo: + $ref: '#/components/schemas/RouteInformation' + routeProfId: + type: string + nullable: true + required: + - dnai + anyOf: + - required: [ routeInfo ] + - required: [ routeProfId ] + nullable: true + RouteInformation: + type: object + properties: + ipv4Addr: + $ref: '#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: '#/components/schemas/Ipv6Addr' + portNumber: + $ref: '#/components/schemas/Uinteger' + required: + - portNumber + nullable: true + SubscribedDefaultQos: + type: object + required: + - 5qi + - arp + properties: + 5qi: + $ref: '#/components/schemas/5Qi' + arp: + $ref: '#/components/schemas/Arp' + priorityLevel: + $ref: '#/components/schemas/5QiPriorityLevel' + Area: + type: object + oneOf: + - required: + - tacs + - required: + - areaCode + properties: + tacs: + type: array + items: + $ref: '#/components/schemas/Tac' + minItems: 1 + areaCode: + $ref: '#/components/schemas/AreaCode' + ServiceAreaRestriction: + type: object + properties: + restrictionType: + $ref: '#/components/schemas/RestrictionType' + areas: + type: array + items: + $ref: '#/components/schemas/Area' + maxNumOfTAs: + $ref: '#/components/schemas/Uinteger' + maxNumOfTAsForNotAllowedAreas: + $ref: '#/components/schemas/Uinteger' + allOf: + # + # 1st condition: restrictionType and areas attributes shall be either both absent + # or both present + # + - oneOf: + - not: + required: [ restrictionType ] + - required: [ areas ] + # + # 2nd condition: if restrictionType takes value NOT_ALLOWED_AREAS, + # then maxNumOfTAs shall be absent + # + - anyOf: + - not: + required: [ restrictionType ] + properties: + restrictionType: + type: string + enum: [ NOT_ALLOWED_AREAS ] + - not: + required: [ maxNumOfTAs ] + # + # 3rd condition: if restrictionType takes value ALLOWED_AREAS, + # then maxNumOfTAsForNotAllowedAreas shall be absent + # + - anyOf: + - not: + required: [ restrictionType ] + properties: + restrictionType: + type: string + enum: [ ALLOWED_AREAS ] + - not: + required: [ maxNumOfTAsForNotAllowedAreas ] + PresenceInfo: + type: object + properties: + praId: + type: string + presenceState: + $ref: '#/components/schemas/PresenceState' + trackingAreaList: + type: array + items: + $ref: '#/components/schemas/Tai' + minItems: 1 + ecgiList: + type: array + items: + $ref: '#/components/schemas/Ecgi' + minItems: 1 + ncgiList: + type: array + items: + $ref: '#/components/schemas/Ncgi' + minItems: 1 + globalRanNodeIdList: + type: array + items: + $ref: '#/components/schemas/GlobalRanNodeId' + minItems: 1 + PresenceInfoRm: + type: object + properties: + praId: + type: string + presenceState: + $ref: '#/components/schemas/PresenceState' + trackingAreaList: + type: array + items: + $ref: '#/components/schemas/Tai' + minItems: 0 + ecgiList: + type: array + items: + $ref: '#/components/schemas/Ecgi' + minItems: 0 + ncgiList: + type: array + items: + $ref: '#/components/schemas/Ncgi' + minItems: 0 + globalRanNodeIdList: + type: array + items: + $ref: '#/components/schemas/GlobalRanNodeId' + nullable: true + GlobalRanNodeId: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + n3IwfId: + $ref: '#/components/schemas/N3IwfId' + gNbId: + $ref: '#/components/schemas/GNbId' + ngeNbId: + $ref: '#/components/schemas/NgeNbId' + oneOf: + - required: [ n3IwfId ] + - required: [ gNbId ] + - required: [ ngeNbId ] + required: + - plmnId + GNbId: + type: object + properties: + bitLength: + type: integer + minimum: 22 + maximum: 32 + gNBValue: + type: string + pattern: '^[A-Fa-f0-9]{6,8}$' + required: + - bitLength + - gNBValue + MaPduCapability: + type: object + properties: + atsssLL: + type: boolean + default: false + mptcp: + type: boolean + default: boolean + AtsssCapability: + type: object + properties: + atsssLL: + type: boolean + default: false + mptcp: + type: boolean + default: false + + +# +# Data Types related to 5G QoS as defined in subclause 5.5 +# + +# +# SIMPLE DATA TYPES +# +# + Qfi: + type: integer + minimum: 0 + maximum: 63 + QfiRm: + type: integer + minimum: 0 + maximum: 63 + nullable: true + 5Qi: + type: integer + minimum: 0 + maximum: 255 + 5QiRm: + type: integer + minimum: 0 + maximum: 255 + nullable: true + BitRate: + type: string + pattern: '^\d+(\.\d+)? (bps|Kbps|Mbps|Gbps|Tbps)$' + BitRateRm: + type: string + pattern: '^\d+(\.\d+)? (bps|Kbps|Mbps|Gbps|Tbps)$' + nullable: true + ArpPriorityLevelRm: + type: integer + minimum: 1 + maximum: 15 + nullable: true + ArpPriorityLevel: + type: integer + minimum: 1 + maximum: 15 + nullable: true + description: nullable true shall not be used for this attribute + 5QiPriorityLevel: + type: integer + minimum: 1 + maximum: 127 + 5QiPriorityLevelRm: + type: integer + minimum: 1 + maximum: 127 + nullable: true + PacketDelBudget: + type: integer + minimum: 1 + PacketDelBudgetRm: + type: integer + minimum: 1 + nullable: true + PacketErrRate: + type: string + pattern: '^([0-9]E-[0-9])$' + PacketErrRateRm: + type: string + pattern: '^([0-9]E-[0-9])$' + nullable: true + PacketLossRate: + type: integer + minimum: 0 + maximum: 1000 + PacketLossRateRm: + type: integer + minimum: 0 + maximum: 1000 + nullable: true + AverWindow: + type: integer + minimum: 1 + maximum: 4095 + default: 2000 + AverWindowRm: + type: integer + maximum: 4095 + default: 2000 + minimum: 1 + nullable: true + MaxDataBurstVol: + type: integer + minimum: 1 + maximum: 4095 + MaxDataBurstVolRm: + type: integer + minimum: 1 + maximum: 4095 + nullable: true + SampleRatio: + type: integer + minimum: 1 + maximum: 100 + SampleRatioRm: + type: integer + minimum: 1 + maximum: 100 + nullable: true + +# +# ENUMERATED DATA TYPES +# + + PreemptionCapability: + anyOf: + - type: string + enum: + - NOT_PREEMPT + - MAY_PREEMPT + - type: string + PreemptionCapabilityRm: + anyOf: + - type: string + enum: + - NOT_PREEMPT + - MAY_PREEMPT + - type: string + nullable: true + PreemptionVulnerability: + anyOf: + - type: string + enum: + - NOT_PREEMPTABLE + - PREEMPTABLE + - type: string + PreemptionVulnerabilityRm: + anyOf: + - type: string + enum: + - NOT_PREEMPTABLE + - PREEMPTABLE + - type: string + nullable: true + ReflectiveQoSAttribute: + anyOf: + - type: string + enum: + - RQOS + - NO_RQOS + - type: string + ReflectiveQoSAttributeRm: + anyOf: + - type: string + enum: + - RQOS + - NO_RQOS + - type: string + nullable: true + NotificationControl: + anyOf: + - type: string + enum: + - REQUESTED + - NOT_REQUESTED + - type: string + NotificationControlRm: + anyOf: + - type: string + enum: + - REQUESTED + - NOT_REQUESTED + - type: string + nullable: true + QosResourceType: + anyOf: + - type: string + enum: + - NON_GBR + - NON_CRITICAL_GBR + - CRITICAL_GBR + - type: string + QosResourceTypeRm: + anyOf: + - type: string + enum: + - NON_GBR + - NON_CRITICAL_GBR + - CRITICAL_GBR + - type: string + nullable: true + AdditionalQosFlowInfo: + anyOf: + - type: string + enum: + - MORE_LIKELY + - type: string + nullable: true +# + +# +# STRUCTURED DATA TYPES +# + + Arp: + type: object + properties: + priorityLevel: + $ref: '#/components/schemas/ArpPriorityLevel' + preemptCap: + $ref: '#/components/schemas/PreemptionCapability' + preemptVuln: + $ref: '#/components/schemas/PreemptionVulnerability' + required: + - priorityLevel + - 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 + Ambr: + type: object + properties: + uplink: + $ref: '#/components/schemas/BitRate' + downlink: + $ref: '#/components/schemas/BitRate' + required: + - uplink + - downlink + AmbrRm: + type: object + properties: + uplink: + $ref: '#/components/schemas/BitRate' + downlink: + $ref: '#/components/schemas/BitRate' + required: + - uplink + - downlink + nullable: true + Dynamic5Qi: + type: object + properties: + resourceType: + $ref: '#/components/schemas/QosResourceType' + priorityLevel: + $ref: '#/components/schemas/5QiPriorityLevel' + packetDelayBudget: + $ref: '#/components/schemas/PacketDelBudget' + packetErrRate: + $ref: '#/components/schemas/PacketErrRate' + averWindow: + $ref: '#/components/schemas/AverWindow' + maxDataBurstVol: + $ref: '#/components/schemas/MaxDataBurstVol' + required: + - resourceType + - priorityLevel + - packetDelayBudget + - packetErrRate + NonDynamic5Qi: + type: object + properties: + priorityLevel: + $ref: '#/components/schemas/5QiPriorityLevel' + averWindow: + $ref: '#/components/schemas/AverWindow' + maxDataBurstVol: + $ref: '#/components/schemas/MaxDataBurstVol' + minProperties: 0 + +# +# Data Types related to 5G Trace as defined in subclause 5.6 +# + +# +# SIMPLE DATA TYPES +# +# +# +# Enumerations +# + TraceDepth: + anyOf: + - type: string + enum: + - MINIMUM + - MEDIUM + - MAXIMUM + - MINIMUM_WO_VENDOR_EXTENSION + - MEDIUM_WO_VENDOR_EXTENSION + - MAXIMUM_WO_VENDOR_EXTENSION + - type: string + TraceDepthRm: + anyOf: + - type: string + enum: + - MINIMUM + - MEDIUM + - MAXIMUM + - MINIMUM_WO_VENDOR_EXTENSION + - MEDIUM_WO_VENDOR_EXTENSION + - MAXIMUM_WO_VENDOR_EXTENSION + - type: string + nullable: true +# +# STRUCTURED DATA TYPES +# + TraceData: + type: object + nullable: true + properties: + traceRef: + type: string + pattern: '^[0-9]{3}[0-9]{2,3}-[A-Fa-f0-9]{6}$' + traceDepth: + $ref: '#/components/schemas/TraceDepth' + neTypeList: + type: string + pattern: '^[A-Fa-f0-9]+$' + eventList: + type: string + pattern: '^[A-Fa-f0-9]+$' + collectionEntityIpv4Addr: + $ref: '#/components/schemas/Ipv4Addr' + collectionEntityIpv6Addr: + $ref: '#/components/schemas/Ipv6Addr' + interfaceList: + type: string + pattern: '^[A-Fa-f0-9]+$' + required: + - traceRef + - traceDepth + - neTypeList + - eventList + + +# Data Types related to 5G ODB as defined in subclause 5.7 + +# +# SIMPLE DATA TYPES +# +# +# +# Enumerations +# + RoamingOdb: + anyOf: + - type: string + enum: + - OUTSIDE_HOME_PLMN + - OUTSIDE_HOME_PLMN_COUNTRY + - type: string + + OdbPacketServices: + anyOf: + - type: string + enum: + - ALL_PACKET_SERVICES + - ROAMER_ACCESS_HPLMN_AP + - ROAMER_ACCESS_VPLMN_AP + - type: string + nullable: true + +# +# STRUCTURED DATA TYPES +# + + OdbData: + type: object + properties: + roamingOdb: + $ref: '#/components/schemas/RoamingOdb' + +# +# Data Types related to Charging as defined in subclause 5.8 +# + +# +# SIMPLE DATA TYPES +# +# + ChargingId: + $ref: '#/components/schemas/Uint32' + + RatingGroup: + $ref: '#/components/schemas/Uint32' + + ServiceId: + $ref: '#/components/schemas/Uint32' + + +# +# Enumerations +# + +# +# STRUCTURED DATA TYPES +# + SecondaryRatUsageReport: + type: object + properties: + secondaryRatType: + $ref: '#/components/schemas/RatType' + qosFlowsUsageData: + type: array + items: + $ref: '#/components/schemas/QosFlowUsageReport' + minItems: 1 + required: + - secondaryRatType + - qosFlowsUsageData + + QosFlowUsageReport: + type: object + properties: + qfi: + $ref: '#/components/schemas/Qfi' + startTimeStamp: + $ref: '#/components/schemas/DateTime' + endTimeStamp: + $ref: '#/components/schemas/DateTime' + downlinkVolume: + $ref: '#/components/schemas/Int64' + uplinkVolume: + $ref: '#/components/schemas/Int64' + required: + - qfi + - startTimeStamp + - endTimeStamp + - downlinkVolume + - uplinkVolume + + SecondaryRatUsageInfo: + type: object + properties: + secondaryRatType: + $ref: '#/components/schemas/RatType' + qosFlowsUsageData: + type: array + items: + $ref: '#/components/schemas/QosFlowUsageReport' + minItems: 1 + pduSessionUsageData: + type: array + items: + $ref: '#/components/schemas/VolumeTimedReport' + minItems: 1 + required: + - secondaryRatType + + VolumeTimedReport: + type: object + properties: + startTimeStamp: + $ref: '#/components/schemas/DateTime' + endTimeStamp: + $ref: '#/components/schemas/DateTime' + downlinkVolume: + $ref: '#/components/schemas/Int64' + uplinkVolume: + $ref: '#/components/schemas/Int64' + required: + - startTimeStamp + - endTimeStamp + - downlinkVolume + - uplinkVolume + + +# +# HTTP responses +# + + responses: + '400': + description: Bad request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '401': + description: Unauthorized + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '405': + description: Method Not Allowed + '408': + description: Request Timeout + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '406': + description: 406 Not Acceptable + '409': + description: Conflict + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '410': + description: Gone + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '411': + description: Length Required + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '412': + description: Precondition Failed + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '413': + description: Payload Too Large + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '414': + description: URI Too Long + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '415': + description: Unsupported Media Type + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '429': + description: Too Many Requests + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '501': + description: Not Implemented + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '504': + description: Gateway Timeout + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + default: + description: Generic Error diff --git a/lib/sbi/support/3gpp-spec/TS29591_Nnef_EventExposure.yaml b/lib/sbi/support/3gpp-spec/TS29591_Nnef_EventExposure.yaml new file mode 100644 index 000000000..ee9b75c4b --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29591_Nnef_EventExposure.yaml @@ -0,0 +1,406 @@ +openapi: 3.0.0 +info: + title: Nnef_EventExposure + version: 1.0.0.alpha-1 + description: | + NEF Event Exposure Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.591 V16.0.0; 5G System; Application Function (AF) event exposure service; Stage 3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.591/ +servers: + - url: '{apiRoot}/nnef-eventexposure/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nnef-eventexposure +paths: + + /subscriptions: + post: + summary: subscribe to notifications + operationId: CreateIndividualSubcription + tags: + - Subscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NefEventExposureSubsc' + responses: + '201': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/NefEventExposureSubsc' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnef-eventexposure/{apiVersion}/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + myNotification: + '{$request.body#/notifUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NefEventExposureNotif' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionId}: + get: + summary: retrieve subscription + operationId: GetIndividualSubcription + tags: + - IndividualSubscription (Document) + parameters: + - name: subscriptionId + in: path + description: Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/NefEventExposureSubsc' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: update subscription + operationId: ReplaceIndividualSubcription + tags: + - IndividualSubscription (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NefEventExposureSubsc' + parameters: + - name: subscriptionId + in: path + description: Event Subscription ID + required: true + schema: + type: string + responses: + '200': + description: OK. Resource was succesfully modified and representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/NefEventExposureSubsc' + '204': + description: No Content. Resource was succesfully modified + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: unsubscribe from notifications + operationId: DeleteIndividualSubcription + tags: + - IndividualSubscription (Document) + parameters: + - name: subscriptionId + in: path + description: Event Subscription ID + required: true + schema: + type: string + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnef-eventexposure: Access to the Nnef_EventExposure API + schemas: + NefEventExposureSubsc: + type: object + properties: + eventsSubs: + type: array + items: + $ref: '#/components/schemas/NefEventSubs' + minItems: 1 + eventsRepInfo: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/EventReportingRequirement' + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + notifId: + type: string + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + rspNotifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + required: + - notifId + - notifUri + - suppFeat + NefEventExposureNotif: + type: object + properties: + notifId: + type: string + eventNotifs: + type: array + items: + $ref: '#/components/schemas/NefEventNotification' + minItems: 1 + required: + - notifId + - eventNotifs + NefEventNotification: + type: object + properties: + event: + $ref: '#/components/schemas/NefEvent' + timeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + svcExprcInfos: + type: array + items: + $ref: '#/components/schemas/ServiceExperienceInfo' + minItems: 1 + ueMobilityInfos: + type: array + items: + $ref: '#/components/schemas/UeMobilityInfo' + minItems: 1 + ueCommInfos: + type: array + items: + $ref: '#/components/schemas/UeCommunicationInfo' + minItems: 1 + excepInfos: + type: array + items: + $ref: 'TS29517_Naf_EventExposure.yaml#/components/schemas/ExceptionInfo' + minItems: 1 + required: + - event + - timeStamp + NefEventSubs: + type: object + properties: + event: + $ref: '#/components/schemas/NefEvent' + eventFilter: + $ref: '#/components/schemas/NefEventFilter' + required: + - event + NefEventFilter: + type: object + properties: + tgtUe: + $ref: '#/components/schemas/TargetUeIdentification' + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + locArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + required: + - tgtUe + TargetUeIdentification: + type: object + properties: + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + interGroupIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + minItems: 1 + anyUeId: + type: boolean + ServiceExperienceInfo: + type: object + properties: + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + minItems: 1 + svcExpPerFlows: + type: array + items: + $ref: 'TS29517_Naf_EventExposure.yaml#/components/schemas/ServiceExperienceInfoPerFlow' + minItems: 1 + required: + - svcExpPerFlows + UeMobilityInfo: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + ueTrajs: + type: array + items: + $ref: '#/components/schemas/UeTrajectoryInfo' + minItems: 1 + required: + - supi + - ueTrajs + UeCommunicationInfo: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + interGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + comms: + type: array + items: + $ref: 'TS29517_Naf_EventExposure.yaml#/components/schemas/CommunicationCollection' + minItems: 1 + required: + - comms + UeTrajectoryInfo: + type: object + properties: + ts: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + location: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + required: + - ts + - location + +# Simple data types and Enumerations + + NefEvent: + anyOf: + - type: string + enum: + - SVC_EXPERIENCE + - UE_MOBILITY + - UE_COMM + - EXCEPTIONS + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29594_Nchf_SpendingLimitControl.yaml b/lib/sbi/support/3gpp-spec/TS29594_Nchf_SpendingLimitControl.yaml new file mode 100644 index 000000000..50b8108d5 --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29594_Nchf_SpendingLimitControl.yaml @@ -0,0 +1,288 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-1 + title: Nchf_SpendingLimitControl + description: | + Nchf Spending Limit Control Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.594 V16.1.0; 5G System; Spending Limit Control Service. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.594/' +servers: + - url: '{apiRoot}/nchf-spendinglimitcontrol/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nchf-spendinglimitcontrol +paths: + /subscriptions: + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SpendingLimitContext' + responses: + '201': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SpendingLimitStatus' + headers: + Location: + description: 'Contains the URI of the created individual spending limit resource, according to the structure: {apiRoot}/nchf-spendinglimitcontrol/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + statusNotification: + '{$request.body#/notifUri}/notify': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SpendingLimitStatus' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + subscriptionTermination: + '{$request.body#/notifUri}/terminate': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionTerminationInfo' + responses: + '204': + description: No Content, Notification was succesfull + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionId}: + parameters: + - in: path + name: subscriptionId + description: Identifies an individual spending limit retrieval subscription. + required: true + schema: + type: string + put: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SpendingLimitContext' + responses: + '200': + description: OK. Resource was succesfully modified and representation is returned + content: + application/json: + schema: + $ref: '#/components/schemas/SpendingLimitStatus' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + responses: + '204': + description: No Content. Resource was succesfully deleted + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nchf-spendinglimitcontrol: Access to the Nchf_SpendingLimitControl API + schemas: + SpendingLimitContext: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + gpsi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + policyCounterIds: + type: array + items: + $ref: '#/components/schemas/PolicyCounterId' + minItems: 1 + description: This is a list of policy counter identifier(s), which identifies policy counters maintained per subscriber within the CHF. + notifUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + SpendingLimitStatus: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + statusInfos: + type: object + additionalProperties: + $ref: '#/components/schemas/PolicyCounterInfo' + minProperties: 1 + description: Status of the requested policy counters. The key of the map is the attribute "policyCounterId". + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + PolicyCounterInfo: + type: object + properties: + policyCounterId: + $ref: '#/components/schemas/PolicyCounterId' + currentStatus: + type: string + description: Identifies the policy counter status applicable for a specific policy counter identified by the policyCounterId. The values (e.g. valid, invalid or any other status) are not specified. The interpretation and actions related to the defined values are out of scope of 3GPP. + penPolCounterStatuses: + type: array + items: + $ref: '#/components/schemas/PendingPolicyCounterStatus' + minItems: 1 + description: Provides the pending policy counter status. + required: + - policyCounterId + - currentStatus + PendingPolicyCounterStatus: + type: object + properties: + policyCounterStatus: + type: string + description: Identifies the policy counter status applicable for a specific policy counter identified by the policyCounterId. The values (e.g. valid, invalid or any other status) are not specified. The interpretation and actions related to the defined values are out of scope of 3GPP. + activationTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - policyCounterStatus + - activationTime + PolicyCounterId: + type: string + description: Identifies a policy counter. + SubscriptionTerminationInfo: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + termCause: + $ref: '#/components/schemas/TerminationCause' + required: + - supi + TerminationCause: + anyOf: + - type: string + enum: + - REMOVED_SUBSCRIBER + - type: string diff --git a/lib/sbi/support/3gpp-spec/TS29675_Nucmf_Provisioning.yaml b/lib/sbi/support/3gpp-spec/TS29675_Nucmf_Provisioning.yaml new file mode 100644 index 000000000..dccafb22d --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS29675_Nucmf_Provisioning.yaml @@ -0,0 +1,282 @@ +openapi: 3.0.0 +info: + title: Nucmf_Provisioning + version: 1.0.0.alpha-3 + description: | + UCMF_Provisioning Service. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.675 V16.0.0; User Equipment (UE) radio capability provisioning service; Stage 3. + url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.675/ +servers: + - url: '{apiRoot}/nucmf-provisioning/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nucmf-provisioning +paths: + /provisionings: + post: + summary: Create an Individual UE radio capability provisioning + operationId: CreateProvisioning + tags: + - UE radio capability provisionings (Collection) + requestBody: + description: create new provisionings for a given SCS/AS. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RacsData' + responses: + '201': + description: Created. The creation of an Individual UE radio capability provisioning resource is confirmed and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsData' + headers: + Location: + description: 'Contains the URI of the newly created resource' + required: true + schema: + type: string + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The RACS data for all RACS IDs were not provisioned successfully. + content: + application/json: + schema: + type: array + items: + $ref: 'TS29122_RacsParameterProvisioning.yaml#/components/schemas/RacsFailureReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + /provisionings/{provisioningId}: + parameters: + - name: provisioningId + in: path + description: Provisioning ID + required: true + schema: + type: string + get: + summary: Get an Individual UE radio capability provisioning + operationId: GetProvisioning + tags: + - Individual UE radio capability provisioning (Document) + responses: + '200': + description: OK. The provisioning information related to the request URI is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29122_CommonData.yaml#/components/responses/406' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + patch: + summary: Update (PATCH) an Individual UE radio capability provisioning + operationId: UpdateProvisioning + tags: + - Individual UE radio capability provisioning (Document) + requestBody: + description: update an existing parameter provisioning. + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/RacsDataPatch' + responses: + '200': + description: OK. The Individual UE radio capability provisioning resource is modified and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The RACS data for all RACS IDs were not provisioned successfully. + content: + application/json: + schema: + type: array + items: + $ref: 'TS29122_RacsParameterProvisioning.yaml#/components/schemas/RacsFailureReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + put: + summary: Replace (PUT) an Individual UE radio capability provisioning + operationId: ReplaceProvisioning + tags: + - Individual UE radio capability provisioning (Document) + requestBody: + description: update an existing parameter provisioning. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RacsData' + responses: + '200': + description: OK. The Individual UE radio capability provisioning resource is modified and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/RacsData' + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29122_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29122_CommonData.yaml#/components/responses/413' + '415': + $ref: 'TS29122_CommonData.yaml#/components/responses/415' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + description: The RACS data for all RACS IDs were not provisioned successfully. + content: + application/json: + schema: + type: array + items: + $ref: 'TS29122_RacsParameterProvisioning.yaml#/components/schemas/RacsFailureReport' + minItems: 1 + application/problem+json: + schema: + $ref: 'TS29122_CommonData.yaml#/components/schemas/ProblemDetails' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' + delete: + summary: Remove an Individual UE radio capability provisioning + operationId: RemoveProvisioning + tags: + - Individual UE radio capability provisioning (Document) + responses: + '204': + description: No Content. The Individual UE radio capability resource was successfully removed. The payload body shall be empty. + '400': + $ref: 'TS29122_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29122_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29122_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29122_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29122_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29122_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29122_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29122_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{tokenUrl}' + scopes: {} + schemas: + RacsData: + type: object + properties: + suppFeat: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + racsConfigs: + type: object + additionalProperties: + $ref: 'TS29122_RacsParameterProvisioning.yaml#/components/schemas/RacsConfigurationRm' + minProperties: 1 + description: Identifies the configuration related to manufacturer specific UE radio capability. Each element uniquely identifies an RACS configuration for an RACS ID and is identified in the map via the RACS ID as key. The response shall include successfully provisioned RACS data. + racsReports: + type: object + additionalProperties: + $ref: 'TS29122_RacsParameterProvisioning.yaml#/components/schemas/RacsFailureReport' + minProperties: 1 + description: Contains the RACS IDs for which the RACS data are not provisioned successfully. The failure reason is also included. + readOnly: true + required: + - racsConfigs + RacsDataPatch: + type: object + properties: + racsConfigs: + type: object + additionalProperties: + $ref: 'TS29122_RacsParameterProvisioning.yaml#/components/schemas/RacsConfigurationRm' + minProperties: 1 + description: Identifies the configuration related to manufacturer specific UE radio capability. Each element uniquely identifies an RACS configuration for an RACS ID and is identified in the map via the RACS ID as key. diff --git a/lib/sbi/support/3gpp-spec/TS32291_Nchf_ConvergedCharging.yaml b/lib/sbi/support/3gpp-spec/TS32291_Nchf_ConvergedCharging.yaml new file mode 100644 index 000000000..14996833f --- /dev/null +++ b/lib/sbi/support/3gpp-spec/TS32291_Nchf_ConvergedCharging.yaml @@ -0,0 +1,1261 @@ +openapi: 3.0.0 +info: + title: Nchf_ConvergedCharging + version: 3.0.0.alpha-2 + description: | + ConvergedCharging Service (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: > + 3GPP TS 32.291 V16.2.0: Telecommunication management; Charging management; + 5G system, charging service; Stage 3. + url: 'http://www.3gpp.org/ftp/Specs/archive/32_series/32.291/' +servers: + - url: '{apiRoot}/nchf-convergedcharging/v2' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +paths: + /chargingdata: + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + responses: + '201': + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + myNotification: + '{$request.body#/notifyUri}': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingNotifyRequest' + responses: + '204': + description: 'No Content, Notification was succesfull' + '400': + description: Bad request + content: + application/json: + schema: + $ref: >- + TS29571_CommonData.yaml#/components/schemas/ProblemDetails + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + '/chargingdata/{ChargingDataRef}/update': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + parameters: + - name: ChargingDataRef + in: path + description: a unique identifier for a charging data resource in a PLMN + required: true + schema: + type: string + responses: + '200': + description: OK. Updated Charging Data resource is returned + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + '/chargingdata/{ChargingDataRef}/release': + post: + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChargingDataRequest' + parameters: + - name: ChargingDataRef + in: path + description: a unique identifier for a charging data resource in a PLMN + required: true + schema: + type: string + responses: + '204': + description: No Content. + '404': + description: Not Found + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '410': + $ref: 'TS29571_CommonData.yaml#/components/responses/410' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '413': + $ref: 'TS29571_CommonData.yaml#/components/responses/413' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + schemas: + ChargingDataRequest: + type: object + properties: + subscriberIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + nfConsumerIdentification: + $ref: '#/components/schemas/NFIdentification' + invocationTimeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + invocationSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + oneTimeEvent: + type: boolean + oneTimeEventType: + $ref: '#/components/schemas/oneTimeEventType' + notifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + serviceSpecificationInfo: + type: string + multipleUnitUsage: + type: array + items: + $ref: '#/components/schemas/MultipleUnitUsage' + minItems: 0 + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + pDUSessionChargingInformation: + $ref: '#/components/schemas/PDUSessionChargingInformation' + roamingQBCInformation: + $ref: '#/components/schemas/RoamingQBCInformation' + sMSChargingInformation: + $ref: '#/components/schemas/SMSChargingInformation' + nEFChargingInformation: + $ref: '#/components/schemas/NEFChargingInformation' + registrationChargingInformation: + $ref: '#/components/schemas/RegistrationChargingInformation' + n2ConnectionChargingInformation: + $ref: '#/components/schemas/N2ConnectionChargingInformation' + locationReportingChargingInformation: + $ref: '#/components/schemas/LocationReportingChargingInformation' + required: + - nfConsumerIdentification + - invocationTimeStamp + - invocationSequenceNumber + ChargingDataResponse: + type: object + properties: + invocationTimeStamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + invocationSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + invocationResult: + $ref: '#/components/schemas/InvocationResult' + sessionFailover: + $ref: '#/components/schemas/SessionFailover' + multipleUnitInformation: + type: array + items: + $ref: '#/components/schemas/MultipleUnitInformation' + minItems: 0 + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + pDUSessionChargingInformation: + $ref: '#/components/schemas/PDUSessionChargingInformation' + roamingQBCInformation: + $ref: '#/components/schemas/RoamingQBCInformation' + required: + - invocationTimeStamp + - invocationSequenceNumber + ChargingNotifyRequest: + type: object + properties: + notificationType: + $ref: '#/components/schemas/NotificationType' + reauthorizationDetails: + type: array + items: + $ref: '#/components/schemas/ReauthorizationDetails' + minItems: 0 + required: + - notificationType + ChargingNotifyResponse: + type: object + properties: + invocationResult: + $ref: '#/components/schemas/InvocationResult' + NFIdentification: + type: object + properties: + nFName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nFIPv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + nFIPv6Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + nFPLMNID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + nodeFunctionality: + $ref: '#/components/schemas/NodeFunctionality' + nFFqdn: + type: string + required: + - nodeFunctionality + MultipleUnitUsage: + type: object + properties: + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + requestedUnit: + $ref: '#/components/schemas/RequestedUnit' + usedUnitContainer: + type: array + items: + $ref: '#/components/schemas/UsedUnitContainer' + minItems: 0 + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + required: + - ratingGroup + InvocationResult: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + failureHandling: + $ref: '#/components/schemas/FailureHandling' + Trigger: + type: object + properties: + triggerType: + $ref: '#/components/schemas/TriggerType' + triggerCategory: + $ref: '#/components/schemas/TriggerCategory' + timeLimit: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + volumeLimit: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + volumeLimit64: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + maxNumberOfccc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + required: + - triggerType + - triggerCategory + MultipleUnitInformation: + type: object + properties: + resultCode: + $ref: '#/components/schemas/ResultCode' + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + grantedUnit: + $ref: '#/components/schemas/GrantedUnit' + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + validityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + quotaHoldingTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + finalUnitIndication: + $ref: '#/components/schemas/FinalUnitIndication' + timeQuotaThreshold: + type: integer + volumeQuotaThreshold: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + unitQuotaThreshold: + type: integer + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + required: + - ratingGroup + RequestedUnit: + type: object + properties: + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + UsedUnitContainer: + type: object + properties: + serviceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceId' + quotaManagementIndicator: + $ref: '#/components/schemas/QuotaManagementIndicator' + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + triggerTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + eventTimeStamps: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + localSequenceNumber: + type: integer + pDUContainerInformation: + $ref: '#/components/schemas/PDUContainerInformation' + required: + - localSequenceNumber + GrantedUnit: + type: object + properties: + tariffTimeChange: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + serviceSpecificUnits: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + FinalUnitIndication: + type: object + properties: + finalUnitAction: + $ref: '#/components/schemas/FinalUnitAction' + restrictionFilterRule: + $ref: '#/components/schemas/IPFilterRule' + filterId: + type: string + redirectServer: + $ref: '#/components/schemas/RedirectServer' + required: + - finalUnitAction + RedirectServer: + type: object + properties: + redirectAddressType: + $ref: '#/components/schemas/RedirectAddressType' + redirectServerAddress: + type: string + required: + - redirectAddressType + - redirectServerAddress + ReauthorizationDetails: + type: object + properties: + serviceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceId' + ratingGroup: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatingGroup' + quotaManagementIndicator: + $ref: '#/components/schemas/QuotaManagementIndicator' + PDUSessionChargingInformation: + type: object + properties: + chargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + homeProvidedChargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + pduSessionInformation: + $ref: '#/components/schemas/PDUSessionInformation' + unitCountInactivityTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + rANSecondaryRATUsageReport: + $ref: '#/components/schemas/RANSecondaryRATUsageReport' + required: + - pduSessionInformation + UserInformation: + type: object + properties: + servedGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + servedPEI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + unauthenticatedFlag: + type: boolean + roamerInOut: + $ref: '#/components/schemas/RoamerInOut' + PDUSessionInformation: + type: object + properties: + networkSlicingInfo: + $ref: '#/components/schemas/NetworkSlicingInfo' + pduSessionID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + pduType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + sscMode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SscMode' + hPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + servingNetworkFunctionID: + $ref: '#/components/schemas/ServingNetworkFunctionID' + ratType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + dnnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + dnnSelectionMode: + $ref: '#/components/schemas/dnnSelectionMode' + chargingCharacteristics: + type: string + chargingCharacteristicsSelectionMode: + $ref: '#/components/schemas/ChargingCharacteristicsSelectionMode' + startTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + stopTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + sessionStopIndicator: + type: boolean + pduAddress: + $ref: '#/components/schemas/PDUAddress' + diagnostics: + $ref: '#/components/schemas/Diagnostics' + authorizedQoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/AuthorizedDefaultQos' + subscribedQoSInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SubscribedDefaultQos' + authorizedSessionAMBR: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + subscribedSessionAMBR: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + servingCNPlmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + required: + - pduSessionID + - dnnId + PDUContainerInformation: + type: object + properties: + timeofFirstUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofLastUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosData' + qoSCharacteristics: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosCharacteristics' + afChargingIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + userLocationInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + servingNodeID: + type: array + items: + $ref: '#/components/schemas/ServingNetworkFunctionID' + minItems: 0 + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + sponsorIdentity: + type: string + applicationserviceProviderIdentity: + type: string + chargingRuleBaseName: + type: string + NetworkSlicingInfo: + type: object + properties: + sNSSAI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + required: + - sNSSAI + PDUAddress: + type: object + properties: + pduIPv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + pduIPv6AddresswithPrefix: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + pduAddressprefixlength: + type: integer + iPv4dynamicAddressFlag: + type: boolean + iPv6dynamicPrefixFlag: + type: boolean + ServingNetworkFunctionID: + type: object + properties: + + servingNetworkFunctionInformation: + $ref: '#/components/schemas/NFIdentification' + aMFId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfId' + required: + - servingNetworkFunctionInformation + RoamingQBCInformation: + type: object + properties: + multipleQFIcontainer: + type: array + items: + $ref: '#/components/schemas/MultipleQFIcontainer' + minItems: 0 + uPFID: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + roamingChargingProfile: + $ref: '#/components/schemas/RoamingChargingProfile' + MultipleQFIcontainer: + type: object + properties: + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + triggerTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + time: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + totalVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + localSequenceNumber: + type: integer + qFIContainerInformation: + $ref: '#/components/schemas/QFIContainerInformation' + required: + - localSequenceNumber + QFIContainerInformation: + type: object + properties: + qFI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + reportTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofFirstUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + timeofLastUsage: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qoSInformation: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosData' + qoSCharacteristics: + $ref: 'TS29512_Npcf_SMPolicyControl.yaml#/components/schemas/QosCharacteristics' + userLocationInformation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + servingNetworkFunctionID: + type: array + items: + $ref: '#/components/schemas/ServingNetworkFunctionID' + minItems: 0 + 3gppPSDataOffStatus: + $ref: '#/components/schemas/3GPPPSDataOffStatus' + 3gppChargingId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChargingId' + diagnostics: + $ref: '#/components/schemas/Diagnostics' + enhancedDiagnostics: + type: array + items: + type: string + required: + - reportTime + RoamingChargingProfile: + type: object + properties: + triggers: + type: array + items: + $ref: '#/components/schemas/Trigger' + minItems: 0 + partialRecordMethod: + $ref: '#/components/schemas/PartialRecordMethod' + SMSChargingInformation: + type: object + properties: + originatorInfo: + $ref: '#/components/schemas/OriginatorInfo' + recipientInfo: + type: array + items: + $ref: '#/components/schemas/RecipientInfo' + minItems: 0 + userEquipmentInfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + sMSCAddress: + type: string + sMDataCodingScheme: + type: integer + sMMessageType: + $ref: '#/components/schemas/SMMessageType' + sMReplyPathRequested: + $ref: '#/components/schemas/ReplyPathRequested' + sMUserDataHeader: + type: string + sMStatus: + type: string + sMDischargeTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + numberofMessagesSent: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + sMServiceType: + $ref: '#/components/schemas/SMServiceType' + sMSequenceNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + sMSresult: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + submissionTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + sMPriority: + $ref: '#/components/schemas/SMPriority' + messageReference: + type: string + messageSize: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + messageClass: + $ref: '#/components/schemas/MessageClass' + deliveryReportRequested: + $ref: '#/components/schemas/DeliveryReportRequested' + OriginatorInfo: + type: object + properties: + originatorSUPI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + originatorGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + originatorOtherAddress: + $ref: '#/components/schemas/SMAddressInfo' + originatorReceivedAddress: + $ref: '#/components/schemas/SMAddressInfo' + originatorSCCPAddress: + type: string + sMOriginatorInterface: + $ref: '#/components/schemas/SMInterface' + sMOriginatorProtocolId: + type: string + RecipientInfo: + type: object + properties: + recipientSUPI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + recipientGPSI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + recipientOtherAddress: + $ref: '#/components/schemas/SMAddressInfo' + recipientReceivedAddress: + $ref: '#/components/schemas/SMAddressInfo' + recipientSCCPAddress: + type: string + sMDestinationInterface: + $ref: '#/components/schemas/SMInterface' + sMrecipientProtocolId: + type: string + SMAddressInfo: + type: object + properties: + sMaddressType: + $ref: '#/components/schemas/SMAddressType' + sMaddressData: + type: string + sMaddressDomain: + $ref: '#/components/schemas/SMAddressDomain' + RecipientAddress: + type: object + properties: + recipientAddressInfo: + $ref: '#/components/schemas/SMAddressInfo' + sMaddresseeType: + $ref: '#/components/schemas/SMAddresseeType' + MessageClass: + type: object + properties: + classIdentifier: + $ref: '#/components/schemas/ClassIdentifier' + tokenText: + type: string + SMAddressDomain: + type: object + properties: + domainName: + type: string + 3GPPIMSIMCCMNC: + type: string + SMInterface: + type: object + properties: + interfaceId: + type: string + interfaceText: + type: string + interfacePort: + type: string + interfaceType: + $ref: '#/components/schemas/InterfaceType' + RANSecondaryRATUsageReport: + type: object + properties: + rANSecondaryRATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + qosFlowsUsageReports: + type: array + items: + $ref: '#/components/schemas/QosFlowsUsageReport' + Diagnostics: + type: integer + IPFilterRule: + type: string + QosFlowsUsageReport: + type: object + properties: + qFI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Qfi' + startTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTimestamp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + uplinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + downlinkVolume: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint64' + NEFChargingInformation: + type: object + properties: + groupIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + aPIDirection: + $ref: '#/components/schemas/APIDirection' + aPITargetNetworkFunction: + $ref: '#/components/schemas/NFIdentification' + aPIResultCode: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + aPIName: + type: string + aPIReference: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + aPIContent: + type: string + required: + - aPIName + RegistrationChargingInformation: + type: object + properties: + registrationMessagetype: + $ref: '#/components/schemas/RegistrationMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + 5GMMCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + mICOModeIndication: + $ref: '#/components/schemas/MICOModeIndication' + smsIndication: + $ref: '#/components/schemas/SmsIndication' + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 0 + serviceAreaRestriction: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + minItems: 0 + requestedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + allowedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + rejectedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + required: + - registrationMessagetype + N2ConnectionChargingInformation: + type: object + properties: + n2ConnectionMessageType: + $ref: '#/components/schemas/N2ConnectionMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + amfUeNgapId: + type: integer + ranUeNgapId: + type: integer + ranNodeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + restrictedRatList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 0 + forbiddenAreaList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Area' + minItems: 0 + serviceAreaRestriction: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + minItems: 0 + restrictedCnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CoreNetworkType' + minItems: 0 + allowedNSSAI: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 0 + rrcEstCause: + type: string + pattern: '^[0-9a-fA-F]+$' + required: + - n2ConnectionMessageType + LocationReportingChargingInformation: + type: object + properties: + locationReportingMessageType: + $ref: '#/components/schemas/LocationReportingMessageType' + userInformation: + $ref: '#/components/schemas/UserInformation' + userLocationinfo: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + uetimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + rATType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + presenceReportingAreaInformation: + type: object + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo' + minProperties: 0 + required: + - locationReportingMessageType + N2ConnectionMessageType: + type: integer + LocationReportingMessageType: + type: integer + NotificationType: + anyOf: + - type: string + enum: + - REAUTHORIZATION + - ABORT_CHARGING + - type: string + NodeFunctionality: + anyOf: + - type: string + enum: + - SMF + - SMSF + - SGW + - I_SMF + - type: string + ChargingCharacteristicsSelectionMode: + anyOf: + - type: string + enum: + - HOME_DEFAULT + - ROAMING_DEFAULT + - VISITING_DEFAULT + - type: string + TriggerType: + anyOf: + - type: string + enum: + - QUOTA_THRESHOLD + - QHT + - FINAL + - QUOTA_EXHAUSTED + - VALIDITY_TIME + - OTHER_QUOTA_TYPE + - FORCED_REAUTHORISATION + - UNUSED_QUOTA_TIMER # Included for backwards compatibility, shall not be used + - UNIT_COUNT_INACTIVITY_TIMER + - ABNORMAL_RELEASE + - QOS_CHANGE + - VOLUME_LIMIT + - TIME_LIMIT + - PLMN_CHANGE + - USER_LOCATION_CHANGE + - RAT_CHANGE + - SESSION_AMBR_CHANGE + - UE_TIMEZONE_CHANGE + - TARIFF_TIME_CHANGE + - MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS + - MANAGEMENT_INTERVENTION + - CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA + - CHANGE_OF_3GPP_PS_DATA_OFF_STATUS + - SERVING_NODE_CHANGE + - REMOVAL_OF_UPF + - ADDITION_OF_UPF + - INSERTION_OF_ISMF + - REMOVAL_OF_ISMF + - CHANGE_OF_ISMF + - START_OF_SERVICE_DATA_FLOW + - ECGI_CHANGE + - TAI_CHANGE + - HANDOVER_CANCEL + - HANDOVER_START + - HANDOVER_COMPLETE + - GFBR_GUARANTEED_STATUS_CHANGE + - type: string + FinalUnitAction: + anyOf: + - type: string + enum: + - TERMINATE + - REDIRECT + - RESTRICT_ACCESS + - type: string + RedirectAddressType: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - URL + - type: string + TriggerCategory: + anyOf: + - type: string + enum: + - IMMEDIATE_REPORT + - DEFERRED_REPORT + - type: string + QuotaManagementIndicator: + anyOf: + - type: string + enum: + - ONLINE_CHARGING + - OFFLINE_CHARGING + - type: string + FailureHandling: + anyOf: + - type: string + enum: + - TERMINATE + - CONTINUE + - RETRY_AND_TERMINATE + - type: string + SessionFailover: + anyOf: + - type: string + enum: + - FAILOVER_NOT_SUPPORTED + - FAILOVER_SUPPORTED + - type: string + 3GPPPSDataOffStatus: + anyOf: + - type: string + enum: + - ACTIVE + - INACTIVE + - type: string + ResultCode: + anyOf: + - type: string + enum: + - SUCCESS + - END_USER_SERVICE_DENIED + - QUOTA_MANAGEMENT_NOT_APPLICABLE + - QUOTA_LIMIT_REACHED + - END_USER_SERVICE_REJECTED + - USER_UNKNOWN + - RATING_FAILED + - type: string + PartialRecordMethod: + anyOf: + - type: string + enum: + - DEFAULT + - INDIVIDUAL + - type: string + RoamerInOut: + anyOf: + - type: string + enum: + - IN_BOUND + - OUT_BOUND + - type: string + SMMessageType: + anyOf: + - type: string + enum: + - SUBMISSION + - DELIVERY_REPORT + - SM_SERVICE_REQUEST + - type: string + SMPriority: + anyOf: + - type: string + enum: + - LOW + - NORMAL + - HIGH + - type: string + DeliveryReportRequested: + anyOf: + - type: string + enum: + - YES + - NO + - type: string + InterfaceType: + anyOf: + - type: string + enum: + - UNKNOWN + - MOBILE_ORIGINATING + - MOBILE_TERMINATING + - APPLICATION_ORIGINATING + - APPLICATION_TERMINATING + - type: string + ClassIdentifier: + anyOf: + - type: string + enum: + - PERSONAL + - ADVERTISEMENT + - INFORMATIONAL + - AUTO + - type: string + SMAddressType: + anyOf: + - type: string + enum: + - EMAIL_ADDRESS + - MSISDN + - IPV4_ADDRESS + - IPV6_ADDRESS + - NUMERIC_SHORTCODE + - ALPHANUMERIC_SHORTCODE + - OTHER + - IMSI + - type: string + SMAddresseeType: + anyOf: + - type: string + enum: + - TO + - CC + - BCC + - type: string + SMServiceType: + anyOf: + - type: string + enum: + - VAS4SMS_SHORT_MESSAGE_CONTENT_PROCESSING + - VAS4SMS_SHORT_MESSAGE_FORWARDING + - VAS4SMS_SHORT_MESSAGE_FORWARDING_MULTIPLE_SUBSCRIPTIONS + - VAS4SMS_SHORT_MESSAGE_FILTERING + - VAS4SMS_SHORT_MESSAGE_RECEIPT + - VAS4SMS_SHORT_MESSAGE_NETWORK_STORAGE + - VAS4SMS_SHORT_MESSAGE_TO_MULTIPLE_DESTINATIONS + - VAS4SMS_SHORT_MESSAGE_VIRTUAL_PRIVATE_NETWORK(VPN) + - VAS4SMS_SHORT_MESSAGE_AUTO_REPLY + - VAS4SMS_SHORT_MESSAGE_PERSONAL_SIGNATURE + - VAS4SMS_SHORT_MESSAGE_DEFERRED_DELIVERY + - type: string + ReplyPathRequested: + anyOf: + - type: string + enum: + - NO_REPLY_PATH_SET + - REPLY_PATH_SET + - type: string + oneTimeEventType: + anyOf: + - type: string + enum: + - IEC + - PEC + - type: string + dnnSelectionMode: + anyOf: + - type: string + enum: + - VERIFIED + - UE_DNN_NOT_VERIFIED + - NW_DNN_NOT_VERIFIED + - type: string + APIDirection: + anyOf: + - type: string + enum: + - INVOCATION + - NOTIFICATION + - type: string + RegistrationMessageType: + anyOf: + - type: string + enum: + - INITIAL + - MOBILITY + - PERIODIC + - EMERGENCY + - DEREGISTRATION + - type: string + MICOModeIndication: + anyOf: + - type: string + enum: + - MICO_MODE + - NO_MICO_MODE + - type: string + SmsIndication: + anyOf: + - type: string + enum: + - SMS_SUPPORTED + - SMS_NOT_SUPPORTED + - type: string diff --git a/lib/sbi/support/README.md b/lib/sbi/support/README.md new file mode 100644 index 000000000..e41f0dd31 --- /dev/null +++ b/lib/sbi/support/README.md @@ -0,0 +1,11 @@ + +* Install JDK, maven, cmake and uncrustify +$ sudo apt install default-jdk maven cmake uncrustify + +* Using Source Code +$ git clone https://github.com/OpenAPITools/openapi-generator.git +$ cd openapi-generator +$ mvn clean package + +* Using NPM +$ npm install @openapitools/openapi-generator-cli -g diff --git a/lib/sbi/support/generator.sh b/lib/sbi/support/generator.sh new file mode 100755 index 000000000..98f0f2398 --- /dev/null +++ b/lib/sbi/support/generator.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export C_POST_PROCESS_FILE="/usr/bin/uncrustify --no-backup" +export UNCRUSTIFY_CONFIG=../openapi/.openapi-generator/uncrustify.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/TS29510_Nnrf_NFDiscovery.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi +$openapi_generator_cli generate -i ./modified/TS29510_Nnrf_NFManagement.yaml -c ../openapi/.openapi-generator/config.yaml -g c -o ../openapi diff --git a/lib/sbi/support/modified/TS29510_Nnrf_NFDiscovery.yaml b/lib/sbi/support/modified/TS29510_Nnrf_NFDiscovery.yaml new file mode 100644 index 000000000..377e9fbe7 --- /dev/null +++ b/lib/sbi/support/modified/TS29510_Nnrf_NFDiscovery.yaml @@ -0,0 +1,691 @@ +openapi: 3.0.0 +info: + version: '1.1.0.alpha-1' + title: 'NRF NFDiscovery Service' + description: | + NRF NFDiscovery Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +servers: + - url: '{apiRoot}/nnrf-disc/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nnrf-disc +paths: + /nf-instances: + get: + summary: Search a collection of NF Instances + operationId: SearchNFInstances + tags: + - NF Instances (Store) + parameters: + - name: target-nf-type + in: query + description: Type of the target NF + required: true + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + - name: requester-nf-type + in: query + description: Type of the requester NF + required: true + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + - name: requester-nf-instance-id + in: query + description: NfInstanceId of the requester NF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: service-names + in: query + description: Names of the services offered by the NF + schema: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + minItems: 1 + uniqueItems: true + style: form + explode: false + - name: requester-nf-instance-fqdn + in: query + description: FQDN of the requester NF + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: target-plmn-list + in: query + description: Id of the PLMN of the target NF + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + - name: requester-plmn-list + in: query + description: Id of the PLMN where the NF issuing the Discovery request is located + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + - name: target-nf-instance-id + in: query + description: Identity of the NF instance being discovered + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: target-nf-fqdn + in: query + description: FQDN of the NF instance being discovered + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: hnrf-uri + in: query + description: Uri of the home NRF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + - name: snssais + in: query + description: Slice info of the target NF + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + - name: requester-snssais + in: query + description: Slice info of the requester NF + content: + application/json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + - name: plmn-specific-snssai-list + in: query + description: PLMN specific Slice info of the target NF + 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 + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + - name: nsi-list + in: query + description: NSI IDs that are served by the services being discovered + schema: + type: array + items: + type: string + minItems: 1 + style: form + explode: false + - name: smf-serving-area + in: query + schema: + type: string + - name: tai + in: query + description: Tracking Area Identity + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + - name: amf-region-id + in: query + description: AMF Region Identity + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfRegionId' + - name: amf-set-id + in: query + description: AMF Set Identity + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfSetId' + - name: guami + in: query + description: Guami used to search for an appropriate AMF + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + - name: supi + in: query + description: SUPI of the user + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + - name: ue-ipv4-address + in: query + description: IPv4 address of the UE + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + - name: ip-domain + in: query + description: IP domain of the UE, which supported by BSF + schema: + type: string + - name: ue-ipv6-prefix + in: query + description: IPv6 prefix of the UE + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + - name: pgw-ind + in: query + description: Combined PGW-C and SMF or a standalone SMF + schema: + type: boolean + - name: pgw + in: query + description: PGW FQDN of a combined PGW-C and SMF + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + - name: gpsi + in: query + description: GPSI of the user + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + - name: external-group-identity + in: query + description: external group identifier of the user + schema: + type: string + - name: data-set + in: query + description: data set supported by the NF + schema: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DataSetId' + - name: routing-indicator + in: query + description: routing indicator in SUCI + schema: + type: string + pattern: '^[0-9]{1,4}$' + - name: group-id-list + in: query + description: Group IDs of the NFs being discovered + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + minItems: 1 + style: form + explode: false + - name: dnai-list + in: query + description: Data network access identifiers of the NFs being discovered + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + style: form + explode: false + - name: pdu-session-types + in: query + description: list of PDU Session Type required to be supported by the target NF + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + minItems: 1 + style: form + explode: false + - name: event-id-list + in: query + description: Analytics event(s) requested to be supported by the Nnwdaf_AnalyticsInfo service + schema: + type: array + items: + $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/EventId' + minItems: 1 + style: form + explode: false + - name: nwdaf-event-list + in: query + description: Analytics event(s) requested to be supported by the Nnwdaf_EventsSubscription service. + schema: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NwdafEvent' + minItems: 1 + style: form + explode: false + - name: supported-features + in: query + description: Features required to be supported by the target NF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: upf-iwk-eps-ind + in: query + description: UPF supporting interworking with EPS or not + schema: + type: boolean + - name: chf-supported-plmn + in: query + description: PLMN ID supported by a CHF + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + - name: preferred-locality + in: query + description: preferred target NF location + schema: + type: string + - name: access-type + in: query + description: AccessType supported by the target NF + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + - name: limit + in: query + description: Maximum number of NFProfiles to return in the response + required: false + schema: + type: integer + minimum: 1 + - name: required-features + in: query + description: Features required to be supported by the target NF + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + minItems: 1 + style: form + explode: false + - name: complex-query + in: query + description: the complex query condition expression + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ComplexQuery' + - name: max-payload-size + in: query + description: Maximum payload size of the response expressed in kilo octets + required: false + schema: + type: integer + maximum: 2000 + default: 124 + - name: atsss-capability + in: query + description: ATSSS Capability + content: + application/json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AtsssCapability' + - name: upf-ue-ip-addr-ind + in: query + description: UPF supporting allocating UE IP addresses/prefixes + schema: + type: boolean + - name: If-None-Match + in: header + description: Validator for conditional requests, as described in IETF RFC 7232, 3.2 + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/SearchResult' + links: + search: + operationId: RetrieveStoredSearch + parameters: + searchId: $response.body#/searchId + description: > + The 'searchId' parameter returned in the response can be used as the + 'searchId' parameter in the GET request to '/searches/{searchId}' + completeSearch: + operationId: RetrieveCompleteSearch + parameters: + searchId: $response.body#/searchId + description: > + The 'searchId' parameter returned in the response can be used as the + 'searchId' parameter in the GET request to '/searches/{searchId}/complete' + headers: + Cache-Control: + description: Cache-Control containing max-age, described in IETF RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag containing a strong validator, described in IETF RFC 7232, 2.3 + schema: + type: string + '307': + description: Temporary Redirect + 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': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + + /searches/{searchId}: + get: + operationId: RetrieveStoredSearch + tags: + - Stored Search (Document) + parameters: + - $ref: '#/components/parameters/searchId' + responses: + '200': + $ref: '#/components/responses/200' + + /searches/{searchId}/complete: + get: + operationId: RetrieveCompleteSearch + tags: + - Complete Stored Search (Document) + parameters: + - $ref: '#/components/parameters/searchId' + responses: + '200': + $ref: '#/components/responses/200' + +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '/oauth2/token' + scopes: + nnrf-disc: Access to the Nnrf_NFDiscovery API + parameters: + searchId: + name: searchId + in: path + description: Id of a stored search + required: true + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/StoredSearchResult' + headers: + Cache-Control: + description: Cache-Control containing max-age, described in IETF RFC 7234, 5.2 + schema: + type: string + ETag: + description: Entity Tag containing a strong validator, described in IETF RFC 7232, 2.3 + schema: + type: string + schemas: + SearchResult: + type: object + required: + - nfInstances + properties: + validityPeriod: + type: integer + nfInstances: + type: array + items: + $ref: '#/components/schemas/NFProfile' + searchId: + type: string + numNfInstComplete: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint32' + nrfSupportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + StoredSearchResult: + type: object + required: + - nfInstances + properties: + nfInstances: + type: array + items: + $ref: '#/components/schemas/NFProfile' + NFProfile: + type: object + required: + - nfInstanceId + - nfType + - nfStatus + properties: + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nfInstanceName: + type: string + nfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + nfStatus: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFStatus' + plmnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + sNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + perPlmnSnssaiList: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' + minItems: 1 + nsiList: + type: array + items: + type: string + minItems: 1 + fqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + ipv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + locality: + type: string + priority: + type: integer + minimum: 0 + maximum: 65535 + udrInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' + udrInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdrInfo' + minItems: 1 + udmInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' + udmInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UdmInfo' + minItems: 1 + ausfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' + ausfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AusfInfo' + minItems: 1 + amfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' + amfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/AmfInfo' + minItems: 1 + smfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' + smfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/SmfInfo' + minItems: 1 + upfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' + upfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/UpfInfo' + minItems: 1 + pcfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' + pcfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PcfInfo' + minItems: 1 + bsfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' + bsfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/BsfInfo' + minItems: 1 + chfInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' + chfInfoExt: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfInfo' + minItems: 1 + nwdafInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NwdafInfo' + customInfo: + type: object + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + nfServicePersistence: + type: boolean + default: false + nfServices: + type: array + items: + $ref: '#/components/schemas/NFService' + minItems: 1 + defaultNotificationSubscriptions: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DefaultNotificationSubscription' + NFService: + type: object + required: + - serviceInstanceId + - serviceName + - versions + - scheme + - nfServiceStatus + properties: + serviceInstanceId: + type: string + serviceName: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + versions: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceVersion' + minItems: 1 + scheme: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UriScheme' + nfServiceStatus: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFServiceStatus' + fqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + ipEndPoints: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/IpEndPoint' + minItems: 1 + apiPrefix: + type: string + defaultNotificationSubscriptions: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DefaultNotificationSubscription' + minItems: 1 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + priority: + type: integer + minimum: 0 + maximum: 65535 + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + chfServiceInfo: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ChfServiceInfo' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' +externalDocs: + description: 3GPP TS 29.510 V15.3.0; 5G System; Network Function Repository Services; Stage 3 + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' diff --git a/lib/sbi/support/modified/TS29510_Nnrf_NFManagement.yaml b/lib/sbi/support/modified/TS29510_Nnrf_NFManagement.yaml new file mode 100644 index 000000000..3f7b2a134 --- /dev/null +++ b/lib/sbi/support/modified/TS29510_Nnrf_NFManagement.yaml @@ -0,0 +1,1616 @@ +openapi: 3.0.0 +info: + version: '1.1.0.alpha-1' + title: 'NRF NFManagement Service' + description: | + NRF NFManagement Service. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +servers: + - url: '{apiRoot}/nnrf-nfm/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501 +security: + - {} + - oAuth2ClientCredentials: + - nnrf-nfm +paths: + /nf-instances: + get: + summary: Retrieves a collection of NF Instances + operationId: GetNFInstances + tags: + - NF Instances (Store) + parameters: + - name: nf-type + in: query + description: Type of NF + required: false + schema: + $ref: '#/components/schemas/NFType' + - name: limit + in: query + description: How many items to return at one time + required: false + schema: + type: integer + responses: + '200': + description: Expected response to a valid request + content: + application/3gppHal+json: + schema: + type: object + properties: + _links: + type: object + description: 'List of the URI of NF instances. It has two members whose names are item and self. The item one contains an array of URIs.' + additionalProperties: + $ref: 'TS29571_CommonData.yaml#/components/schemas/LinksValueSchema' + minProperties: 1 + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + options: + summary: Discover communication options supported by NRF for NF Instances + operationId: OptionsNFInstances + tags: + - NF Instances (Store) + responses: + '200': + description: OK + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '405': + $ref: 'TS29571_CommonData.yaml#/components/responses/405' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /nf-instances/{nfInstanceID}: + get: + summary: Read the profile of a given NF Instance + operationId: GetNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + description: Unique ID of the NF Instance + required: true + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Register a new NF Instance + operationId: RegisterNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + required: true + description: Unique ID of the NF Instance to register + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + - name: Content-Encoding + in: header + description: Content-Encoding, described in IETF RFC 7231 + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + required: true + responses: + '200': + description: OK (Profile Replacement) + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + headers: + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '201': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnrf-nfm/v1/nf-instances/{nfInstanceId}' + required: true + schema: + type: string + Accept-Encoding: + description: Accept-Encoding, described in IETF RFC 7694 + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + patch: + summary: Update NF Instance profile + operationId: UpdateNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + required: true + description: Unique ID of the NF Instance to update + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + minItems: 1 + required: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/NFProfile' + '204': + description: Expected response with empty body + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deregisters a given NF Instance + operationId: DeregisterNFInstance + tags: + - NF Instance ID (Document) + parameters: + - name: nfInstanceID + in: path + required: true + description: Unique ID of the NF Instance to deregister + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + responses: + '204': + description: Expected response to a successful deregistration + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '411': + $ref: 'TS29571_CommonData.yaml#/components/responses/411' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions: + post: + summary: Create a new subscription + operationId: CreateSubscription + tags: + - Subscriptions (Collection) + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + required: true + responses: + '201': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnrf-nfm/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + onNFStatusEvent: + '{$request.body#/nfStatusNotificationUri}': + post: + requestBody: + description: Notification Payload + content: + application/json: + schema: + $ref: '#/components/schemas/NotificationData' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionID}: + patch: + summary: Updates a subscription + operationId: UpdateSubscription + tags: + - Subscription ID (Document) + parameters: + - name: subscriptionID + in: path + required: true + description: Unique ID of the subscription to update + schema: + type: string + pattern: '^([0-9]{5,6}-)?[^-]+$' + requestBody: + content: + application/json-patch+json: + schema: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem' + required: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + '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' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + delete: + summary: Deletes a subscription + operationId: RemoveSubscription + tags: + - Subscription ID (Document) + parameters: + - name: subscriptionID + in: path + required: true + description: Unique ID of the subscription to remove + schema: + type: string + pattern: '^([0-9]{5,6}-)?[^-]+$' + responses: + '204': + description: Expected response to a successful subscription removal + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '/oauth2/token' + scopes: + nnrf-nfm: Access to the Nnrf_NFManagement API + schemas: + NFProfile: + type: object + required: + - nfInstanceId + - nfType + - nfStatus + anyOf: + - required: [ fqdn ] + - required: [ ipv4Addresses ] + - required: [ ipv6Addresses ] + properties: + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nfInstanceName: + type: string + nfType: + $ref: '#/components/schemas/NFType' + nfStatus: + $ref: '#/components/schemas/NFStatus' + heartBeatTimer: + type: integer + plmnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + sNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + perPlmnSnssaiList: + type: array + items: + $ref: '#/components/schemas/PlmnSnssai' + minItems: 1 + nsiList: + type: array + items: + type: string + minItems: 1 + fqdn: + $ref: '#/components/schemas/Fqdn' + interPlmnFqdn: + $ref: '#/components/schemas/Fqdn' + ipv4Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6Addresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + allowedPlmns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + allowedNfTypes: + type: array + items: + $ref: '#/components/schemas/NFType' + minItems: 1 + allowedNfDomains: + type: array + items: + type: string + minItems: 1 + allowedNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + priority: + type: integer + minimum: 0 + maximum: 65535 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + locality: + type: string + udrInfo: + $ref: '#/components/schemas/UdrInfo' + udrInfoExt: + type: array + items: + $ref: '#/components/schemas/UdrInfo' + minItems: 1 + udmInfo: + $ref: '#/components/schemas/UdmInfo' + udmInfoExt: + type: array + items: + $ref: '#/components/schemas/UdmInfo' + minItems: 1 + ausfInfo: + $ref: '#/components/schemas/AusfInfo' + ausfInfoExt: + type: array + items: + $ref: '#/components/schemas/AusfInfo' + minItems: 1 + amfInfo: + $ref: '#/components/schemas/AmfInfo' + amfInfoExt: + type: array + items: + $ref: '#/components/schemas/AmfInfo' + minItems: 1 + smfInfo: + $ref: '#/components/schemas/SmfInfo' + smfInfoExt: + type: array + items: + $ref: '#/components/schemas/SmfInfo' + minItems: 1 + upfInfo: + $ref: '#/components/schemas/UpfInfo' + upfInfoExt: + type: array + items: + $ref: '#/components/schemas/UpfInfo' + minItems: 1 + pcfInfo: + $ref: '#/components/schemas/PcfInfo' + pcfInfoExt: + type: array + items: + $ref: '#/components/schemas/PcfInfo' + minItems: 1 + bsfInfo: + $ref: '#/components/schemas/BsfInfo' + bsfInfoExt: + type: array + items: + $ref: '#/components/schemas/BsfInfo' + minItems: 1 + chfInfo: + $ref: '#/components/schemas/ChfInfo' + chfInfoExt: + type: array + items: + $ref: '#/components/schemas/ChfInfo' + minItems: 1 + nrfInfo: + $ref: '#/components/schemas/NrfInfo' + nwdafInfo: + $ref: '#/components/schemas/NwdafInfo' + customInfo: + type: object + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + nfServicePersistence: + type: boolean + default: false + nfServices: + type: array + items: + $ref: '#/components/schemas/NFService' + minItems: 1 + nfProfileChangesSupportInd: + type: boolean + default: false + writeOnly: true + nfProfileChangesInd: + type: boolean + default: false + readOnly: true + defaultNotificationSubscriptions: + type: array + items: + $ref: '#/components/schemas/DefaultNotificationSubscription' + NFService: + type: object + required: + - serviceInstanceId + - serviceName + - versions + - scheme + - nfServiceStatus + properties: + serviceInstanceId: + type: string + serviceName: + $ref: '#/components/schemas/ServiceName' + versions: + type: array + items: + $ref: '#/components/schemas/NFServiceVersion' + minItems: 1 + scheme: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UriScheme' + nfServiceStatus: + $ref: '#/components/schemas/NFServiceStatus' + fqdn: + $ref: '#/components/schemas/Fqdn' + interPlmnFqdn: + $ref: '#/components/schemas/Fqdn' + ipEndPoints: + type: array + items: + $ref: '#/components/schemas/IpEndPoint' + minItems: 1 + apiPrefix: + type: string + defaultNotificationSubscriptions: + type: array + items: + $ref: '#/components/schemas/DefaultNotificationSubscription' + minItems: 1 + allowedPlmns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + minItems: 1 + allowedNfTypes: + type: array + items: + $ref: '#/components/schemas/NFType' + minItems: 1 + allowedNfDomains: + type: array + items: + type: string + minItems: 1 + allowedNssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + priority: + type: integer + minimum: 0 + maximum: 65535 + capacity: + type: integer + minimum: 0 + maximum: 65535 + load: + type: integer + minimum: 0 + maximum: 100 + recoveryTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + chfServiceInfo: + $ref: '#/components/schemas/ChfServiceInfo' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + NFType: +# anyOf: +# - type: string + enum: + - NRF + - UDM + - AMF + - SMF + - AUSF + - NEF + - PCF + - SMSF + - NSSF + - UDR + - LMF + - GMLC + - 5G_EIR + - SEPP + - UPF + - N3IWF + - AF + - UDSF + - BSF + - CHF + - NWDAF + type: string + Fqdn: + type: string + IpEndPoint: + type: object + properties: + ipv4Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Address: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + transport: + $ref: '#/components/schemas/TransportProtocol' + port: + type: integer + minimum: 0 + maximum: 65535 + SubscriptionData: + type: object + required: + - nfStatusNotificationUri +# - subscriptionId + properties: + nfStatusNotificationUri: + type: string + reqNfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' +# subscrCond: +# oneOf: +# - $ref: '#/components/schemas/NfInstanceIdCond' +# - $ref: '#/components/schemas/NfTypeCond' +# - $ref: '#/components/schemas/ServiceNameCond' +# - $ref: '#/components/schemas/AmfCond' +# - $ref: '#/components/schemas/GuamiListCond' +# - $ref: '#/components/schemas/NetworkSliceCond' +# - $ref: '#/components/schemas/NfGroupCond' + subscriptionId: + type: string + pattern: '^([0-9]{5,6}-)?[^-]+$' + readOnly: true + validityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + reqNotifEvents: + type: array + items: + $ref: '#/components/schemas/NotificationEventType' + minItems: 1 + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + notifCondition: + $ref: '#/components/schemas/NotifCondition' + reqNfType: + $ref: '#/components/schemas/NFType' + reqNfFqdn: + $ref: '#/components/schemas/Fqdn' + reqSnssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + NfInstanceIdCond: + type: object + required: + - nfInstanceId + properties: + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + NfTypeCond: + type: object + required: + - nfType + not: + required: [ nfGroupId ] + properties: + nfType: + $ref: '#/components/schemas/NFType' + ServiceNameCond: + type: object + required: + - serviceName + properties: + serviceName: + $ref: '#/components/schemas/ServiceName' + AmfCond: + type: object + anyOf: + - required: [ amfSetId ] + - required: [ amfRegionId ] + properties: + amfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfSetId' + amfRegionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfRegionId' + GuamiListCond: + type: object + required: + - guamiList + properties: + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + NetworkSliceCond: + type: object + required: + - snssaiList + properties: + snssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + nsiList: + type: array + items: + type: string + NfGroupCond: + type: object + required: + - nfType + - nfGroupId + properties: + nfType: + type: string + enum: + - UDM + - AUSF + - UDR + - PCF + nfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + NotifCondition: + type: object + not: + required: [ monitoredAttributes, unmonitoredAttributes ] + properties: + monitoredAttributes: + type: array + items: + type: string + minItems: 1 + unmonitoredAttributes: + type: array + items: + type: string + minItems: 1 + UdrInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + externalGroupIdentifiersRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + supportedDataSets: + type: array + items: + $ref: '#/components/schemas/DataSetId' + minItems: 1 + SupiRange: + type: object + properties: + start: + type: string + pattern: '^[0-9]+$' + end: + type: string + pattern: '^[0-9]+$' + pattern: + type: string + IdentityRange: + type: object + properties: + start: + type: string + pattern: '^[0-9]+$' + end: + type: string + pattern: '^[0-9]+$' + pattern: + type: string + DataSetId: + anyOf: + - type: string + enum: + - SUBSCRIPTION + - POLICY + - EXPOSURE + - APPLICATION + - type: string + UdmInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + externalGroupIdentifiersRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + routingIndicators: + type: array + items: + type: string + pattern: '^[0-9]{1,4}$' + minItems: 1 + AusfInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + routingIndicators: + type: array + items: + type: string + pattern: '^[0-9]{1,4}$' + minItems: 1 + AmfInfo: + type: object + required: + - amfSetId + - amfRegionId + - guamiList + properties: + amfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfSetId' + amfRegionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfRegionId' + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: '#/components/schemas/TaiRange' + minItems: 1 + backupInfoAmfFailure: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + backupInfoAmfRemoval: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + n2InterfaceAmfInfo: + $ref: '#/components/schemas/N2InterfaceAmfInfo' + SmfInfo: + type: object + required: + - sNssaiSmfInfoList + properties: + sNssaiSmfInfoList: + type: array + items: + $ref: '#/components/schemas/SnssaiSmfInfoItem' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: '#/components/schemas/TaiRange' + minItems: 1 + pgwFqdn: + $ref: '#/components/schemas/Fqdn' + accessType: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + SnssaiSmfInfoItem: + type: object + required: + - sNssai + - dnnSmfInfoList + properties: + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnnSmfInfoList: + type: array + items: + $ref: '#/components/schemas/DnnSmfInfoItem' + minItems: 1 + DnnSmfInfoItem: + type: object + required: + - dnn + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + UpfInfo: + type: object + required: + - sNssaiUpfInfoList + properties: + sNssaiUpfInfoList: + type: array + items: + $ref: '#/components/schemas/SnssaiUpfInfoItem' + minItems: 1 + smfServingArea: + type: array + items: + type: string + minItems: 1 + interfaceUpfInfoList: + type: array + items: + $ref: '#/components/schemas/InterfaceUpfInfoItem' + minItems: 1 + iwkEpsInd: + type: boolean + default: false + pduSessionTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + minItems: 1 + atsssCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AtsssCapability' + ueIpAddrInd: + type: boolean + default: false + SnssaiUpfInfoItem: + type: object + required: + - sNssai + - dnnUpfInfoList + properties: + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnnUpfInfoList: + type: array + items: + $ref: '#/components/schemas/DnnUpfInfoItem' + minItems: 1 + DnnUpfInfoItem: + type: object + required: + - dnn + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + dnaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + pduSessionTypes: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionType' + minItems: 1 + InterfaceUpfInfoItem: + type: object + required: + - interfaceType + properties: + interfaceType: + $ref: '#/components/schemas/UPInterfaceType' + ipv4EndpointAddresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6EndpointAddresses: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + endpointFqdn: + $ref: '#/components/schemas/Fqdn' + networkInstance: + type: string + UPInterfaceType: + anyOf: + - type: string + enum: + - N3 + - N6 + - N9 + - type: string + PcfInfo: + type: object + properties: + groupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + dnnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + supiRanges: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRanges: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + rxDiamHost: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + rxDiamRealm: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DiameterIdentity' + BsfInfo: + type: object + properties: + dnnList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + ipDomainList: + type: array + items: + type: string + minItems: 1 + ipv4AddressRanges: + type: array + items: + $ref: '#/components/schemas/Ipv4AddressRange' + minItems: 1 + ipv6PrefixRanges: + type: array + items: + $ref: '#/components/schemas/Ipv6PrefixRange' + minItems: 1 + ChfInfo: + type: object + properties: + supiRangeList: + type: array + items: + $ref: '#/components/schemas/SupiRange' + minItems: 1 + gpsiRangeList: + type: array + items: + $ref: '#/components/schemas/IdentityRange' + minItems: 1 + plmnRangeList: + type: array + items: + $ref: '#/components/schemas/PlmnRange' + minItems: 1 + Ipv4AddressRange: + type: object + properties: + start: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + end: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + Ipv6PrefixRange: + type: object + properties: + start: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + end: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix' + DefaultNotificationSubscription: + type: object + required: + - notificationType + - callbackUri + properties: + notificationType: + $ref: '#/components/schemas/NotificationType' + callbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + n1MessageClass: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N1MessageClass' + n2InformationClass: + $ref: 'TS29518_Namf_Communication.yaml#/components/schemas/N2InformationClass' + NotificationType: +# anyOf: +# - type: string + enum: + - N1_MESSAGES + - N2_INFORMATION + - LOCATION_NOTIFICATION + - DATA_REMOVAL_NOTIFICATION + - DATA_CHANGE_NOTIFICATION + type: string + TransportProtocol: +# anyOf: +# - type: string + enum: + - TCP + type: string + NotificationEventType: +# anyOf: +# - type: string + enum: + - NF_REGISTERED + - NF_DEREGISTERED + - NF_PROFILE_CHANGED + type: string + NotificationData: + type: object + required: + - event + - nfInstanceUri + allOf: + # + # Condition: If 'event' takes value 'NF_PROFILE_CHANGED', + # then either 'nfProfile' or 'profileChanges' (but not both) must be present + # + - anyOf: + - not: + properties: + event: + type: string + enum: + - NF_PROFILE_CHANGED + - oneOf: + - required: [ nfProfile ] + - required: [ profileChanges ] + # + # Condition: If 'event' takes value 'NF_REGISTERED', + # then 'nfProfile' must be present + # + - anyOf: + - not: + properties: + event: + type: string + enum: + - NF_REGISTERED + - required: [ nfProfile ] + properties: + event: + $ref: '#/components/schemas/NotificationEventType' + nfInstanceUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nfProfile: + allOf: + - $ref: '#/components/schemas/NFProfile' + - not: + required: [ interPlmnFqdn ] + - not: + required: [ allowedPlmns ] + - not: + required: [ allowedNfTypes ] + - not: + required: [ allowedNfDomains ] + - not: + required: [ allowedNssais ] + - properties: + nfServices: + type: array + items: + allOf: + - $ref: '#/components/schemas/NFService' + - not: + required: [ interPlmnFqdn ] + - not: + required: [ allowedPlmns ] + - not: + required: [ allowedNfTypes ] + - not: + required: [ allowedNfDomains ] + - not: + required: [ allowedNssais ] + profileChanges: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ChangeItem' + minItems: 1 + NFStatus: +# anyOf: +# - type: string + enum: + - REGISTERED + - SUSPENDED + - UNDISCOVERABLE + type: string + NFServiceVersion: + type: object + required: + - apiVersionInUri + - apiFullVersion + properties: + apiVersionInUri: + type: string + apiFullVersion: + type: string + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ServiceName: +# anyOf: +# - type: string +# enum: +# - nnrf-nfm +# - nnrf-disc +# - nudm-sdm +# - nudm-uecm +# - nudm-ueau +# - nudm-ee +# - nudm-pp +# - nudm-niddau +# - namf-comm +# - namf-evts +# - namf-mt +# - namf-loc +# - nsmf-pdusession +# - nsmf-event-exposure +# - nausf-auth +# - nausf-sorprotection +# - nausf-upuprotection +# - nnef-pfdmanagement +# - npcf-am-policy-control +# - npcf-smpolicycontrol +# - npcf-policyauthorization +# - npcf-bdtpolicycontrol +# - npcf-eventexposure +# - npcf-ue-policy-control +# - nsmsf-sms +# - nnssf-nsselection +# - nnssf-nssaiavailability +# - nudr-dr +# - nlmf-loc +# - n5g-eir-eic +# - nbsf-management +# - nchf-spendinglimitcontrol +# - nchf-convergedcharging +# - nnwdaf-eventssubscription +# - nnwdaf-analyticsinfo + type: string + N2InterfaceAmfInfo: + type: object + properties: + ipv4EndpointAddress: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + minItems: 1 + ipv6EndpointAddress: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + minItems: 1 + amfName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + NFServiceStatus: +# anyOf: +# - type: string + enum: + - REGISTERED + - SUSPENDED + - UNDISCOVERABLE + type: string + TaiRange: + type: object + required: + - plmnId + - tacRangeList + properties: + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + tacRangeList: + type: array + items: + $ref: '#/components/schemas/TacRange' + minItems: 1 + TacRange: + type: object + properties: + start: + type: string + pattern: '^([A-Fa-f0-9]{4}|[A-Fa-f0-9]{6})$' + end: + type: string + pattern: '^([A-Fa-f0-9]{4}|[A-Fa-f0-9]{6})$' + pattern: + type: string + ChfServiceInfo: + type: object + not: + required: [ primaryChfServiceInstance, secondaryChfServiceInstance ] + properties: + primaryChfServiceInstance: + type: string + secondaryChfServiceInstance: + type: string + PlmnRange: + type: object + properties: + start: + type: string + pattern: '^[0-9]{3}[0-9]{2,3}$' + end: + type: string + pattern: '^[0-9]{3}[0-9]{2,3}$' + pattern: + type: string + NrfInfo: + type: object + properties: + servedUdrInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UdrInfo' + minProperties: 1 + servedUdmInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UdmInfo' + minProperties: 1 + servedAusfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/AusfInfo' + minProperties: 1 + servedAmfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/AmfInfo' + minProperties: 1 + servedSmfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/SmfInfo' + minProperties: 1 + servedUpfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/UpfInfo' + minProperties: 1 + servedPcfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/PcfInfo' + minProperties: 1 + servedBsfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/BsfInfo' + minProperties: 1 + servedChfInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/ChfInfo' + minProperties: 1 + servedNwdafInfo: + type: object + additionalProperties: + $ref: '#/components/schemas/NwdafInfo' + minProperties: 1 + PlmnSnssai: + type: object + required: + - plmnId + - sNssaiList + properties: + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + sNssaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + NwdafInfo: + type: object + properties: + eventIds: + type: array + items: + $ref: 'TS29520_Nnwdaf_AnalyticsInfo.yaml#/components/schemas/EventId' + minItems: 1 + nwdafEvents: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NwdafEvent' + minItems: 1 + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + taiRangeList: + type: array + items: + $ref: '#/components/schemas/TaiRange' + minItems: 1 + +externalDocs: + description: 3GPP TS 29.510 V15.3.0; 5G System; Network Function Repository Services; Stage 3 + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/' diff --git a/lib/sbi/support/modified/TS29518_Namf_Communication.yaml b/lib/sbi/support/modified/TS29518_Namf_Communication.yaml new file mode 100644 index 000000000..a6225f678 --- /dev/null +++ b/lib/sbi/support/modified/TS29518_Namf_Communication.yaml @@ -0,0 +1,2439 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-1 + title: Namf_Communication + description: | + AMF Communication Service + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +security: + - {} + - oAuth2ClientCredentials: + - namf-comm +externalDocs: + description: 3GPP TS 29.518 V15.3.0; 5G System; Access and Mobility Management Services + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.518/' +servers: + - url: '{apiRoot}/namf-comm/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501 +paths: + /ue-contexts/{ueContextId}: + put: + summary: Namf_Communication CreateUEContext service Operation + tags: + - Individual ueContext (Document) + operationId: CreateUEContext + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextCreateData' + binaryDataN2Information: + type: string + format: binary + binaryDataN2InformationExt1: + type: string + format: binary + binaryDataN2InformationExt2: + type: string + format: binary + binaryDataN2InformationExt3: + type: string + format: binary + binaryDataN2InformationExt4: + type: string + format: binary + binaryDataN2InformationExt5: + type: string + format: binary + binaryDataN2InformationExt6: + type: string + format: binary + binaryDataN2InformationExt7: + type: string + format: binary + binaryDataN2InformationExt8: + type: string + format: binary + binaryDataN2InformationExt9: + type: string + format: binary + binaryDataN2InformationExt10: + type: string + format: binary + binaryDataN2InformationExt11: + type: string + format: binary + binaryDataN2InformationExt12: + type: string + format: binary + binaryDataN2InformationExt13: + type: string + format: binary + binaryDataN2InformationExt14: + type: string + format: binary + binaryDataN2InformationExt15: + type: string + format: binary + binaryDataN2InformationExt16: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt2: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt3: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt4: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt5: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt6: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt7: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt8: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt9: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt10: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt11: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt12: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt13: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt14: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt15: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt16: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + required: true + callbacks: + onN2MessageNotify: + '{$request.body#/n2NotifyUri}': + post: + summary: Namf_Communication N2 Info Notify (UE Specific) service Operation + tags: + - N2 Info Notify + operationId: N2InfoNotify + requestBody: + description: UE Specific N2 Information Notification + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationNotification' + responses: + '200': + description: N2 Information Notification Response. + content: + application/json: + schema: + $ref: '#/components/schemas/N2InfoNotificationRspData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InfoNotificationRspData' + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + responses: + '201': + description: UE context successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//ue-contexts/{ueContextId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreatedData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextCreatedData' + binaryDataN2Information: + type: string + format: binary + binaryDataN2InformationExt1: + type: string + format: binary + binaryDataN2InformationExt2: + type: string + format: binary + binaryDataN2InformationExt3: + type: string + format: binary + binaryDataN2InformationExt4: + type: string + format: binary + binaryDataN2InformationExt5: + type: string + format: binary + binaryDataN2InformationExt6: + type: string + format: binary + binaryDataN2InformationExt7: + type: string + format: binary + binaryDataN2InformationExt8: + type: string + format: binary + binaryDataN2InformationExt9: + type: string + format: binary + binaryDataN2InformationExt10: + type: string + format: binary + binaryDataN2InformationExt11: + type: string + format: binary + binaryDataN2InformationExt12: + type: string + format: binary + binaryDataN2InformationExt13: + type: string + format: binary + binaryDataN2InformationExt14: + type: string + format: binary + binaryDataN2InformationExt15: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt2: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt3: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt4: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt5: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt6: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt7: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt8: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt9: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt10: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt11: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt12: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt13: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt14: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt15: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreateError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreateError' + '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': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextCreateError' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/release: + post: + summary: Namf_Communication ReleaseUEContext service Operation + tags: + - Individual ueContext (Document) + operationId: ReleaseUEContext + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UEContextRelease' + required: true + responses: + '204': + description: UE Context successfully released + '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' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/assign-ebi: + post: + summary: Namf_Communication EBI Assignment service Operation + tags: + - Individual ueContext (Document) + operationId: EBIAssignment + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiData' + required: true + responses: + '200': + description: EBI Assignment successfully performed. + content: + application/json: + schema: + $ref: '#/components/schemas/AssignedEbiData' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiError' + '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': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/AssignEbiError' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/transfer: + post: + summary: Namf_Communication UEContextTransfer service Operation + tags: + - Individual ueContext (Document) + operationId: UEContextTransfer + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextTransferReqData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextTransferReqData' + binaryDataN1Message: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + required: true + responses: + '200': + description: UE context transfer successfully initiated. + content: + application/json: + schema: + $ref: '#/components/schemas/UeContextTransferRspData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/UeContextTransferRspData' + binaryDataN2Information: + type: string + format: binary + binaryDataN2InformationExt1: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + binaryDataN2InformationExt1: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + /ue-contexts/{ueContextId}/transfer-update: + post: + summary: Namf_Communication RegistrationStatusUpdate service Operation + tags: + - Individual ueContext (Document) + operationId: RegistrationStatusUpdate + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UeRegStatusUpdateReqData' + required: true + responses: + '200': + description: UE context transfer status successfully updated. + content: + application/json: + schema: + $ref: '#/components/schemas/UeRegStatusUpdateRspData' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /ue-contexts/{ueContextId}/n1-n2-messages: + post: + summary: Namf_Communication N1N2 Message Transfer (UE Specific) service Operation + tags: + - n1N2Message collection (Document) + operationId: N1N2MessageTransfer + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|cid-.{1,255}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferReqData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N1N2MessageTransferReqData' + binaryDataN1Message: + type: string + format: binary + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + required: true + responses: + '202': + description: N1N2 Message Transfer accepted. + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferRspData' + '200': + description: N1N2 Message Transfer successfully initiated. + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferRspData' + '307': + description: Temporary Redirect + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + headers: + Location: + description: 'The URI of the resource located on the target NF Service Consumer (e.g. AMF) to which the request is redirected' + required: true + 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' + '409': + description: Conflicts + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferError' + '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': + description: Gateway Timeout + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MessageTransferError' + default: + description: Unexpected error + callbacks: + onN1N2TransferFailure: + '{$request.body#/n1n2FailureTxfNotifURI}': + post: + summary: Namf_Communication N1N2Transfer Failure Notification service Operation + tags: + - N1N2 Transfer Failure Notification + operationId: N1N2TransferFailureNotification + requestBody: + description: N1N2Transfer Failure Notification + content: + application/json: + schema: + $ref: '#/components/schemas/N1N2MsgTxfrFailureNotification' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /ue-contexts/{ueContextId}/n1-n2-messages/subscriptions: + post: + summary: Namf_Communication N1N2 Message Subscribe (UE Specific) service Operation + tags: + - N1N2 Subscriptions Collection for Individual UE Contexts (Document) + operationId: N1N2MessageSubscribe + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UeN1N2InfoSubscriptionCreateData' + required: true + responses: + '201': + description: N1N2 Message Subscription successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//{ueContextId}/n1-n2-messages/subscriptions/{subscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/UeN1N2InfoSubscriptionCreatedData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + default: + description: Unexpected error + callbacks: + onN1N2MessageNotify: + '{$request.body#/n1NotifyCallbackUri}': + post: + summary: Namf_Communication N1 Message Notify service Operation + tags: + - N1 Message Notify + operationId: N1MessageNotify + requestBody: + description: N1 Message Notification + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N1MessageNotification' + binaryDataN1Message: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + '{$request.body#/n2NotifyCallbackUri}': + post: + summary: Namf_Communication N2 Info Notify (UE Specific) service Operation + tags: + - N2 Info Notify + operationId: N2InfoNotify + requestBody: + description: UE Specific N2 Informaiton Notification + content: + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InformationNotification' + binaryDataN1Message: + type: string + format: binary + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN1Message: + contentType: application/vnd.3gpp.5gnas + headers: + Content-Id: + schema: + type: string + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /ue-contexts/{ueContextId}/n1-n2-messages/subscriptions/{subscriptionId}: + delete: + summary: Namf_Communication N1N2 Message UnSubscribe (UE Specific) service Operation + tags: + - N1N2 Individual Subscription (Document) + operationId: N1N2MessageUnSubscribe + parameters: + - name: ueContextId + in: path + description: UE Context Identifier + required: true + schema: + type: string + pattern: '^(5g-guti-[0-9]{5,6}[0-9a-fA-F]{14}|imsi-[0-9]{5,15}|nai-.+|imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + - name: subscriptionId + in: path + description: Subscription Identifier + required: true + schema: + type: string + responses: + '204': + description: N1N2 Message Subscription successfully removed. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /non-ue-n2-messages/transfer: + post: + summary: Namf_Communication Non UE N2 Message Transfer service Operation + tags: + - Non UE N2Messages collection (Document) + operationId: NonUeN2MessageTransfer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferReqData' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InformationTransferReqData' + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + required: true + responses: + '200': + description: Non UE N2 Message Transfer successfully initiated. + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferRspData' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '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': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + '503': + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationTransferError' + default: + description: Unexpected error + /non-ue-n2-messages/subscriptions: + post: + summary: Namf_Communication Non UE N2 Info Subscribe service Operation + tags: + - Non UE N2Messages Subscriptions collection (Document) + operationId: NonUeN2InfoSubscribe + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NonUeN2InfoSubscriptionCreateData' + required: true + responses: + '201': + description: Non UE N2 Info Subscription successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//non-ue-n2-messages/subscriptions/{n2NotifySubscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/NonUeN2InfoSubscriptionCreatedData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + callbacks: + onN2InfoNotify: + '{$request.body#/n2NotifyCallbackUri}': + post: + summary: Namf_Communication Non UE N2 Info Notify service Operation + tags: + - Non UE N2 Info Notify + operationId: NonUeN2InfoNotify + requestBody: + description: Non UE N2 Informaiton Notification + content: + application/json: + schema: + $ref: '#/components/schemas/N2InformationNotification' + multipart/related: # message with binary body part(s) + schema: + type: object + properties: # Request parts + jsonData: + $ref: '#/components/schemas/N2InformationNotification' + binaryDataN2Information: + type: string + format: binary + encoding: + jsonData: + contentType: application/json + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /non-ue-n2-messages/subscriptions/{n2NotifySubscriptionId}: + delete: + summary: Namf_Communication Non UE N2 Info UnSubscribe service Operation + tags: + - Non UE N2 Message Notification Individual Subscription (Document) + operationId: NonUeN2InfoUnSubscribe + parameters: + - name: n2NotifySubscriptionId + in: path + description: N2 info Subscription Identifier + required: true + schema: + type: string + responses: + '204': + description: Non UE N2 INfo Subscription successfully removed. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + /subscriptions: + post: + summary: Namf_Communication AMF Status Change Subscribe service Operation + tags: + - subscriptions collection (Document) + operationId: AMFStatusChangeSubscribe + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + required: true + responses: + '201': + description: N1N2 Message Subscription successfully created. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-comm//subscriptions/{subscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + callbacks: + onAmfStatusChange: + '{$request.body#/amfStatusUri}': + post: + summary: Amf Status Change Notify service Operation + tags: + - Amf Status Change Notify + operationId: AmfStatusChangeNotify + requestBody: + description: Amf Status Change Notification + content: + application/json: + schema: + $ref: '#/components/schemas/AmfStatusChangeNotification' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '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' + /subscriptions/{subscriptionId}: + delete: + summary: Namf_Communication AMF Status Change UnSubscribe service Operation + tags: + - individual subscription (Document) + operationId: AMFStatusChangeUnSubscribe + parameters: + - name: subscriptionId + in: path + description: AMF Status Change Subscription Identifier + required: true + schema: + type: string + responses: + '204': + description: N1N2 Message Subscription successfully removed. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '404': + $ref: 'TS29571_CommonData.yaml#/components/responses/404' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + description: Unexpected error + put: + summary: Namf_Communication AMF Status Change Subscribe Modify service Operation + tags: + - individual subscription (Document) + operationId: AMFStatusChangeSubscribeModfy + parameters: + - name: subscriptionId + in: path + description: AMF Status Change Subscription Identifier + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + required: true + responses: + '202': + description: N1N2 Message Subscription successfully updated. + content: + application/json: + schema: + $ref: '#/components/schemas/SubscriptionData' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' + default: + description: Unexpected error + callbacks: + OnAmfStatusChange: + '{$request.body#/amfStatusUri}': + post: + summary: Amf Status Change Notify service Operation + tags: + - Amf Status Change Notify + operationId: AmfStatusChangeNOtify + requestBody: + description: Amf Status Change Notification + content: + application/json: + schema: + $ref: '#/components/schemas/AmfStatusChangeNotification' + responses: + '204': + description: Expected response to a successful callback processing + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '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' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + namf-comm: Access to the Namf_Communication API + schemas: +# +# STRUCTURED DATA TYPES +# + SubscriptionData: + type: object + properties: + amfStatusUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + required: + - amfStatusUri + AmfStatusChangeNotification: + type: object + properties: + amfStatusInfoList: + type: array + items: + $ref: '#/components/schemas/AmfStatusInfo' + minItems: 1 + required: + - amfStatusInfoList + AmfStatusInfo: + type: object + properties: + guamiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Guami' + minItems: 1 + statusChange: + $ref: '#/components/schemas/StatusChange' + targetAmfRemoval: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + targetAmfFailure: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + required: + - guamiList + - statusChange + AssignEbiData: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + arpList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + releasedEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + required: + - pduSessionId + AssignedEbiData: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + assignedEbiList: + type: array + items: + $ref: 'TS29502_Nsmf_PDUSession.yaml#/components/schemas/EbiArpMapping' + minItems: 0 + failedArpList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + releasedEbiList: + type: array + items: + $ref: '#/components/schemas/EpsBearerId' + minItems: 1 + required: + - pduSessionId + - assignedEbiList + AssignEbiFailed: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + failedArpList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + minItems: 1 + required: + - pduSessionId + UEContextRelease: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + unauthenticatedSupi: + type: boolean + default: false + ngapCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + required: + - ngapCause + N2InformationTransferReqData: + type: object + properties: + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + ratSelector: + $ref: '#/components/schemas/RatSelector' + ecgiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ecgi' + minItems: 1 + ncgiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ncgi' + minItems: 1 + globalRanNodeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + minItems: 1 + n2Information: + $ref: '#/components/schemas/N2InfoContainer' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n2Information + NonUeN2InfoSubscriptionCreateData: + type: object + properties: + globalRanNodeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + minItems: 1 + anTypeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + minItems: 1 + n2InformationClass: + $ref: '#/components/schemas/N2InformationClass' + n2NotifyCallbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n2InformationClass + - n2NotifyCallbackUri + NonUeN2InfoSubscriptionCreatedData: + type: object + properties: + n2NotifySubscriptionId: + type: string + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n2NotifySubscriptionId + UeN1N2InfoSubscriptionCreateData: + type: object + properties: + n2InformationClass: + $ref: '#/components/schemas/N2InformationClass' + n2NotifyCallbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + n1MessageClass: + $ref: '#/components/schemas/N1MessageClass' + n1NotifyCallbackUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + UeN1N2InfoSubscriptionCreatedData: + type: object + properties: + n1n2NotifySubscriptionId: + type: string + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - n1n2NotifySubscriptionId + N2InformationNotification: + type: object + properties: + n2NotifySubscriptionId: + type: string + n2InfoContainer: + $ref: '#/components/schemas/N2InfoContainer' + toReleaseSessionList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + minItems: 1 + lcsCorrelationId: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CorrelationID' + notifyReason: + $ref: '#/components/schemas/N2InfoNotifyReason' + smfChangeInd: + $ref: '#/components/schemas/SmfChangeIndication' + required: + - n2NotifySubscriptionId + N2InfoContainer: + type: object + properties: + n2InformationClass: + $ref: '#/components/schemas/N2InformationClass' + smInfo: + $ref: '#/components/schemas/N2SmInformation' + ranInfo: + $ref: '#/components/schemas/N2RanInformation' + nrppaInfo: + $ref: '#/components/schemas/NrppaInformation' + pwsInfo: + $ref: '#/components/schemas/PwsInformation' + required: + - n2InformationClass + N1MessageNotification: + type: object + properties: + n1NotifySubscriptionId: + type: string + n1MessageContainer: + $ref: '#/components/schemas/N1MessageContainer' + lcsCorrelationId: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CorrelationID' + registrationCtxtContainer: + $ref: '#/components/schemas/RegistrationContextContainer' + required: + - n1MessageContainer + N1MessageContainer: + type: object + properties: + n1MessageClass: + $ref: '#/components/schemas/N1MessageClass' + n1MessageContent: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + serviceInstanceId: + type: string + required: + - n1MessageClass + - n1MessageContent + N1N2MessageTransferReqData: + type: object + properties: + n1MessageContainer: + $ref: '#/components/schemas/N1MessageContainer' + n2InfoContainer: + $ref: '#/components/schemas/N2InfoContainer' + skipInd: + type: boolean + default: false + lastMsgIndication: + type: boolean + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + lcsCorrelationId: + $ref: 'TS29572_Nlmf_Location.yaml#/components/schemas/CorrelationID' + ppi: + $ref: '#/components/schemas/Ppi' + arp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + n1n2FailureTxfNotifURI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + smfReallocationInd: + type: boolean + default: false + areaOfValidity: + $ref: '#/components/schemas/AreaOfValidity' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + N1N2MessageTransferRspData: + type: object + properties: + cause: + $ref: '#/components/schemas/N1N2MessageTransferCause' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - cause + RegistrationContextContainer: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + localTimeZone: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone' + anType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + anN2ApId: + type: integer + ranNodeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + initialAmfName: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AmfName' + userLocation: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + rrcEstCause: + type: string + pattern: '^[0-9a-fA-F]+$' + ueContextRequest: + type: boolean + default: false + anN2IPv4Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + anN2IPv6Addr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + allowedNssai: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/AllowedNssai' + configuredNssai: + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/ConfiguredSnssai' + minItems: 1 + rejectedNssaiInPlmn: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + rejectedNssaiInTa: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + required: + - ueContext + - anType + - anN2ApId + - ranNodeId + - initialAmfName + - userLocation + AreaOfValidity: + type: object + properties: + taiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 0 + required: + - taiList + UeContextTransferReqData: + type: object + properties: + reason: + $ref: '#/components/schemas/TransferReason' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + plmnId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId' + regRequest: + $ref: '#/components/schemas/N1MessageContainer' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - reason + - accessType + UeContextTransferRspData: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + ueRadioCapability: + $ref: '#/components/schemas/N2InfoContent' + ueNbiotRadioCapability: + $ref: '#/components/schemas/N2InfoContent' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - ueContext + UeContext: + type: object + properties: + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + supiUnauthInd: + type: boolean + gpsiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi' + minItems: 1 + pei: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei' + udmGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + ausfGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfGroupId' + routingIndicator: + type: string + groupList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + minItems: 1 + drxParameter: + $ref: '#/components/schemas/DrxParameter' + subRfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + usedRfsp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RfspIndex' + subUeAmbr: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ambr' + smsSupport: + $ref: '#/components/schemas/SmsSupport' + smsfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + seafData: + $ref: '#/components/schemas/SeafData' + 5gMmCapability: + $ref: '#/components/schemas/5GMmCapability' + pcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + pcfAmPolicyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + amPolicyReqTriggerList: + type: array + items: + $ref: '#/components/schemas/PolicyReqTrigger' + minItems: 1 + pcfUePolicyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + uePolicyReqTriggerList: + type: array + items: + $ref: '#/components/schemas/PolicyReqTrigger' + minItems: 1 + hpcfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + restrictedRatList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RatType' + minItems: 1 + forbiddenAreaList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Area' + minItems: 1 + serviceAreaRestriction: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ServiceAreaRestriction' + restrictedCoreNwTypeList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/CoreNetworkType' + minItems: 1 + eventSubscriptionList: + type: array + items: + $ref: 'TS29518_Namf_EventExposure.yaml#/components/schemas/AmfEventSubscription' + minItems: 1 + mmContextList: + type: array + items: + $ref: '#/components/schemas/MmContext' + minItems: 1 + maxItems: 2 + sessionContextList: + type: array + items: + $ref: '#/components/schemas/PduSessionContext' + minItems: 1 + traceData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/TraceData' + remainingServiceGapTimer: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + N2SmInformation: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + n2InfoContent: + $ref: '#/components/schemas/N2InfoContent' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + homePlmnSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + subjectToHo: + type: boolean + required: + - pduSessionId + N2InfoContent: + type: object + properties: + ngapMessageType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + ngapIeType: + $ref: '#/components/schemas/NgapIeType' + ngapData: + $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData' + required: + - ngapData + NrppaInformation: + type: object + properties: + nfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nrppaPdu: + $ref: '#/components/schemas/N2InfoContent' + serviceInstanceId: + type: string + required: + - nfId + - nrppaPdu + PwsInformation: + type: object + properties: + messageIdentifier: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint16' + serialNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint16' + pwsContainer: + $ref: '#/components/schemas/N2InfoContent' + sendRanResponse: + type: boolean + default: false + omcId: + $ref: '#/components/schemas/OmcIdentifier' + required: + - messageIdentifier + - serialNumber + - pwsContainer + N1N2MsgTxfrFailureNotification: + type: object + properties: + cause: + $ref: '#/components/schemas/N1N2MessageTransferCause' + n1n2MsgDataUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + required: + - cause + - n1n2MsgDataUri + N1N2MessageTransferError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + errInfo: + $ref: '#/components/schemas/N1N2MsgTxfrErrDetail' + required: + - error + N1N2MsgTxfrErrDetail: + type: object + properties: + retryAfter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + highestPrioArp: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Arp' + N2InformationTransferRspData: + type: object + properties: + result: + $ref: '#/components/schemas/N2InformationTransferResult' + pwsRspData: + $ref: '#/components/schemas/PWSResponseData' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - result + MmContext: + type: object + properties: + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + nasSecurityMode: + $ref: '#/components/schemas/NasSecurityMode' + nasDownlinkCount: + $ref: '#/components/schemas/NasCount' + nasUplinkCount: + $ref: '#/components/schemas/NasCount' + ueSecurityCapability: + $ref: '#/components/schemas/UeSecurityCapability' + s1UeNetworkCapability: + $ref: '#/components/schemas/S1UeNetworkCapability' + allowedNssai: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + nssaiMappingList: + type: array + items: + $ref: '#/components/schemas/NssaiMapping' + minItems: 1 + nsInstanceList: + type: array + items: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/NsiId' + minItems: 1 + expectedUEbehavior: + $ref: '#/components/schemas/ExpectedUeBehavior' + required: + - accessType + SeafData: + type: object + properties: + ngKsi: + $ref: '#/components/schemas/NgKsi' + keyAmf: + $ref: '#/components/schemas/KeyAmf' + nh: + type: string + pattern: '^[A-Fa-f0-9]+$' + ncc: + type: integer + minimum: 0 + maximum: 7 + keyAmfChangeInd: + type: boolean + keyAmfHDerivationInd: + type: boolean + required: + - ngKsi + - keyAmf + NasSecurityMode: + type: object + properties: + integrityAlgorithm: + $ref: '#/components/schemas/IntegrityAlgorithm' + cipheringAlgorithm: + $ref: '#/components/schemas/CipheringAlgorithm' + required: + - integrityAlgorithm + - cipheringAlgorithm + PduSessionContext: + type: object + properties: + pduSessionId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + smContextRef: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + sNssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + accessType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType' + allocatedEbiList: + type: array + items: + $ref: 'TS29502_Nsmf_PDUSession.yaml#/components/schemas/EbiArpMapping' + minItems: 1 + hsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + vsmfId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nsInstance: + $ref: 'TS29531_Nnssf_NSSelection.yaml#/components/schemas/NsiId' + smfServiceInstanceId: + type: string + required: + - pduSessionId + - smContextRef + - sNssai + - dnn + - accessType + NssaiMapping: + type: object + properties: + mappedSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + hSnssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + required: + - mappedSnssai + - hSnssai + UeRegStatusUpdateReqData: + type: object + properties: + transferStatus: + $ref: '#/components/schemas/UeContextTransferStatus' + toReleaseSessionList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PduSessionId' + minItems: 1 + pcfReselectedInd: + type: boolean + required: + - transferStatus + UeRegStatusUpdateRspData: + type: object + properties: + regStatusTransferComplete: + type: boolean + required: + - regStatusTransferComplete + AssignEbiError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + failureDetails: + $ref: '#/components/schemas/AssignEbiFailed' + required: + - error + - failureDetails + UeContextCreateData: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + targetId: + $ref: '#/components/schemas/NgRanTargetId' + sourceToTargetData: + $ref: '#/components/schemas/N2InfoContent' + pduSessionList: + type: array + items: + $ref: '#/components/schemas/N2SmInformation' + minItems: 1 + mmeControlFteid: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + n2NotifyUri: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + ueRadioCapability: + $ref: '#/components/schemas/N2InfoContent' + ngapCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - ueContext + - targetId + - sourceToTargetData + - pduSessionList + UeContextCreatedData: + type: object + properties: + ueContext: + $ref: '#/components/schemas/UeContext' + targetToSourceData: + $ref: '#/components/schemas/N2InfoContent' + pduSessionList: + type: array + items: + $ref: '#/components/schemas/N2SmInformation' + minItems: 1 + failedSessionList: + type: array + items: + $ref: '#/components/schemas/N2SmInformation' + minItems: 1 + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + pcfReselectedInd: + type: boolean + required: + - ueContext + - targetToSourceData + - pduSessionList + UeContextCreateError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + ngapCause: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause' + required: + - error + NgRanTargetId: + type: object + properties: + ranNodeId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GlobalRanNodeId' + tai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + required: + - ranNodeId + - tai + PWSResponseData: + type: object + properties: + ngapMessageType: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + serialNumber: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uint16' + messageIdentifier: + type: integer + unknownTaiList: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai' + minItems: 1 + required: + - ngapMessageType + - serialNumber + - messageIdentifier + PWSErrorData: + type: object + properties: + namfCause: + type: integer + required: + - namfCause + N2InformationTransferError: + type: object + properties: + error: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + pwdErrorInfo: + $ref: '#/components/schemas/PWSErrorData' + required: + - error + NgKsi: + type: object + properties: + tsc: + $ref: '#/components/schemas/ScType' + ksi: + type: integer + minimum: 0 + maximum: 6 + required: + - tsc + - ksi + KeyAmf: + type: object + properties: + keyType: + $ref: '#/components/schemas/KeyAmfType' + keyVal: + type: string + required: + - keyType + - keyVal + ExpectedUeBehavior: + type: object + properties: + expMoveTrajectory: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + minItems: 1 + validityTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + required: + - expMoveTrajectory + - validityTime + N2RanInformation: + type: object + properties: + n2InfoContent: + $ref: '#/components/schemas/N2InfoContent' + required: + - n2InfoContent + N2InfoNotificationRspData: + type: object + properties: + n2InfoContent: + $ref: '#/components/schemas/N2InfoContent' +# +# SIMPLE DATA TYPES +# + EpsBearerId: + type: integer + minimum: 0 + maximum: 15 + Ppi: + type: integer + minimum: 0 + maximum: 7 + NasCount: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + 5GMmCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + UeSecurityCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + S1UeNetworkCapability: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + DrxParameter: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes' + OmcIdentifier: + type: string + +# +# ENUMERATIONS +# + StatusChange: + anyOf: + - type: string + enum: + - AMF_UNAVAILABLE + - AMF_AVAILABLE + - type: string + N2InformationClass: + anyOf: + - type: string + enum: + - SM + - NRPPa + - PWS + - PWS-BCAL + - PWS-RF + - RAN + - type: string + N1MessageClass: +# anyOf: +# - type: string + enum: + - 5GMM + - SM + - LPP + - SMS + - UPDP + type: string + N1N2MessageTransferCause: + anyOf: + - type: string + enum: + - ATTEMPTING_TO_REACH_UE + - N1_N2_TRANSFER_INITIATED + - WAITING_FOR_ASYNCHRONOUS_TRANSFER + - UE_NOT_RESPONDING + - N1_MSG_NOT_TRANSFERRED + - UE_NOT_REACHABLE_FOR_SESSION + - type: string + UeContextTransferStatus: + anyOf: + - type: string + enum: + - TRANSFERRED + - NOT_TRANSFERRED + - type: string + N2InformationTransferResult: + anyOf: + - type: string + enum: + - N2_INFO_TRANSFER_INITIATED + - type: string + CipheringAlgorithm: + anyOf: + - type: string + enum: + - NEA0 + - NEA1 + - NEA2 + - NEA3 + - type: string + IntegrityAlgorithm: + anyOf: + - type: string + enum: + - NIA0 + - NIA1 + - NIA2 + - NIA3 + - type: string + SmsSupport: + anyOf: + - type: string + enum: + - 3GPP + - NON_3GPP + - BOTH + - NONE + - type: string + ScType: + anyOf: + - type: string + enum: + - NATIVE + - MAPPED + - type: string + KeyAmfType: + anyOf: + - type: string + enum: + - KAMF + - KPRIMEAMF + - type: string + TransferReason: + anyOf: + - type: string + enum: + - INIT_REG + - MOBI_REG + - MOBI_REG_UE_VALIDATED + - type: string + PolicyReqTrigger: + anyOf: + - type: string + enum: + - LOCATION_CHANGE + - PRA_CHANGE + - SARI_CHANGE + - RFSP_INDEX_CHANGE + - ALLOWED_NSSAI_CHANGE + - type: string + RatSelector: + anyOf: + - type: string + enum: + - E-UTRA + - NR + - type: string + NgapIeType: + anyOf: + - type: string + enum: + - PDU_RES_SETUP_REQ + - PDU_RES_REL_CMD + - PDU_RES_MOD_REQ + - HANDOVER_CMD + - HANDOVER_REQUIRED + - HANDOVER_PREP_FAIL + - SRC_TO_TAR_CONTAINER + - TAR_TO_SRC_CONTAINER + - RAN_STATUS_TRANS_CONTAINER + - SON_CONFIG_TRANSFER + - NRPPA_PDU + - UE_RADIO_CAPABILITY + - type: string + N2InfoNotifyReason: + anyOf: + - type: string + enum: + - HANDOVER_COMPLETED + - type: string + SmfChangeIndication: + anyOf: + - type: string + enum: + - INSERTED + - CHANGED + - REMOVED + - type: string diff --git a/lib/sbi/support/modified/TS29520_Nnwdaf_AnalyticsInfo.yaml b/lib/sbi/support/modified/TS29520_Nnwdaf_AnalyticsInfo.yaml new file mode 100644 index 000000000..6147ca1f6 --- /dev/null +++ b/lib/sbi/support/modified/TS29520_Nnwdaf_AnalyticsInfo.yaml @@ -0,0 +1,264 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-3 + title: Nnwdaf_AnalyticsInfo + description: | + Nnwdaf_AnalyticsInfo Service API. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.520 V16.3.0; 5G System; Network Data Analytics Services. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.520/' +security: + - {} + - oAuth2ClientCredentials: + - nnwdaf-analyticsinfo +servers: + - url: '{apiRoot}/nnwdaf-analyticsinfo/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +paths: + /analytics: + get: + summary: Read a NWDAF Analytics + operationId: GetNWDAFAnalytics + tags: + - NWDAF Analytics (Document) + parameters: + - name: event-id + in: query + description: Identify the analytics. + required: true + schema: + $ref: '#/components/schemas/EventId' + - name: ana-req + in: query + description: Identifies the analytics reporting requirement information. + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsReportingRequirement' + - name: event-filter + in: query + description: Identify the analytics. + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/EventFilter' + - name: supported-features + in: query + description: To filter irrelevant responses related to unsupported features + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + - name: tgt-ue + in: query + description: Identify the target UE information. + required: false + content: + application/json: + schema: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/TargetUeInformation' + responses: + '200': + description: Containing the analytics with parameters as relevant for the requesting NF service consumer. + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsData' + '204': + description: No Content (The request NWDAF Analytics data does not exist) + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + description: Indicates that the NWDAF Analytics resource does not exist. + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '406': + $ref: 'TS29571_CommonData.yaml#/components/responses/406' + '414': + $ref: 'TS29571_CommonData.yaml#/components/responses/414' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnwdaf-analyticsinfo: Access to the Nnwdaf_AnalyticsInfo API + schemas: + AnalyticsData: + type: object + properties: + sliceLoadLevelInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/SliceLoadLevelInformation' + minItems: 1 + description: The slices and their load level information. + nfLoadLevelInfo: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NfLoadLevelInformation' + minItems: 1 + nwPerfs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NetworkPerfInfo' + minItems: 1 + svcExps: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ServiceExperienceInfo' + minItems: 1 + qosSustainInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/QosSustainabilityInfo' + minItems: 1 + ueMobs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UeMobility' + minItems: 1 + ueComms: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UeCommunication' + minItems: 1 + userDataCongInfos: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/UserDataCongestionInfo' + minItems: 1 + abnorBehavrs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/AbnormalBehaviour' + minItems: 1 + EventFilter: + type: object + properties: + anySlice: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/AnySlice' + snssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + description: Identification(s) of network slice to which the subscription belongs. + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + dnais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + nfInstanceIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + nfSetIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + minItems: 1 + nfTypes: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + minItems: 1 + maxAnaEntry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + qosRequ: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/QosRequirement' + nwPerfTypes: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/NetworkPerfType' + minItems: 1 + bwRequs: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/BwRequirement' + minItems: 1 + excepIds: + type: array + items: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ExceptionId' + minItems: 1 + exptAnaType: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/ExpectedAnalyticsType' + exptUeBehav: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExpectedUeBehaviourData' + not: + required: [anySlice, snssais] + AnalyticsReportingRequirement: + type: object + properties: + accuracy: + $ref: 'TS29520_Nnwdaf_EventsSubscription.yaml#/components/schemas/Accuracy' + startTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + sampRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + EventId: + anyOf: + - type: string + enum: + - LOAD_LEVEL_INFORMATION + - NETWORK_PERFORMANCE + - NF_LOAD + - SERVICE_EXPERIENCE + - UE_MOBILITY + - UE_COMMUNICATION + - QOS_SUSTAINABILITY + - ABNORMAL_BEHAVIOUR + - USER_DATA_CONGESTION + - 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 + - LOAD_LEVEL_INFORMATION: Represent the analytics of load level information of corresponding network slice instance. + - NETWORK_PERFORMANCE: Represent the analytics of network performance information. + - NF_LOAD: Indicates that the event subscribed is NF Load. + - SERVICE_EXPERIENCE: Represent the analytics of service experience information of the specific applications. + - UE_MOBILITY: Represent the analytics of UE mobility. + - UE_COMMUNICATION: Represent the analytics of UE communication. + - QOS_SUSTAINABILITY: Represent the analytics of QoS sustainability information in the certain area. + - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour information. + - USER_DATA_CONGESTION: Represent the analytics of the user data congestion in the certain area. diff --git a/lib/sbi/support/modified/TS29520_Nnwdaf_EventsSubscription.yaml b/lib/sbi/support/modified/TS29520_Nnwdaf_EventsSubscription.yaml new file mode 100644 index 000000000..bcdff8b62 --- /dev/null +++ b/lib/sbi/support/modified/TS29520_Nnwdaf_EventsSubscription.yaml @@ -0,0 +1,950 @@ +openapi: 3.0.0 +info: + version: 1.1.0.alpha-4 + title: Nnwdaf_EventsSubscription + description: | + Nnwdaf_EventsSubscription Service API. + (C) 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.520 V16.3.0; 5G System; Network Data Analytics Services. + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.520/' +security: + - {} + - oAuth2ClientCredentials: + - nnwdaf-eventssubscription +servers: + - url: '{apiRoot}/nnwdaf-eventssubscription/v1' + variables: + apiRoot: + default: https://example.com + description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501. +paths: + /subscriptions: + post: + summary: Create a new Individual NWDAF Events Subscription + operationId: CreateNWDAFEventsSubscription + tags: + - NWDAF Events Subscriptions (Collection) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + responses: + '201': + description: Create a new Individual NWDAF Event Subscription resource. + headers: + Location: + description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnwdaf-eventssubscription/v1/subscriptions/{subscriptionId}' + required: true + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + callbacks: + myNotification: + '{$request.body#/notificationURI}': + post: + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NnwdafEventsSubscriptionNotification' + minItems: 1 + responses: + '204': + description: The receipt of the Notification is acknowledged. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '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' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + /subscriptions/{subscriptionId}: + delete: + summary: Delete an existing Individual NWDAF Events Subscription + operationId: DeleteNWDAFEventsSubscription + tags: + - Individual NWDAF Events Subscription (Document) + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Nnwdaf_EventsSubscription Service + required: true + schema: + type: string + responses: + '204': + description: No Content. The Individual NWDAF Event Subscription resource matching the subscriptionId was deleted. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + description: The Individual NWDAF Event Subscription resource does not exist. + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '429': + $ref: 'TS29571_CommonData.yaml#/components/responses/429' + '500': + $ref: 'TS29571_CommonData.yaml#/components/responses/500' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' + put: + summary: Update an existing Individual NWDAF Events Subscription + operationId: UpdateNWDAFEventsSubscription + tags: + - Individual NWDAF Events Subscription (Document) + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + parameters: + - name: subscriptionId + in: path + description: String identifying a subscription to the Nnwdaf_EventsSubscription Service + required: true + schema: + type: string + responses: + '200': + description: The Individual NWDAF Event Subscription resource was modified successfully and a representation of that resource is returned. + content: + application/json: + schema: + $ref: '#/components/schemas/NnwdafEventsSubscription' + '204': + description: The Individual NWDAF Event Subscription resource was modified successfully. + '400': + $ref: 'TS29571_CommonData.yaml#/components/responses/400' + '401': + $ref: 'TS29571_CommonData.yaml#/components/responses/401' + '403': + $ref: 'TS29571_CommonData.yaml#/components/responses/403' + '404': + description: The Individual NWDAF Event Subscription resource does not exist. + content: + application/problem+json: + schema: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails' + '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' + '501': + $ref: 'TS29571_CommonData.yaml#/components/responses/501' + '503': + $ref: 'TS29571_CommonData.yaml#/components/responses/503' + default: + $ref: 'TS29571_CommonData.yaml#/components/responses/default' +components: + securitySchemes: + oAuth2ClientCredentials: + type: oauth2 + flows: + clientCredentials: + tokenUrl: '{nrfApiRoot}/oauth2/token' + scopes: + nnwdaf-eventssubscription: Access to the Nnwdaf_EventsSubscription API + schemas: + NnwdafEventsSubscription: + type: object + properties: + eventSubscriptions: + type: array + items: + $ref: '#/components/schemas/EventSubscription' + minItems: 1 + description: Subscribed events + evtReq: + $ref: '#/components/schemas/EventReportingRequirement' + notificationURI: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' + supportedFeatures: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures' + required: + - eventSubscriptions + EventSubscription: + type: object + properties: + anySlice: + $ref: '#/components/schemas/AnySlice' + appIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + minItems: 1 + description: Identification(s) of application to which the subscription applies. When subscribed event is "SERVICE_EXPERIENCE", the absence of applicationIds means subscription to all applications. + dnns: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + minItems: 1 + description: Identification(s) of DNN to which the subscription applies. When subscribed event is "SERVICE_EXPERIENCE", the absence of dnns means subscription to all DNNs. + dnais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnai' + minItems: 1 + event: + $ref: '#/components/schemas/NwdafEvent' + loadLevelThreshold: + type: integer + description: Shall be supplied for notification method "THRESHOLD". Indicates that the NWDAF shall report the corresponding network slice load level to the NF service consumer where the load level of the network slice instance identified by snssai is reached. + notificationMethod: + $ref: '#/components/schemas/NotificationMethod' + matchingDir: + $ref: '#/components/schemas/MatchingDirection' + nfLoadLvlThds: + type: array + items: + $ref: '#/components/schemas/ThresholdLevel' + minItems: 1 + description: Shall be supplied in order to start reporting when an average load level is reached. + nfInstanceIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + minItems: 1 + nfSetIds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + minItems: 1 + nfTypes: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + minItems: 1 + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + qosRequ: + $ref: '#/components/schemas/QosRequirement' + qosFlowRetThds: + type: array + items: + $ref: '#/components/schemas/RetainabilityThreshold' + minItems: 1 + ranUeThrouThds: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + minItems: 1 + repetitionPeriod: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + snssaia: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + description: Identification(s) of network slice to which the subscription applies. When subscribed event is "SLICE_LOAD_LEVEL", either information about slice(s) identified by snssai, or anySlice set to "TRUE" shall be included. It corresponds to snssais in the data model definition of 3GPP TS 29.520. When subscribed is "QOS_SUSTAINABILITY", the identifications of network slices is optional. + maxAnaEntry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + tgtUe: + $ref: '#/components/schemas/TargetUeInformation' + congThresholds: + type: array + items: + $ref: '#/components/schemas/ThresholdLevel' + minItems: 1 + nwPerfRequs: + type: array + items: + $ref: '#/components/schemas/NetworkPerfRequirement' + minItems: 1 + bwRequs: + type: array + items: + $ref: '#/components/schemas/BwRequirement' + minItems: 1 + excepRequs: + type: array + items: + $ref: '#/components/schemas/Exception' + minItems: 1 + exptAnaType: + $ref: '#/components/schemas/ExpectedAnalyticsType' + exptUeBehav: + $ref: 'TS29503_Nudm_SDM.yaml#/components/schemas/ExpectedUeBehaviourData' + required: + - event + NnwdafEventsSubscriptionNotification: + type: object + properties: + eventNotifications: + type: array + items: + $ref: '#/components/schemas/EventNotification' + minItems: 1 + description: Notifications about Individual Events + subscriptionId: + type: string + description: String identifying a subscription to the Nnwdaf_EventsSubscription Service + required: + - eventNotifications + - subscriptionId + EventNotification: + type: object + properties: + event: + $ref: '#/components/schemas/NwdafEvent' + expiry: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + nfLoadLevelInfo: + type: array + items: + $ref: '#/components/schemas/NfLoadLevelInformation' + minItems: 1 + sliceLoadLevelInfo: + $ref: '#/components/schemas/SliceLoadLevelInformation' + svcExps: + type: array + items: + $ref: '#/components/schemas/ServiceExperienceInfo' + minItems: 1 + qosSustainInfos: + type: array + items: + $ref: '#/components/schemas/QosSustainabilityInfo' + minItems: 1 + ueComms: + type: array + items: + $ref: '#/components/schemas/UeCommunication' + minItems: 1 + ueMobs: + type: array + items: + $ref: '#/components/schemas/UeMobility' + minItems: 1 + userDataCongInfos: + type: array + items: + $ref: '#/components/schemas/UserDataCongestionInfo' + minItems: 1 + abnorBehavrs: + type: array + items: + $ref: '#/components/schemas/AbnormalBehaviour' + minItems: 1 + nwPerfs: + type: array + items: + $ref: '#/components/schemas/NetworkPerfInfo' + minItems: 1 + required: + - event + ServiceExperienceInfo: + type: object + properties: + svcExprc: + $ref: 'TS29517_Naf_EventExposure.yaml#/components/schemas/SvcExperience' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + required: + - svcExprc + BwRequirement: + type: object + properties: + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + marBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + marBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + mirBwDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + mirBwUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + required: + - appId + SliceLoadLevelInformation: + type: object + properties: + loadLevelInformation: + $ref: '#/components/schemas/LoadLevelInformation' + snssais: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + minItems: 1 + description: Identification(s) of network slice to which the subscription. + required: + - loadLevelInformation + - snssais + EventReportingRequirement: + allOf: + - $ref: 'TS29523_Npcf_EventExposure.yaml#/components/schemas/ReportingInformation' + - type: object + properties: + accuracy: + $ref: '#/components/schemas/Accuracy' + startTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + TargetUeInformation: + type: object + properties: + anyUe: + type: boolean + supi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + intGroupId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId' + UeMobility: + type: object + properties: + ts: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + recurringTime: + $ref: 'TS29122_CpProvisioning.yaml#/components/schemas/ScheduledCommunicationTime' + duration: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + durationVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + locInfo: + type: array + items: + $ref: '#/components/schemas/LocationInfo' + minItems: 1 + required: + - duration + - locInfo + LocationInfo: + type: object + properties: + loc: + $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - loc + UeCommunication: + type: object + properties: + commDur: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + commDurVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + perioTime: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec' + perioTimeVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + ts: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + recurringTime: + $ref: 'TS29122_CpProvisioning.yaml#/components/schemas/ScheduledCommunicationTime' + trafChar: + $ref: '#/components/schemas/TrafficCharacterization' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - commDur + - trafChar + TrafficCharacterization: + type: object + properties: + dnn: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Dnn' + snssai: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai' + appId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/ApplicationId' + ethfDescs: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + minItems: 1 + maxItems: 2 + fDescs: + type: array + items: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/FlowDescription' + minItems: 1 + maxItems: 2 + ulVol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + ulVolVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + dlVol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + dlVolVariance: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + UserDataCongestionInfo: + type: object + properties: + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + congestionInfo: + $ref: '#/components/schemas/CongestionInfo' + CongestionInfo: + type: object + properties: + congType: + $ref: '#/components/schemas/CongestionType' + timeIntev: + $ref: 'TS29122_CommonData.yaml#/components/schemas/TimeWindow' + nsi: + $ref: '#/components/schemas/ThresholdLevel' + required: + - congType + - timeIntev + - nsi + QosSustainabilityInfo: + type: object + properties: + areaInfo: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + startTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + endTs: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + qosFlowRetThd: + $ref: '#/components/schemas/RetainabilityThreshold' + ranUeThrouThd: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + QosRequirement: + type: object + properties: + 5qi: + $ref: 'TS29571_CommonData.yaml#/components/schemas/5Qi' + gfbrUl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + gfbrDl: + $ref: 'TS29571_CommonData.yaml#/components/schemas/BitRate' + pdb: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketDelBudget' + per: + $ref: 'TS29571_CommonData.yaml#/components/schemas/PacketErrRate' + ThresholdLevel: + type: object + properties: + congLevel: + type: integer + nfLoadLevel: + type: integer + nfCpuUsage: + type: integer + nfMemoryUsage: + type: integer + nfStorageUsage: + type: integer + NfLoadLevelInformation: + type: object + properties: + nfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + nfInstanceId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId' + nfSetId: + $ref: 'TS29571_CommonData.yaml#/components/schemas/NfSetId' + nfStatus: + $ref: '#/components/schemas/NfStatus' + nfCpuUsage: + type: integer + nfMemoryUsage: + type: integer + nfStorageUsage: + type: integer + nfLoadLevelAverage: + type: integer + nfLoadLevelpeak: + type: integer + required: + - nfType + - nfInstanceId + NfStatus: + type: object + properties: + statusRegistered: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + statusUnregistered: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + statusUndiscoverable: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + AnySlice: + type: boolean + description: FALSE represents not applicable for all slices. TRUE represents applicable for all slices. + LoadLevelInformation: + type: integer + description: Load level information of the network slice instance. + AbnormalBehaviour: + type: object + properties: + supis: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi' + excep: + $ref: '#/components/schemas/Exception' + ratio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + confidence: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + addtMeasInfo: + $ref: '#/components/schemas/AdditionalMeasurement' + required: + - excep + Exception: + type: object + properties: + excepId: + $ref: '#/components/schemas/ExceptionId' + excepLevel: + type: integer + excepTrend: + $ref: '#/components/schemas/ExceptionTrend' + required: + - excepId + AdditionalMeasurement: + type: object + properties: + unexpLoc: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + unexpFlowTep: + $ref: '#/components/schemas/FlowDescription' + unexpWake: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + ddosAttack: + $ref: '#/components/schemas/AddressList' + wrgDest: + $ref: '#/components/schemas/AddressList' + circums: + type: array + items: + $ref: '#/components/schemas/CircumstanceDescription' + FlowDescription: + type: object + properties: + ipTrafficFilter: + $ref: 'TS29122_CommonData.yaml#/components/schemas/FlowInfo' + ethTrafficFilter: + $ref: 'TS29514_Npcf_PolicyAuthorization.yaml#/components/schemas/EthFlowDescription' + AddressList: + type: object + properties: + ipv4Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr' + ipv6Addrs: + type: array + items: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr' + CircumstanceDescription: + type: object + properties: + freq: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Float' + tm: + $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime' + locArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + vol: + $ref: 'TS29122_CommonData.yaml#/components/schemas/Volume' + RetainabilityThreshold: + type: object + properties: + relFlowNum: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + relTimeUnit: + $ref: '#/components/schemas/TimeUnit' + relFlowRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + NetworkPerfRequirement: + type: object + properties: + nwPerfType: + $ref: '#/components/schemas/NetworkPerfType' + relativeRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + absoluteNum: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - nwPerfType + NetworkPerfInfo: + type: object + properties: + networkArea: + $ref: 'TS29554_Npcf_BDTPolicyControl.yaml#/components/schemas/NetworkAreaInfo' + nwPerfType: + $ref: '#/components/schemas/NetworkPerfType' + relativeRatio: + $ref: 'TS29571_CommonData.yaml#/components/schemas/SamplingRatio' + absoluteNum: + $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger' + required: + - networkArea + - nwPerfType + NotificationMethod: + anyOf: + - type: string + enum: + - PERIODIC + - THRESHOLD + - 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 + - PERIODIC: The subscribe of NWDAF Event is periodically. The periodic of the notification is identified by repetitionPeriod defined in subclause 5.1.6.2.3. + - THRESHOLD: The subscribe of NWDAF Event is upon threshold exceeded. The threshold of the notification is identified by loadLevelThreshold defined in subclause 5.1.6.2.3. + NwdafEvent: + anyOf: + - type: string + enum: + - SLICE_LOAD_LEVEL + - NETWORK_PERFORMANCE + - NF_LOAD + - SERVICE_EXPERIENCE + - UE_MOBILITY + - UE_COMMUNICATION + - QOS_SUSTAINABILITY + - ABNORMAL_BEHAVIOUR + - USER_DATA_CONGESTION + - 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 + - SLICE_LOAD_LEVEL: Indicates that the event subscribed is load level information of Network Slice instance + - NETWORK_PERFORMANCE: Indicates that the event subscribed is network performance information. + - NF_LOAD: Indicates that the event subscribed is load level and status of one or several Network Functions. + - SERVICE_EXPERIENCE: Indicates that the event subscribed is service experience. + - UE_MOBILITY: Indicates that the event subscribed is UE mobility information. + - UE_COMMUNICATION: Indicates that the event subscribed is UE communication information. + - QOS_SUSTAINABILITY: Indicates that the event subscribed is QoS sustainability. + - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour. + - USER_DATA_CONGESTION: Indicates that the event subscribed is user data congestion information. + Accuracy: + anyOf: + - type: string + enum: + - LOW + - HIGH + - 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 + - LOW: Low accuracy. + - HIGH: High accuracy. + CongestionType: + anyOf: + - type: string + enum: + - USER_PLANE + - CONTROL_PLANE + - USER_AND_CONTROL_PLANE + - 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 + - USER_PLANE: The congestion analytics type is User Plane. + - CONTROL_PLANE: The congestion analytics type is Control Plane. + - USER_AND_CONTROL_PLANE: The congestion analytics type is User Plane and Control Plane. + ExceptionId: + anyOf: + - type: string + enum: + - UNEXPECTED_UE_LOCATION + - UNEXPECTED_LONG_LIVE_FLOW + - UNEXPECTED_LARGE_RATE_FLOW + - UNEXPECTED_WAKEUP + - SUSPICION_OF_DDOS_ATTACK + - WRONG_DESTINATION_ADDRESS + - TOO_FREQUENT_SERVICE_ACCESS + - ABNORMAL_TRAFFIC_VOLUME + - UNEXPECTED_RADIO_LINK_FAILURES + - PING_PONG_ACROSS_CELLS + - 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 + - UNEXPECTED_UE_LOCATION: Unexpected UE location + - UNEXPECTED_LONG_LIVE_FLOW: Unexpected long-live rate flows + - UNEXPECTED_LARGE_RATE_FLOW: Unexpected large rate flows + - UNEXPECTED_WAKEUP: Unexpected wakeup + - SUSPICION_OF_DDOS_ATTACK: Suspicion of DDoS attack + - WRONG_DESTINATION_ADDRESS: Wrong destination address + - TOO_FREQUENT_SERVICE_ACCESS: Too frequent Service Access + - ABNORMAL_TRAFFIC_VOLUME: Abnormal traffic volume + - UNEXPECTED_RADIO_LINK_FAILURES: Unexpected radio link failures + - PING_PONG_ACROSS_CELLS: Ping-ponging across neighbouring cells + ExceptionTrend: + anyOf: + - type: string + enum: + - UP + - DOWN + - UNKNOW + - STABLE + - 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 + - UP: Up trend of the exception level. + - DOWN: Down trend of the exception level. + - UNKNOW: Unknown trend of the exception level. + - STABLE: Stable trend of the exception level. + TimeUnit: + anyOf: + - type: string + enum: + - MINUTE + - HOUR + - DAY + - 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 + - MINUTE: Time unit is per minute. + - HOUR: Time unit is per hour. + - DAY: Time unit is per day. + NetworkPerfType: + anyOf: + - type: string + enum: + - GNB_ACTIVE_RATIO + - GNB_COMPUTING_USAGE + - GNB_MEMORY_USAGE + - GNB_DISK_USAGE + - NUM_OF_UE + - SESS_SUCC_RATIO + - HO_SUCC_RATIO + - 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 + - GNB_ACTIVE_RATIO: Indicates that the network performance requirement is gNodeB active (i.e. up and running) rate. Indicates the ratio of gNB active (i.e. up and running) number to the total number of gNB + - GNB_COMPUTING_USAGE: Indicates gNodeB computing resource usage. + - GNB_MEMORY_USAGE: Indicates gNodeB memory usage. + - GNB_DISK_USAGE: Indicates gNodeB disk usage. + - NUM_OF_UE: Indicates number of UEs. + - SESS_SUCC_RATIO: Indicates ratio of successful setup of PDU sessions to total PDU session setup attempts. + - SESS_SUCC_RATIO: Indicates Ratio of successful handovers to the total handover attempts. + ExpectedAnalyticsType: + anyOf: + - type: string + enum: + - MOBILITY + - COMMUN + - MOBILITY_AND_COMMUN + - 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 + - MOBILITY: Mobility related abnormal behaviour analytics is expected by the consumer. + - COMMUN: Communication related abnormal behaviour analytics is expected by the consumer. + - MOBILITY_AND_COMMUN: Both mobility and communication related abnormal behaviour analytics is expected by the consumer. + MatchingDirection: + anyOf: + - type: string + enum: + - ASCENDING + - DESCENDING + - CROSSED + - 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 + - ASCENDING: Threshold is crossed in ascending direction. + - DESCENDING: Threshold is crossed in descending direction. + - CROSSED: Threshold is crossed either in ascending or descending direction. diff --git a/lib/sbi/support/modified/TS29571_CommonData.yaml b/lib/sbi/support/modified/TS29571_CommonData.yaml new file mode 100644 index 000000000..1c5b06744 --- /dev/null +++ b/lib/sbi/support/modified/TS29571_CommonData.yaml @@ -0,0 +1,1916 @@ +openapi: 3.0.0 +info: + version: '1.2.0.alpha-1' + title: 'Common Data Types' + description: | + Common Data Types for Service Based Interfaces. + (C) 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). + All rights reserved. +externalDocs: + description: 3GPP TS 29.571 Common Data Types for Service Based Interfaces, version 16.0.0 interim + url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.571/' + +paths: {} +components: + schemas: + +# +# Common Data Types for Generic usage definitiones as defined in subclause 5.2 +# + +# +# COMMON SIMPLE DATA TYPES +# + Binary: + format: binary + type: string + BinaryRm: + format: binary + type: string + nullable: true + Bytes: + format: byte + type: string + BytesRm: + format: byte + type: string + nullable: true + Date: + format: date + type: string + DateRm: + format: date + type: string + nullable: true + DateTime: + format: date-time + type: string + DateTimeRm: + format: date-time + type: string + nullable: true + DiameterIdentity: + type: string + pattern: '^([A-Za-z0-9]+([-A-Za-z0-9]+)\.)+[a-z]{2,}$' + DiameterIdentityRm: + type: string + pattern: '^([A-Za-z0-9]+([-A-Za-z0-9]+)\.)+[a-z]{2,}$' + nullable: true + Double: + format: double + type: number + DoubleRm: + format: double + type: number + nullable: true + DurationSec: + type: integer + DurationSecRm: + type: integer + nullable: true + Float: + format: float + type: number + FloatRm: + format: float + type: number + nullable: true + Int32: + format: int32 + type: integer + Int32Rm: + format: int32 + type: integer + nullable: true + Int64: + type: integer + format: int64 + Int64Rm: + format: int64 + type: integer + nullable: true + Ipv4Addr: + type: string + pattern: '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$' + example: '198.51.100.1' + Ipv4AddrRm: + type: string + pattern: '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$' + example: '198.51.100.1' + nullable: true + Ipv6Addr: + type: string +# allOf: +# - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$' +# - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$' + example: '2001:db8:85a3::8a2e:370:7334' + Ipv6AddrRm: + type: string +# allOf: +# - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$' +# - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$' + example: '2001:db8:85a3::8a2e:370:7334' + nullable: true + Ipv6Prefix: + type: string +# allOf: +# - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$' +# - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)$' + example: '2001:db8:abcd:12::0/64' + Ipv6PrefixRm: + type: string +# allOf: +# - pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$' +# - pattern: '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)$' + nullable: true + MacAddr48: + type: string + pattern: '^([0-9a-fA-F]{2})((-[0-9a-fA-F]{2}){5})$' + MacAddr48Rm: + type: string + pattern: '^([0-9a-fA-F]{2})((-[0-9a-fA-F]{2}){5})$' + nullable: true + SupportedFeatures: + type: string + pattern: '^[A-Fa-f0-9]*$' + Uinteger: + type: integer + minimum: 0 + UintegerRm: + type: integer + minimum: 0 + nullable: true + Uint16: + type: integer + minimum: 0 + maximum: 65535 + Uint16Rm: + type: integer + minimum: 0 + maximum: 65535 + nullable: true + Uint32: + format: int32 + type: integer + minimum: 0 + Uint32Rm: + format: int32 + type: integer + minimum: 0 + nullable: true + Uint64: + format: int64 + type: integer + minimum: 0 + Uint64Rm: + format: int64 + type: integer + minimum: 0 + nullable: true + Uri: + type: string + UriRm: + type: string + nullable: true + VarUeId: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + VarUeIdRm: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + nullable: true + TimeZone: + type: string + TimeZoneRm: + type: string + nullable: true + +# +# COMMON ENUMERATED DATA TYPES +# + + PatchOperation: +# anyOf: +# - type: string + enum: + - add + - copy + - move + - remove + - replace + - test + type: string + UriScheme: +# anyOf: +# - type: string + enum: + - http + - https + type: string + ChangeType: +# anyOf: +# - type: string + enum: + - ADD + - MOVE + - REMOVE + - REPLACE + type: string + +# +# COMMON STRUCTURED DATA TYPES +# + + ProblemDetails: + type: object + properties: + type: + $ref: '#/components/schemas/Uri' + title: + type: string + status: + type: integer + detail: + type: string + instance: + $ref: '#/components/schemas/Uri' + cause: + type: string + invalidParams: + type: array + items: + $ref: '#/components/schemas/InvalidParam' + minItems: 1 + supportedFeatures: + $ref: '#/components/schemas/SupportedFeatures' + Link: + type: object + properties: + href: + $ref: '#/components/schemas/Uri' + LinkRm: + type: object + properties: + href: + $ref: '#/components/schemas/Uri' + nullable: true + PatchItem: + type: object + properties: + op: + $ref: '#/components/schemas/PatchOperation' + path: + type: string + from: + type: string + value: + nullable: true + type: string + required: + - op + - path + LinksValueSchema: + oneOf: + - type: array + items: + $ref: '#/components/schemas/Link' + minItems: 1 + - $ref: '#/components/schemas/Link' + SelfLink: + type: object + properties: + self: + $ref: '#/components/schemas/Link' + required: + - self + InvalidParam: + type: object + properties: + param: + type: string + reason: + type: string + required: + - param + ChangeItem: + type: object + properties: + op: + $ref: '#/components/schemas/ChangeType' + path: + type: string + from: + type: string +# origValue: {} +# newValue: {} + origValue: + type: string + newValue: + type: string + required: + - op + - path + NotifyItem: + type: object + required: + - resourceId + - changes + properties: + resourceId: + $ref: '#/components/schemas/Uri' + changes: + type: array + items: + $ref: '#/components/schemas/ChangeItem' + minItems: 1 + ComplexQuery: + oneOf: + - $ref: '#/components/schemas/Cnf' + - $ref: '#/components/schemas/Dnf' + Cnf: + type: object + required: + - cnfUnits + properties: + cnfUnits: + type: array + items: + $ref: '#/components/schemas/CnfUnit' + minItems: 1 + Dnf: + type: object + required: + - dnfUnits + properties: + dnfUnits: + type: array + items: + $ref: '#/components/schemas/DnfUnit' + minItems: 1 + CnfUnit: + type: object + required: + - cnfUnit + properties: + cnfUnit: + type: array + items: + $ref: '#/components/schemas/Atom' + minItems: 1 + DnfUnit: + type: object + required: + - dnfUnit + properties: + dnfUnit: + type: array + items: + $ref: '#/components/schemas/Atom' + minItems: 1 + Atom: + type: object + required: + - attr + - value + properties: + attr: + type: string +# value: {} + value: + type: string + negative: + type: boolean + NFDiscFactors: + type: object + properties: + targetNfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + requesterNfType: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType' + serviceNames: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/ServiceName' + minItems: 1 + uniqueItems: true + requesterNfInstanceFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + targetPlmnList: + type: array + items: + $ref: '#/components/schemas/PlmnId' + minItems: 1 + requesterPlmnList: + type: array + items: + $ref: '#/components/schemas/PlmnId' + minItems: 1 + targetNfInstanceId: + $ref: '#/components/schemas/NfInstanceId' + targetNfFqdn: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + hnrfUri: + $ref: '#/components/schemas/Uri' + snssais: + type: array + items: + $ref: '#/components/schemas/Snssai' + minItems: 1 + plmnSpecificSnssaiList: + type: array + items: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/PlmnSnssai' + minItems: 1 + dnn: + $ref: '#/components/schemas/Dnn' + nsiList: + type: array + items: + type: string + minItems: 1 + tai: + $ref: '#/components/schemas/Tai' + amfRegionId: + $ref: '#/components/schemas/AmfRegionId' + amfSetId: + $ref: '#/components/schemas/AmfSetId' + guami: + $ref: '#/components/schemas/Guami' + supi: + $ref: '#/components/schemas/Supi' + ueIpv4Address: + $ref: '#/components/schemas/Ipv4Addr' + ipDomain: + type: string + ueIpv6Prefix: + $ref: '#/components/schemas/Ipv6Prefix' + pgwInd: + type: boolean + pgw: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/Fqdn' + gpsi: + $ref: '#/components/schemas/Gpsi' + externalGroupIdentity: + type: string + dataSet: + $ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/DataSetId' + routingIndicator: + type: string + pattern: '^[0-9]{1,4}$' + groupIdList: + type: array + items: + $ref: '#/components/schemas/NfGroupId' + minItems: 1 + dnaiList: + type: array + items: + $ref: '#/components/schemas/Dnai' + minItems: 1 + pduSessionTypes: + type: array + items: + $ref: '#/components/schemas/PduSessionType' + minItems: 1 + upfIwkEpsInd: + type: boolean + chfSupportedPlmn: + $ref: '#/components/schemas/PlmnId' + preferredLocality: + type: string + accessType: + $ref: '#/components/schemas/AccessType' + requiredFeatures: + type: array + items: + $ref: '#/components/schemas/SupportedFeatures' + minItems: 1 + complexQuery: + $ref: '#/components/schemas/ComplexQuery' + + + + +# +# Data Types related to Subscription, Identification and Numbering as defined in subclause 5.3 +# + +# +# SIMPLE DATA TYPES +# + Dnn: + type: string + DnnRm: + type: string + nullable: true + Gpsi: + type: string + pattern: '^(msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + GpsiRm: + type: string + pattern: '^(msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$' + nullable: true + GroupId: + type: string + pattern: '^[A-Fa-f0-9]{8}-[0-9]{3}-[0-9]{2,3}-([A-Fa-f0-9][A-Fa-f0-9]){1,10}$' + GroupIdRm: + type: string + pattern: '^[A-Fa-f0-9]{8}-[0-9]{3}-[0-9]{2,3}-([A-Fa-f0-9][A-Fa-f0-9]){1,10}$' + nullable: true + Pei: + type: string + pattern: '^(imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + PeiRm: + type: string + pattern: '^(imei-[0-9]{15}|imeisv-[0-9]{16}|.+)$' + nullable: true + Supi: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|.+)$' + SupiRm: + type: string + pattern: '^(imsi-[0-9]{5,15}|nai-.+|.+)$' + nullable: true + NfInstanceId: + type: string + format: uuid + AmfId: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + AmfRegionId: + type: string + pattern: '^[A-Fa-f0-9]{2}$' + AmfSetId: + type: string + pattern: '^[0-3][A-Fa-f0-9]{2}$' + RfspIndex: + type: integer + minimum: 1 + maximum: 256 + RfspIndexRm: + type: integer + minimum: 1 + maximum: 256 + nullable: true + NfGroupId: + type: string + MtcProviderInformation: + type: string + +# +# STRUCTURED DATA TYPES +# + Guami: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + 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 + NetworkId: + type: object + properties: + mnc: + $ref: '#/components/schemas/Mnc' + mcc: + $ref: '#/components/schemas/Mcc' + + +# +# Data Types related to 5G Network as defined in subclause 5.4 +# + +# +# SIMPLE DATA TYPES +# + ApplicationId: + type: string + ApplicationIdRm: + type: string + nullable: true + PduSessionId: + type: integer + minimum: 0 + maximum: 255 + Mcc: + type: string + pattern: '^\d{3}$' + MccRm: + type: string + pattern: '^\d{3}$' + nullable: true + Mnc: + type: string + pattern: '^\d{2,3}$' + MncRm: + type: string + pattern: '^\d{2,3}$' + nullable: true + Tac: + type: string + pattern: '(^[A-Fa-f0-9]{4}$)|(^[A-Fa-f0-9]{6}$)' + TacRm: + type: string + pattern: '(^[A-Fa-f0-9]{4}$)|(^[A-Fa-f0-9]{6}$)' + nullable: true + EutraCellId: + type: string + pattern: '^[A-Fa-f0-9]{7}$' + EutraCellIdRm: + type: string + pattern: '^[A-Fa-f0-9]{7}$' + nullable: true + NrCellId: + type: string + pattern: '^[A-Fa-f0-9]{9}$' + NrCellIdRm: + type: string + pattern: '^[A-Fa-f0-9]{9}$' + nullable: true + Dnai: + type: string + DnaiRm: + type: string + nullable: true + 5GMmCause: + $ref: '#/components/schemas/Uinteger' + AmfName: + type: string + AreaCode: + type: string + AreaCodeRm: + type: string + nullable: true + N3IwfId: + 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})$' + +# +# ENUMERATED DATA TYPES +# + + AccessType: + type: string + enum: + - 3GPP_ACCESS + - NON_3GPP_ACCESS + AccessTypeRm: + type: string + enum: + - 3GPP_ACCESS + - NON_3GPP_ACCESS + nullable: true + RatType: + anyOf: + - type: string + enum: + - NR + - EUTRA + - WLAN + - VIRTUAL + - NBIOT + - type: string + RatTypeRm: + anyOf: + - type: string + enum: + - NR + - EUTRA + - WLAN + - VIRTUAL + - NBIOT + - type: string + nullable: true + PduSessionType: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - IPV4V6 + - UNSTRUCTURED + - ETHERNET + - type: string + PduSessionTypeRm: + anyOf: + - type: string + enum: + - IPV4 + - IPV6 + - IPV4V6 + - UNSTRUCTURED + - ETHERNET + - type: string + nullable: true + UpIntegrity: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + UpIntegrityRm: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + nullable: true + UpConfidentiality: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + UpConfidentialityRm: + anyOf: + - type: string + enum: + - REQUIRED + - PREFERRED + - NOT_NEEDED + - type: string + nullable: true + SscMode: + anyOf: + - type: string + enum: + - SSC_MODE_1 + - SSC_MODE_2 + - SSC_MODE_3 + - type: string + SscModeRm: + anyOf: + - type: string + enum: + - SSC_MODE_1 + - SSC_MODE_2 + - SSC_MODE_3 + - type: string + nullable: true + DnaiChangeType: + anyOf: + - type: string + enum: + - EARLY + - EARLY_LATE + - LATE + - 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 + - EARLY: Early notification of UP path reconfiguration. + - EARLY_LATE: Early and late notification of UP path reconfiguration. This value shall only be present in the subscription to the DNAI change event. + - LATE: Late notification of UP path reconfiguration. + DnaiChangeTypeRm: + anyOf: + - type: string + enum: + - EARLY + - EARLY_LATE + - LATE + - type: string + nullable: true + RestrictionType: + anyOf: + - type: string + enum: + - ALLOWED_AREAS + - NOT_ALLOWED_AREAS + - type: string + RestrictionTypeRm: + anyOf: + - type: string + enum: + - ALLOWED_AREAS + - NOT_ALLOWED_AREAS + - type: string + nullable: true + CoreNetworkType: + anyOf: + - type: string + enum: + - 5GC + - EPC + - type: string + CoreNetworkTypeRm: + anyOf: + - type: string + enum: + - 5GC + - EPC + - type: string + nullable: true + PresenceState: + anyOf: + - type: string + enum: + - IN_AREA + - OUT_OF_AREA + - UNKNOWN + - INACTIVE + - type: string + +# +# STRUCTURED DATA TYPES +# + + Snssai: + type: object + properties: + sst: + type: integer + minimum: 0 + maximum: 255 + sd: + type: string + pattern: '^[A-Fa-f0-9]{6}$' + required: + - sst + PlmnId: + type: object + properties: + mcc: + $ref: '#/components/schemas/Mcc' + mnc: + $ref: '#/components/schemas/Mnc' + required: + - mcc + - mnc + PlmnIdRm: + type: object + properties: + mcc: + $ref: '#/components/schemas/Mcc' + mnc: + $ref: '#/components/schemas/Mnc' + required: + - mcc + - mnc + nullable: true + Tai: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + tac: + $ref: '#/components/schemas/Tac' + required: + - plmnId + - tac + TaiRm: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + tac: + $ref: '#/components/schemas/Tac' + required: + - plmnId + - tac + nullable: true + Ecgi: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + # PLMN Identity + eutraCellId: + $ref: '#/components/schemas/EutraCellId' + required: + - plmnId + - eutraCellId + EcgiRm: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + # PLMN Identity + eutraCellId: + $ref: '#/components/schemas/EutraCellId' + required: + - plmnId + - eutraCellId + nullable: true + Ncgi: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + nrCellId: + $ref: '#/components/schemas/NrCellId' + required: + - plmnId + - nrCellId + NcgiRm: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + nrCellId: + $ref: '#/components/schemas/NrCellId' + required: + - plmnId + - nrCellId + nullable: true + UserLocation: + type: object + properties: + eutraLocation: + $ref: '#/components/schemas/EutraLocation' + nrLocation: + $ref: '#/components/schemas/NrLocation' + n3gaLocation: + $ref: '#/components/schemas/N3gaLocation' + EutraLocation: + 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' + required: + - 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' + required: + - tai + - ecgi + nullable: true + NrLocation: + type: object + properties: + tai: + $ref: '#/components/schemas/Tai' + ncgi: + $ref: '#/components/schemas/Ncgi' + 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 + NrLocationRm: + type: object + properties: + tai: + $ref: '#/components/schemas/Tai' + ncgi: + $ref: '#/components/schemas/Ncgi' + 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 + N3gaLocation: + type: object + properties: + n3gppTai: + $ref: '#/components/schemas/Tai' + n3IwfId: + type: string + pattern: '^[A-Fa-f0-9]+$' + ueIpv4Addr: + $ref: '#/components/schemas/Ipv4Addr' + ueIpv6Addr: + $ref: '#/components/schemas/Ipv6Addr' + portNumber: + $ref: '#/components/schemas/Uinteger' + UpSecurity: + type: object + properties: + upIntegr: + $ref: '#/components/schemas/UpIntegrity' + upConfid: + $ref: '#/components/schemas/UpConfidentiality' + required: + - upIntegr + - upConfid + UpSecurityRm: + type: object + properties: + upIntegr: + $ref: '#/components/schemas/UpIntegrity' + upConfid: + $ref: '#/components/schemas/UpConfidentiality' + required: + - upIntegr + - upConfid + nullable: true + NgApCause: + type: object + properties: + group: + $ref: '#/components/schemas/Uinteger' + value: + $ref: '#/components/schemas/Uinteger' + required: + - group + - value + BackupAmfInfo: + type: object + properties: + backupAmf: + $ref: '#/components/schemas/AmfName' + guamiList: + type: array + items: + $ref: '#/components/schemas/Guami' + minItems: 1 + required: + - backupAmf + RefToBinaryData: + type: object + properties: + contentId: + type: string + required: + - contentId + RefToBinaryDataRm: + type: object + properties: + contentId: + type: string + required: + - contentId + nullable: true + RouteToLocation: + type: object + properties: + dnai: + $ref: '#/components/schemas/Dnai' + routeInfo: + $ref: '#/components/schemas/RouteInformation' + routeProfId: + type: string + nullable: true + required: + - dnai + anyOf: + - required: [ routeInfo ] + - required: [ routeProfId ] + nullable: true + RouteInformation: + type: object + properties: + ipv4Addr: + $ref: '#/components/schemas/Ipv4Addr' + ipv6Addr: + $ref: '#/components/schemas/Ipv6Addr' + portNumber: + $ref: '#/components/schemas/Uinteger' + required: + - portNumber + nullable: true + SubscribedDefaultQos: + type: object + required: + - 5qi + - arp + properties: + 5qi: + $ref: '#/components/schemas/5Qi' + arp: + $ref: '#/components/schemas/Arp' + priorityLevel: + $ref: '#/components/schemas/5QiPriorityLevel' + Area: + type: object + oneOf: + - required: + - tacs + - required: + - areaCode + properties: + tacs: + type: array + items: + $ref: '#/components/schemas/Tac' + minItems: 1 + areaCode: + $ref: '#/components/schemas/AreaCode' + ServiceAreaRestriction: + type: object + properties: + restrictionType: + $ref: '#/components/schemas/RestrictionType' + areas: + type: array + items: + $ref: '#/components/schemas/Area' + maxNumOfTAs: + $ref: '#/components/schemas/Uinteger' + maxNumOfTAsForNotAllowedAreas: + $ref: '#/components/schemas/Uinteger' + allOf: + # + # 1st condition: restrictionType and areas attributes shall be either both absent + # or both present + # + - oneOf: + - not: + required: [ restrictionType ] + - required: [ areas ] + # + # 2nd condition: if restrictionType takes value NOT_ALLOWED_AREAS, + # then maxNumOfTAs shall be absent + # + - anyOf: + - not: + required: [ restrictionType ] + properties: + restrictionType: + type: string + enum: [ NOT_ALLOWED_AREAS ] + - not: + required: [ maxNumOfTAs ] + # + # 3rd condition: if restrictionType takes value ALLOWED_AREAS, + # then maxNumOfTAsForNotAllowedAreas shall be absent + # + - anyOf: + - not: + required: [ restrictionType ] + properties: + restrictionType: + type: string + enum: [ ALLOWED_AREAS ] + - not: + required: [ maxNumOfTAsForNotAllowedAreas ] + PresenceInfo: + type: object + properties: + praId: + type: string + presenceState: + $ref: '#/components/schemas/PresenceState' + trackingAreaList: + type: array + items: + $ref: '#/components/schemas/Tai' + minItems: 1 + ecgiList: + type: array + items: + $ref: '#/components/schemas/Ecgi' + minItems: 1 + ncgiList: + type: array + items: + $ref: '#/components/schemas/Ncgi' + minItems: 1 + globalRanNodeIdList: + type: array + items: + $ref: '#/components/schemas/GlobalRanNodeId' + minItems: 1 + PresenceInfoRm: + type: object + properties: + praId: + type: string + presenceState: + $ref: '#/components/schemas/PresenceState' + trackingAreaList: + type: array + items: + $ref: '#/components/schemas/Tai' + minItems: 0 + ecgiList: + type: array + items: + $ref: '#/components/schemas/Ecgi' + minItems: 0 + ncgiList: + type: array + items: + $ref: '#/components/schemas/Ncgi' + minItems: 0 + globalRanNodeIdList: + type: array + items: + $ref: '#/components/schemas/GlobalRanNodeId' + nullable: true + GlobalRanNodeId: + type: object + properties: + plmnId: + $ref: '#/components/schemas/PlmnId' + n3IwfId: + $ref: '#/components/schemas/N3IwfId' + gNbId: + $ref: '#/components/schemas/GNbId' + ngeNbId: + $ref: '#/components/schemas/NgeNbId' + oneOf: + - required: [ n3IwfId ] + - required: [ gNbId ] + - required: [ ngeNbId ] + required: + - plmnId + GNbId: + type: object + properties: + bitLength: + type: integer + minimum: 22 + maximum: 32 + gNBValue: + type: string + pattern: '^[A-Fa-f0-9]{6,8}$' + required: + - bitLength + - gNBValue + MaPduCapability: + type: object + properties: + atsssLL: + type: boolean + default: false + mptcp: + type: boolean + default: boolean + AtsssCapability: + type: object + properties: + atsssLL: + type: boolean + default: false + mptcp: + type: boolean + default: false + + +# +# Data Types related to 5G QoS as defined in subclause 5.5 +# + +# +# SIMPLE DATA TYPES +# +# + Qfi: + type: integer + minimum: 0 + maximum: 63 + QfiRm: + type: integer + minimum: 0 + maximum: 63 + nullable: true + 5Qi: + type: integer + minimum: 0 + maximum: 255 + 5QiRm: + type: integer + minimum: 0 + maximum: 255 + nullable: true + BitRate: + type: string + pattern: '^\d+(\.\d+)? (bps|Kbps|Mbps|Gbps|Tbps)$' + BitRateRm: + type: string + pattern: '^\d+(\.\d+)? (bps|Kbps|Mbps|Gbps|Tbps)$' + nullable: true + ArpPriorityLevelRm: + type: integer + minimum: 1 + maximum: 15 + nullable: true + ArpPriorityLevel: + type: integer + minimum: 1 + maximum: 15 + nullable: true + description: nullable true shall not be used for this attribute + 5QiPriorityLevel: + type: integer + minimum: 1 + maximum: 127 + 5QiPriorityLevelRm: + type: integer + minimum: 1 + maximum: 127 + nullable: true + PacketDelBudget: + type: integer + minimum: 1 + PacketDelBudgetRm: + type: integer + minimum: 1 + nullable: true + PacketErrRate: + type: string + pattern: '^([0-9]E-[0-9])$' + PacketErrRateRm: + type: string + pattern: '^([0-9]E-[0-9])$' + nullable: true + PacketLossRate: + type: integer + minimum: 0 + maximum: 1000 + PacketLossRateRm: + type: integer + minimum: 0 + maximum: 1000 + nullable: true + AverWindow: + type: integer + minimum: 1 + maximum: 4095 + default: 2000 + AverWindowRm: + type: integer + maximum: 4095 + default: 2000 + minimum: 1 + nullable: true + MaxDataBurstVol: + type: integer + minimum: 1 + maximum: 4095 + MaxDataBurstVolRm: + type: integer + minimum: 1 + maximum: 4095 + nullable: true + SampleRatio: + type: integer + minimum: 1 + maximum: 100 + SampleRatioRm: + type: integer + minimum: 1 + maximum: 100 + nullable: true + +# +# ENUMERATED DATA TYPES +# + + PreemptionCapability: + anyOf: + - type: string + enum: + - NOT_PREEMPT + - MAY_PREEMPT + - type: string + PreemptionCapabilityRm: + anyOf: + - type: string + enum: + - NOT_PREEMPT + - MAY_PREEMPT + - type: string + nullable: true + PreemptionVulnerability: + anyOf: + - type: string + enum: + - NOT_PREEMPTABLE + - PREEMPTABLE + - type: string + PreemptionVulnerabilityRm: + anyOf: + - type: string + enum: + - NOT_PREEMPTABLE + - PREEMPTABLE + - type: string + nullable: true + ReflectiveQoSAttribute: + anyOf: + - type: string + enum: + - RQOS + - NO_RQOS + - type: string + ReflectiveQoSAttributeRm: + anyOf: + - type: string + enum: + - RQOS + - NO_RQOS + - type: string + nullable: true + NotificationControl: + anyOf: + - type: string + enum: + - REQUESTED + - NOT_REQUESTED + - type: string + NotificationControlRm: + anyOf: + - type: string + enum: + - REQUESTED + - NOT_REQUESTED + - type: string + nullable: true + QosResourceType: + anyOf: + - type: string + enum: + - NON_GBR + - NON_CRITICAL_GBR + - CRITICAL_GBR + - type: string + QosResourceTypeRm: + anyOf: + - type: string + enum: + - NON_GBR + - NON_CRITICAL_GBR + - CRITICAL_GBR + - type: string + nullable: true + AdditionalQosFlowInfo: + anyOf: + - type: string + enum: + - MORE_LIKELY + - type: string + nullable: true +# + +# +# STRUCTURED DATA TYPES +# + + Arp: + type: object + properties: + priorityLevel: + $ref: '#/components/schemas/ArpPriorityLevel' + preemptCap: + $ref: '#/components/schemas/PreemptionCapability' + preemptVuln: + $ref: '#/components/schemas/PreemptionVulnerability' + required: + - priorityLevel + - 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 + Ambr: + type: object + properties: + uplink: + $ref: '#/components/schemas/BitRate' + downlink: + $ref: '#/components/schemas/BitRate' + required: + - uplink + - downlink + AmbrRm: + type: object + properties: + uplink: + $ref: '#/components/schemas/BitRate' + downlink: + $ref: '#/components/schemas/BitRate' + required: + - uplink + - downlink + nullable: true + Dynamic5Qi: + type: object + properties: + resourceType: + $ref: '#/components/schemas/QosResourceType' + priorityLevel: + $ref: '#/components/schemas/5QiPriorityLevel' + packetDelayBudget: + $ref: '#/components/schemas/PacketDelBudget' + packetErrRate: + $ref: '#/components/schemas/PacketErrRate' + averWindow: + $ref: '#/components/schemas/AverWindow' + maxDataBurstVol: + $ref: '#/components/schemas/MaxDataBurstVol' + required: + - resourceType + - priorityLevel + - packetDelayBudget + - packetErrRate + NonDynamic5Qi: + type: object + properties: + priorityLevel: + $ref: '#/components/schemas/5QiPriorityLevel' + averWindow: + $ref: '#/components/schemas/AverWindow' + maxDataBurstVol: + $ref: '#/components/schemas/MaxDataBurstVol' + minProperties: 0 + +# +# Data Types related to 5G Trace as defined in subclause 5.6 +# + +# +# SIMPLE DATA TYPES +# +# +# +# Enumerations +# + TraceDepth: + anyOf: + - type: string + enum: + - MINIMUM + - MEDIUM + - MAXIMUM + - MINIMUM_WO_VENDOR_EXTENSION + - MEDIUM_WO_VENDOR_EXTENSION + - MAXIMUM_WO_VENDOR_EXTENSION + - type: string + TraceDepthRm: + anyOf: + - type: string + enum: + - MINIMUM + - MEDIUM + - MAXIMUM + - MINIMUM_WO_VENDOR_EXTENSION + - MEDIUM_WO_VENDOR_EXTENSION + - MAXIMUM_WO_VENDOR_EXTENSION + - type: string + nullable: true +# +# STRUCTURED DATA TYPES +# + TraceData: + type: object + nullable: true + properties: + traceRef: + type: string + pattern: '^[0-9]{3}[0-9]{2,3}-[A-Fa-f0-9]{6}$' + traceDepth: + $ref: '#/components/schemas/TraceDepth' + neTypeList: + type: string + pattern: '^[A-Fa-f0-9]+$' + eventList: + type: string + pattern: '^[A-Fa-f0-9]+$' + collectionEntityIpv4Addr: + $ref: '#/components/schemas/Ipv4Addr' + collectionEntityIpv6Addr: + $ref: '#/components/schemas/Ipv6Addr' + interfaceList: + type: string + pattern: '^[A-Fa-f0-9]+$' + required: + - traceRef + - traceDepth + - neTypeList + - eventList + + +# Data Types related to 5G ODB as defined in subclause 5.7 + +# +# SIMPLE DATA TYPES +# +# +# +# Enumerations +# + RoamingOdb: + anyOf: + - type: string + enum: + - OUTSIDE_HOME_PLMN + - OUTSIDE_HOME_PLMN_COUNTRY + - type: string + + OdbPacketServices: + anyOf: + - type: string + enum: + - ALL_PACKET_SERVICES + - ROAMER_ACCESS_HPLMN_AP + - ROAMER_ACCESS_VPLMN_AP + - type: string + nullable: true + +# +# STRUCTURED DATA TYPES +# + + OdbData: + type: object + properties: + roamingOdb: + $ref: '#/components/schemas/RoamingOdb' + +# +# Data Types related to Charging as defined in subclause 5.8 +# + +# +# SIMPLE DATA TYPES +# +# + ChargingId: + $ref: '#/components/schemas/Uint32' + + RatingGroup: + $ref: '#/components/schemas/Uint32' + + ServiceId: + $ref: '#/components/schemas/Uint32' + + +# +# Enumerations +# + +# +# STRUCTURED DATA TYPES +# + SecondaryRatUsageReport: + type: object + properties: + secondaryRatType: + $ref: '#/components/schemas/RatType' + qosFlowsUsageData: + type: array + items: + $ref: '#/components/schemas/QosFlowUsageReport' + minItems: 1 + required: + - secondaryRatType + - qosFlowsUsageData + + QosFlowUsageReport: + type: object + properties: + qfi: + $ref: '#/components/schemas/Qfi' + startTimeStamp: + $ref: '#/components/schemas/DateTime' + endTimeStamp: + $ref: '#/components/schemas/DateTime' + downlinkVolume: + $ref: '#/components/schemas/Int64' + uplinkVolume: + $ref: '#/components/schemas/Int64' + required: + - qfi + - startTimeStamp + - endTimeStamp + - downlinkVolume + - uplinkVolume + + SecondaryRatUsageInfo: + type: object + properties: + secondaryRatType: + $ref: '#/components/schemas/RatType' + qosFlowsUsageData: + type: array + items: + $ref: '#/components/schemas/QosFlowUsageReport' + minItems: 1 + pduSessionUsageData: + type: array + items: + $ref: '#/components/schemas/VolumeTimedReport' + minItems: 1 + required: + - secondaryRatType + + VolumeTimedReport: + type: object + properties: + startTimeStamp: + $ref: '#/components/schemas/DateTime' + endTimeStamp: + $ref: '#/components/schemas/DateTime' + downlinkVolume: + $ref: '#/components/schemas/Int64' + uplinkVolume: + $ref: '#/components/schemas/Int64' + required: + - startTimeStamp + - endTimeStamp + - downlinkVolume + - uplinkVolume + + +# +# HTTP responses +# + + responses: + '400': + description: Bad request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '401': + description: Unauthorized + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '403': + description: Forbidden + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '404': + description: Not Found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '405': + description: Method Not Allowed + '408': + description: Request Timeout + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '406': + description: 406 Not Acceptable + '409': + description: Conflict + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '410': + description: Gone + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '411': + description: Length Required + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '412': + description: Precondition Failed + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '413': + description: Payload Too Large + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '414': + description: URI Too Long + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '415': + description: Unsupported Media Type + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '429': + description: Too Many Requests + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '501': + description: Not Implemented + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '503': + description: Service Unavailable + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + '504': + description: Gateway Timeout + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + default: + description: Generic Error diff --git a/lib/sbi/yuarel.c b/lib/sbi/yuarel.c new file mode 100644 index 000000000..db8c38837 --- /dev/null +++ b/lib/sbi/yuarel.c @@ -0,0 +1,314 @@ +/** + * Copyright (C) 2016,2017 Jack Engqvist Johansson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include +#include +#include +#include "yuarel.h" + +/** + * Parse a non null terminated string into an integer. + * + * str: the string containing the number. + * len: Number of characters to parse. + */ +static inline int +natoi(const char *str, size_t len) +{ + int i, r = 0; + for (i = 0; i < len; i++) { + r *= 10; + r += str[i] - '0'; + } + + return r; +} + +/** + * Check if a URL is relative (no scheme and hostname). + * + * url: the string containing the URL to check. + * + * Returns 1 if relative, otherwise 0. + */ +static inline int +is_relative(const char *url) +{ + return (*url == '/') ? 1 : 0; +} + +/** + * Parse the scheme of a URL by inserting a null terminator after the scheme. + * + * str: the string containing the URL to parse. Will be modified. + * + * Returns a pointer to the hostname on success, otherwise NULL. + */ +static inline char * +parse_scheme(char *str) +{ + char *s; + + /* If not found or first in string, return error */ + s = strchr(str, ':'); + if (s == NULL || s == str) { + return NULL; + } + + /* If not followed by two slashes, return error */ + if (s[1] == '\0' || s[1] != '/' || s[2] == '\0' || s[2] != '/') { + return NULL; + } + + *s = '\0'; // Replace ':' with NULL + + return s + 3; +} + +/** + * Find a character in a string, replace it with '\0' and return the next + * character in the string. + * + * str: the string to search in. + * find: the character to search for. + * + * Returns a pointer to the character after the one to search for. If not + * found, NULL is returned. + */ +static inline char * +find_and_terminate(char *str, char find) +{ + str = strchr(str, find); + if (NULL == str) { + return NULL; + } + + *str = '\0'; + return str + 1; +} + +/* Yes, the following functions could be implemented as preprocessor macros + instead of inline functions, but I think that this approach will be more + clean in this case. */ +static inline char * +find_fragment(char *str) +{ + return find_and_terminate(str, '#'); +} + +static inline char * +find_query(char *str) +{ + return find_and_terminate(str, '?'); +} + +static inline char * +find_path(char *str) +{ + return find_and_terminate(str, '/'); +} + +/** + * Parse a URL string to a struct. + * + * url: pointer to the struct where to store the parsed URL parts. + * u: the string containing the URL to be parsed. + * + * Returns 0 on success, otherwise -1. + */ +int +yuarel_parse(struct yuarel *url, char *u) +{ + if (NULL == url || NULL == u) { + return -1; + } + + memset(url, 0, sizeof (struct yuarel)); + + /* (Fragment) */ + url->fragment = find_fragment(u); + + /* (Query) */ + url->query = find_query(u); + + /* Relative URL? Parse scheme and hostname */ + if (!is_relative(u)) { + /* Scheme */ + url->scheme = u; + u = parse_scheme(u); + if (u == NULL) { + return -1; + } + + /* Host */ + if ('\0' == *u) { + return -1; + } + url->host = u; + + /* (Path) */ + url->path = find_path(u); + + /* (Credentials) */ + u = strchr(url->host, '@'); + if (NULL != u) { + /* Missing credentials? */ + if (u == url->host) { + return -1; + } + + url->username = url->host; + url->host = u + 1; + *u = '\0'; + + u = strchr(url->username, ':'); + if (NULL == u) { + return -1; + } + + url->password = u + 1; + *u = '\0'; + } + + /* Missing hostname? */ + if ('\0' == *url->host) { + return -1; + } + + /* (Port) */ + // If hostname starts with square bracket, it is IPv6 literal + // example: + // http://[1080:0:0:0:8:800:200C:417A]:80/index.html + // http://[3ffe:2a00:100:7031::1] + // http://[::192.9.5.5]/ipng + if ('[' == url->host[0]) { + u = strchr(url->host, ']'); + if (NULL != u) { + url->host++; + *(u++) = '\0'; + if ('\0' == *u) { + u = NULL; + } else if (':' != *u) { + return -1; + } + } else { + return -1; + } + } else { + u = strchr(url->host, ':'); + } + if (NULL != u && (NULL == url->path || u < url->path)) { + *(u++) = '\0'; + if ('\0' == *u) { + return -1; + } + + if (url->path) { + url->port = natoi(u, url->path - u - 1); + } else { + url->port = atoi(u); + } + } + + /* Missing hostname? */ + if ('\0' == *url->host) { + return -1; + } + } else { + /* (Path) */ + url->path = find_path(u); + } + + return 0; +} + +/** + * Split a path into several strings. + * + * No data is copied, the slashed are used as null terminators and then + * pointers to each path part will be stored in **parts. Double slashes will be + * treated as one. + * + * path: the path to split. + * parts: a pointer to an array of (char *) where to store the result. + * max_parts: max number of parts to parse. + */ +int +yuarel_split_path(char *path, char **parts, int max_parts) +{ + int i = 0; + + if (NULL == path || '\0' == *path) { + return -1; + } + + do { + /* Forward to after slashes */ + while (*path == '/') path++; + + if ('\0' == *path) { + break; + } + + parts[i++] = path; + + path = strchr(path, '/'); + if (NULL == path) { + break; + } + + *(path++) = '\0'; + } while (i < max_parts); + + return i; +} + +int +yuarel_parse_query(char *query, char delimiter, struct yuarel_param *params, int max_params) +{ + int i = 0; + + if (NULL == query || '\0' == *query) { + return -1; + } + + params[i++].key = query; + while (i < max_params && NULL != (query = strchr(query, delimiter))) { + *query = '\0'; + params[i].key = ++query; + params[i].val = NULL; + + /* Go back and split previous param */ + if (i > 0) { + if ((params[i - 1].val = strchr(params[i - 1].key, '=')) != NULL) { + *(params[i - 1].val)++ = '\0'; + } + } + i++; + } + + /* Go back and split last param */ + if ((params[i - 1].val = strchr(params[i - 1].key, '=')) != NULL) { + *(params[i - 1].val)++ = '\0'; + } + + return i; +} diff --git a/lib/sbi/yuarel.h b/lib/sbi/yuarel.h new file mode 100644 index 000000000..8a8c1cdf6 --- /dev/null +++ b/lib/sbi/yuarel.h @@ -0,0 +1,115 @@ +/** + * Copyright (C) 2016 Jack Engqvist Johansson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef INC_YUAREL_H +#define INC_YUAREL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The struct where the parsed values will be stored: + * + * scheme ":" [ "//" ] [ username ":" password "@" ] host [ ":" port ] [ "/" ] [ path ] [ "?" query ] + * + * Note: to make sure that no strings are copied, the first slash "/" in the + * path will be used to null terminate the hostname if no port is supplied. + */ +struct yuarel { + char *scheme; /* scheme, without ":" and "//" */ + char *username; /* username, default: NULL */ + char *password; /* password, default: NULL */ + char *host; /* hostname or IP address */ + int port; /* port, default: 0 */ + char *path; /* path, without leading "/", default: NULL */ + char *query; /* query, default: NULL */ + char *fragment; /* fragment, default: NULL */ +}; + +/* A struct to hold the query string parameter values. */ +struct yuarel_param { + char *key; + char *val; +}; + +/** + * Parse a URL to a struct. + * + * The URL string should be in one of the following formats: + * + * Absolute URL: + * scheme ":" [ "//" ] [ username ":" password "@" ] host [ ":" port ] [ "/" ] [ path ] [ "?" query ] [ "#" fragment ] + * + * Relative URL: + * path [ "?" query ] [ "#" fragment ] + * + * The following parts will be parsed to the corresponding struct member. + * + * *url: a pointer to the struct where to store the parsed values. + * *url_str: a pointer to the url to be parsed (null terminated). The string + * will be modified. + * + * Returns 0 on success, otherwise -1. + */ +extern int yuarel_parse(struct yuarel *url, char *url_str); + +/** + * Split a path into several strings. + * + * No data is copied, the slashed are used as null terminators and then + * pointers to each path part will be stored in **parts. Double slashes will be + * treated as one. + * + * *path: the path to split. The string will be modified. + * **parts: a pointer to an array of (char *) where to store the result. + * max_parts: max number of parts to parse. + * + * Returns the number of parsed items. -1 on error. + */ +extern int yuarel_split_path(char *path, char **parts, int max_parts); + +/** + * Parse a query string into a key/value struct. + * + * The query string should be a null terminated string of parameters separated by + * a delimiter. Each parameter are checked for the equal sign character. If it + * appears in the parameter, it will be used as a null terminator and the part + * that comes after it will be the value of the parameter. + * + * No data are copied, the equal sign and delimiters are used as null + * terminators and then pointers to each parameter key and value will be stored + * in the yuarel_param struct. + * + * *query: the query string to parse. The string will be modified. + * delimiter: the character that separates the key/value pairs from eachother. + * *params: an array of (struct yuarel_param) where to store the result. + * max_values: max number of parameters to parse. + * + * Returns the number of parsed items. -1 on error. + */ +extern int yuarel_parse_query(char *query, char delimiter, struct yuarel_param *params, int max_params); + +#ifdef __cplusplus +} +#endif + +#endif /* INC_YUAREL_H */ diff --git a/meson.build b/meson.build index 98a643f0f..d9d015993 100644 --- a/meson.build +++ b/meson.build @@ -16,7 +16,7 @@ # along with this program. If not, see . project('open5gs', 'c', - version : '1.2.4', + version : '1.2.5', license : 'AGPL-3.0-or-later', meson_version : '>= 0.43.0', default_options : [ @@ -24,7 +24,7 @@ project('open5gs', 'c', ], ) -libogslib_version = '1.2.4' +libogslib_version = '1.2.5' prefix = get_option('prefix') bindir = join_paths(prefix, get_option('bindir')) diff --git a/src/meson.build b/src/meson.build index 2aa67023f..fc366e9f4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -27,5 +27,6 @@ subdir('sgw') subdir('pgw') subdir('pcrf') +subdir('nrf') subdir('smf') subdir('upf') diff --git a/src/mme/mme-event.c b/src/mme/mme-event.c index 4ca8eb0d9..04005d040 100644 --- a/src/mme/mme-event.c +++ b/src/mme/mme-event.c @@ -57,6 +57,8 @@ mme_event_t *mme_event_new(mme_event_e id) e = ogs_calloc(1, sizeof *e); ogs_assert(e); + memset(e, 0, sizeof(*e)); + e->id = id; return e; diff --git a/src/nrf/app.c b/src/nrf/app.c new file mode 100644 index 000000000..f83c85330 --- /dev/null +++ b/src/nrf/app.c @@ -0,0 +1,40 @@ +/* + * 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 "ogs-app.h" + +int app_initialize(const char *const argv[]) +{ + int rv; + + rv = nrf_initialize(); + if (rv != OGS_OK) { + ogs_error("Failed to intialize NRF"); + return rv; + } + ogs_info("NRF initialize...done"); + + return OGS_OK; +} + +void app_terminate(void) +{ + nrf_terminate(); + ogs_info("NRF terminate...done"); +} diff --git a/src/nrf/context.c b/src/nrf/context.c new file mode 100644 index 000000000..e4792b74b --- /dev/null +++ b/src/nrf/context.c @@ -0,0 +1,81 @@ +/* + * 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 "ogs-dbi.h" +#include "context.h" + +static nrf_context_t self; + +int __nrf_log_domain; + +static int context_initialized = 0; + +void nrf_context_init(void) +{ + ogs_assert(context_initialized == 0); + + /* Initialize NRF context */ + memset(&self, 0, sizeof(nrf_context_t)); + + ogs_log_install_domain(&__ogs_dbi_domain, "dbi", ogs_core()->log.level); + ogs_log_install_domain(&__nrf_log_domain, "nrf", ogs_core()->log.level); + + context_initialized = 1; +} + +void nrf_context_final(void) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL, *next_nf_instance = NULL; + + ogs_assert(context_initialized == 1); + + ogs_list_for_each_safe( + &ogs_sbi_self()->nf_instance_list, next_nf_instance, nf_instance) + nrf_nf_fsm_fini(nf_instance); + + context_initialized = 0; +} + +nrf_context_t *nrf_self(void) +{ + return &self; +} + +static int nrf_context_prepare(void) +{ + return OGS_OK; +} + +static int nrf_context_validation(void) +{ + return OGS_OK; +} + +int nrf_context_parse_config(void) +{ + int rv; + + rv = nrf_context_prepare(); + if (rv != OGS_OK) return rv; + + rv = nrf_context_validation(); + if (rv != OGS_OK) return rv; + + return OGS_OK; +} diff --git a/src/nrf/context.h b/src/nrf/context.h new file mode 100644 index 000000000..18b1add81 --- /dev/null +++ b/src/nrf/context.h @@ -0,0 +1,54 @@ +/* + * 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 NRF_CONTEXT_H +#define NRF_CONTEXT_H + +#include "ogs-app.h" +#include "ogs-sbi.h" + +#include "nrf-sm.h" +#include "timer.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern int __nrf_log_domain; + +#undef OGS_LOG_DOMAIN +#define OGS_LOG_DOMAIN __nrf_log_domain + +typedef struct nrf_context_s { + ogs_queue_t *queue; /* Queue for processing UPF control */ + ogs_timer_mgr_t *timer_mgr; /* Timer Manager */ + ogs_pollset_t *pollset; /* Poll Set for I/O Multiplexing */ +} nrf_context_t; + +void nrf_context_init(void); +void nrf_context_final(void); +nrf_context_t *nrf_self(void); + +int nrf_context_parse_config(void); + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_CONTEXT_H */ diff --git a/src/nrf/event.c b/src/nrf/event.c new file mode 100644 index 000000000..198c6eee7 --- /dev/null +++ b/src/nrf/event.c @@ -0,0 +1,92 @@ +/* + * 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 "event.h" +#include "context.h" + +#define EVENT_POOL 32 /* FIXME : 32 */ +static OGS_POOL(pool, nrf_event_t); + +void nrf_event_init(void) +{ + ogs_pool_init(&pool, EVENT_POOL); + + nrf_self()->queue = ogs_queue_create(EVENT_POOL); + ogs_assert(nrf_self()->queue); + nrf_self()->timer_mgr = ogs_timer_mgr_create(); + ogs_assert(nrf_self()->timer_mgr); + nrf_self()->pollset = ogs_pollset_create(); + ogs_assert(nrf_self()->pollset); +} + +void nrf_event_final(void) +{ + if (nrf_self()->pollset) + ogs_pollset_destroy(nrf_self()->pollset); + if (nrf_self()->timer_mgr) + ogs_timer_mgr_destroy(nrf_self()->timer_mgr); + if (nrf_self()->queue) + ogs_queue_destroy(nrf_self()->queue); + + ogs_pool_final(&pool); +} + +nrf_event_t *nrf_event_new(nrf_event_e id) +{ + nrf_event_t *e = NULL; + + ogs_pool_alloc(&pool, &e); + ogs_assert(e); + memset(e, 0, sizeof(*e)); + + e->id = id; + + return e; +} + +void nrf_event_free(nrf_event_t *e) +{ + ogs_assert(e); + ogs_pool_free(&pool, e); +} + +const char *nrf_event_get_name(nrf_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 NRF_EVT_SBI_SERVER: + return "NRF_EVT_SBI_SERVER"; + case NRF_EVT_SBI_CLIENT: + return "NRF_EVT_SBI_CLIENT"; + case NRF_EVT_SBI_TIMER: + return "NRF_EVT_SBI_TIMER"; + + default: + break; + } + + return "UNKNOWN_EVENT"; +} diff --git a/src/nrf/event.h b/src/nrf/event.h new file mode 100644 index 000000000..89b22e356 --- /dev/null +++ b/src/nrf/event.h @@ -0,0 +1,81 @@ +/* + * 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 NRF_EVENT_H +#define NRF_EVENT_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ogs_sbi_server_s ogs_sbi_server_t; +typedef struct ogs_sbi_session_s ogs_sbi_session_t; +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 { + NRF_EVT_BASE = OGS_FSM_USER_SIG, + + NRF_EVT_SBI_SERVER, + NRF_EVT_SBI_CLIENT, + NRF_EVT_SBI_TIMER, + + NRF_EVT_TOP, + +} nrf_event_e; + +typedef struct nrf_event_s { + int id; + int timer_id; + + struct { + /* OGS_EVT_SBI_SERVER */ + ogs_sbi_request_t *request; + ogs_sbi_session_t *session; + ogs_sbi_server_t *server; + + /* OGS_EVT_SBI_CLIENT */ + ogs_sbi_response_t *response; + void *data; + + ogs_sbi_message_t *message; + } sbi; + + ogs_sbi_nf_instance_t *nf_instance; + ogs_sbi_subscription_t *subscription; +} nrf_event_t; + +void nrf_event_init(void); +void nrf_event_final(void); + +nrf_event_t *nrf_event_new(nrf_event_e id); +void nrf_event_free(nrf_event_t *e); + +const char *nrf_event_get_name(nrf_event_t *e); + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_EVENT_H */ diff --git a/src/nrf/init.c b/src/nrf/init.c new file mode 100644 index 000000000..6b271571e --- /dev/null +++ b/src/nrf/init.c @@ -0,0 +1,132 @@ +/* + * 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 "context.h" + +static ogs_thread_t *thread; +static void nrf_main(void *data); +static int initialized = 0; + +int nrf_initialize() +{ + int rv; + + nrf_context_init(); + nrf_event_init(); /* Create event with poll, timer */ + ogs_sbi_context_init(nrf_self()->pollset, nrf_self()->timer_mgr); + + rv = ogs_sbi_context_parse_config("nrf", NULL); + if (rv != OGS_OK) return rv; + + rv = nrf_context_parse_config(); + if (rv != OGS_OK) return rv; + + rv = ogs_log_config_domain( + ogs_config()->logger.domain, ogs_config()->logger.level); + if (rv != OGS_OK) return rv; + + thread = ogs_thread_create(nrf_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) +{ + /* + * Add business-login during Daemon termination + */ + + /* Start holding timer */ + t_termination_holding = ogs_timer_add(nrf_self()->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(nrf_self()->queue); + ogs_pollset_notify(nrf_self()->pollset); +} + +void nrf_terminate(void) +{ + if (!initialized) return; + + /* Daemon terminating */ + event_termination(); + ogs_thread_destroy(thread); + ogs_timer_delete(t_termination_holding); + + nrf_context_final(); + ogs_sbi_context_final(); + + nrf_event_final(); /* Destroy event */ +} + +static void nrf_main(void *data) +{ + ogs_fsm_t nrf_sm; + int rv; + + ogs_fsm_create(&nrf_sm, nrf_state_initial, nrf_state_final); + ogs_fsm_init(&nrf_sm, 0); + + for ( ;; ) { + ogs_pollset_poll(nrf_self()->pollset, + ogs_timer_mgr_next(nrf_self()->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(nrf_self()->timer_mgr); + + for ( ;; ) { + nrf_event_t *e = NULL; + + rv = ogs_queue_trypop(nrf_self()->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(&nrf_sm, e); + nrf_event_free(e); + } + } +done: + + ogs_fsm_fini(&nrf_sm, 0); + ogs_fsm_delete(&nrf_sm); +} diff --git a/src/nrf/meson.build b/src/nrf/meson.build new file mode 100644 index 000000000..57ac0377b --- /dev/null +++ b/src/nrf/meson.build @@ -0,0 +1,58 @@ +# 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 . + +libnrf_sources = files(''' + context.c + event.c + timer.c + + nnrf-handler.c + nnrf-build.c + sbi-path.c + + nf-sm.c + nrf-sm.c + + init.c +'''.split()) + +libnrf = static_library('nrf', + sources : libnrf_sources, + link_with : libipfw, + dependencies : [libapp_dep, + libdbi_dep, + libsbi_dep], + install : false) + +libnrf_dep = declare_dependency( + link_with : libnrf, + dependencies : [libapp_dep, + libdbi_dep, + libsbi_dep]) + +nrf_sources = files(''' + app.c + ../main.c +'''.split()) + +executable('open5gs-nrfd', + sources : nrf_sources, + c_args : '-DDEFAULT_CONFIG_FILENAME="@0@/nrf.yaml"'.format(open5gs_sysconfdir), + include_directories : srcinc, + dependencies : libnrf_dep, + install_rpath : libdir, + install : true) diff --git a/src/nrf/nf-sm.c b/src/nrf/nf-sm.c new file mode 100644 index 000000000..01154534a --- /dev/null +++ b/src/nrf/nf-sm.c @@ -0,0 +1,315 @@ +/* + * 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 "context.h" + +#include "sbi-path.h" +#include "nnrf-handler.h" + +void nrf_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance) +{ + nrf_event_t e; + + ogs_assert(nf_instance); + e.nf_instance = nf_instance; + + ogs_fsm_create(&nf_instance->sm, + nrf_nf_state_initial, nrf_nf_state_final); + ogs_fsm_init(&nf_instance->sm, &e); +} + +void nrf_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance) +{ + nrf_event_t e; + + ogs_assert(nf_instance); + e.nf_instance = nf_instance; + + ogs_fsm_fini(&nf_instance->sm, &e); + ogs_fsm_delete(&nf_instance->sm); +} + +void nrf_nf_state_initial(ogs_fsm_t *s, nrf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(s); + ogs_assert(e); + + nrf_sm_debug(e); + + nf_instance = e->nf_instance; + ogs_assert(nf_instance); + + nf_instance->t_heartbeat = ogs_timer_add(nrf_self()->timer_mgr, + nrf_timer_nf_instance_heartbeat, nf_instance); + ogs_assert(nf_instance->t_heartbeat); + + OGS_FSM_TRAN(s, &nrf_nf_state_will_register); +} + +void nrf_nf_state_final(ogs_fsm_t *s, nrf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(s); + ogs_assert(e); + + nrf_sm_debug(e); + + nf_instance = e->nf_instance; + ogs_assert(nf_instance); + + ogs_timer_delete(nf_instance->t_heartbeat); +} + +void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e) +{ + bool handled; + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_sbi_server_t *server = NULL; + ogs_sbi_session_t *session = NULL; + ogs_sbi_message_t *message = NULL; + + ogs_assert(s); + ogs_assert(e); + + nrf_sm_debug(e); + + nf_instance = e->nf_instance; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + break; + + case OGS_FSM_EXIT_SIG: + break; + + case NRF_EVT_SBI_SERVER: + message = e->sbi.message; + ogs_assert(message); + session = e->sbi.session; + ogs_assert(session); + server = e->sbi.server; + ogs_assert(server); + + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NRF_NFM) + + SWITCH(message->h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + + SWITCH(message->h.method) + CASE(OGS_SBI_HTTP_METHOD_PUT) + + handled = nrf_nnrf_handle_nf_register( + nf_instance, server, session, message); + if (handled == false) + OGS_FSM_TRAN(s, nrf_nf_state_exception); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + message->h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + "Invalid HTTP method", message->h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message->h.resource.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + "Invalid resource name", message->h.resource.name); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", message->h.service.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + "Invalid resource name", message->h.service.name); + END + + OGS_FSM_TRAN(s, nrf_nf_state_registered); + break; + + default: + ogs_error("Unknown event %s", nrf_event_get_name(e)); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, + message, "Unknown event", nrf_event_get_name(e)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); + break; + } +} + +void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e) +{ + bool handled; + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_sbi_server_t *server = NULL; + ogs_sbi_session_t *session = NULL; + ogs_sbi_message_t *message = NULL; + ogs_sbi_response_t *response = NULL; + + ogs_assert(s); + ogs_assert(e); + + nrf_sm_debug(e); + + nf_instance = e->nf_instance; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + ogs_info("NF registred [%s]", nf_instance->id); + if (nf_instance->time.heartbeat) { + ogs_timer_start(nf_instance->t_heartbeat, + ogs_time_from_sec(nf_instance->time.heartbeat) * + OGS_SBI_HEARTBEAT_RETRYCOUNT); + } + + nrf_sbi_send_nf_status_notify_all( + OpenAPI_notification_event_type_NF_REGISTERED, nf_instance); + break; + + case OGS_FSM_EXIT_SIG: + ogs_info("NF de-registered [%s]", nf_instance->id); + if (nf_instance->time.heartbeat) { + ogs_timer_stop(nf_instance->t_heartbeat); + } + + nrf_sbi_send_nf_status_notify_all( + OpenAPI_notification_event_type_NF_DEREGISTERED, nf_instance); + break; + + case NRF_EVT_SBI_SERVER: + message = e->sbi.message; + ogs_assert(message); + session = e->sbi.session; + ogs_assert(session); + server = e->sbi.server; + ogs_assert(server); + + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NRF_NFM) + + SWITCH(message->h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + + SWITCH(message->h.method) + CASE(OGS_SBI_HTTP_METHOD_PUT) + CASE(OGS_SBI_HTTP_METHOD_PATCH) + if (nf_instance->time.heartbeat) { + ogs_timer_start(nf_instance->t_heartbeat, + ogs_time_from_sec(nf_instance->time.heartbeat) * + OGS_SBI_HEARTBEAT_RETRYCOUNT); + } + + handled = nrf_nnrf_handle_nf_update( + nf_instance, server, session, message); + if (handled == false) + OGS_FSM_TRAN(s, nrf_nf_state_exception); + break; + + CASE(OGS_SBI_HTTP_METHOD_DELETE) + response = ogs_sbi_build_response(message); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, + OGS_SBI_HTTP_STATUS_NO_CONTENT); + OGS_FSM_TRAN(s, nrf_nf_state_de_registered); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + message->h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + "Invalid HTTP method", message->h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message->h.resource.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + "Invalid resource name", message->h.resource.name); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", message->h.service.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, message, + "Invalid resource name", message->h.service.name); + END + break; + + default: + ogs_error("Unknown event %s", nrf_event_get_name(e)); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR, + message, "Unknown event", nrf_event_get_name(e)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); + break; + } +} + +void nrf_nf_state_de_registered(ogs_fsm_t *s, nrf_event_t *e) +{ + ogs_assert(s); + ogs_assert(e); + + nrf_sm_debug(e); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + break; + case OGS_FSM_EXIT_SIG: + break; + default: + ogs_error("Unknown event %s", nrf_event_get_name(e)); + break; + } +} + +void nrf_nf_state_exception(ogs_fsm_t *s, nrf_event_t *e) +{ + ogs_assert(s); + ogs_assert(e); + + nrf_sm_debug(e); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + break; + case OGS_FSM_EXIT_SIG: + break; + default: + ogs_error("Unknown event %s", nrf_event_get_name(e)); + break; + } +} diff --git a/src/nrf/nnrf-build.c b/src/nrf/nnrf-build.c new file mode 100644 index 000000000..03dd2d4fc --- /dev/null +++ b/src/nrf/nnrf-build.c @@ -0,0 +1,65 @@ +/* + * 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 "nnrf-build.h" + +ogs_sbi_request_t *nrf_nnrf_build_nf_status_notify( + ogs_sbi_client_t *client, ogs_sbi_subscription_t *subscription, + OpenAPI_notification_event_type_e event, + ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + OpenAPI_notification_data_t *NotificationData = NULL; + OpenAPI_nf_profile_t *NFProfile = NULL; + + ogs_assert(client); + ogs_assert(subscription); + ogs_assert(event); + ogs_assert(nf_instance); + + /* TODO : filter NFType */ + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; + message.h.url = subscription->notification_uri; + + NotificationData = ogs_calloc(1, sizeof(*NotificationData)); + ogs_assert(NotificationData); + + NotificationData->event = event; + NotificationData->nf_instance_uri = message.h.url; + + NFProfile = ogs_sbi_nnrf_build_nf_profile(nf_instance); + ogs_assert(NFProfile); + + NotificationData->nf_profile = NFProfile; + + message.NotificationData = NotificationData; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + ogs_free(NotificationData); + + return request; +} diff --git a/src/nrf/nnrf-build.h b/src/nrf/nnrf-build.h new file mode 100644 index 000000000..b592ebdbd --- /dev/null +++ b/src/nrf/nnrf-build.h @@ -0,0 +1,39 @@ +/* + * 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 NRF_NNRF_BUILD_H +#define NRF_NNRF_BUILD_H + +#include "ogs-sbi.h" +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *nrf_nnrf_build_nf_status_notify( + ogs_sbi_client_t *client, ogs_sbi_subscription_t *subscription, + OpenAPI_notification_event_type_e event, + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_NNRF_BUILD_H */ diff --git a/src/nrf/nnrf-handler.c b/src/nrf/nnrf-handler.c new file mode 100644 index 000000000..18aba836f --- /dev/null +++ b/src/nrf/nnrf-handler.c @@ -0,0 +1,417 @@ +/* + * 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 "nnrf-handler.h" + +bool nrf_nnrf_handle_nf_register( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message) +{ + int status; + bool handled; + ogs_sbi_response_t *response = NULL; + + OpenAPI_nf_profile_t *NFProfile = NULL; + + ogs_assert(nf_instance); + ogs_assert(session); + ogs_assert(message); + + NFProfile = message->NFProfile; + if (!NFProfile) { + ogs_error("No NFProfile"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No NFProfile", NULL); + return false; + } + + /* ogs_sbi_nnrf_handle_nf_profile() sends error response */ + handled = ogs_sbi_nnrf_handle_nf_profile( + nf_instance, NFProfile, session, message); + if (!handled) return false; + + if (OGS_FSM_CHECK(&nf_instance->sm, nrf_nf_state_will_register)) { + message->http.location = true; + status = OGS_SBI_HTTP_STATUS_CREATED; + } else if (OGS_FSM_CHECK(&nf_instance->sm, nrf_nf_state_registered)) { + status = OGS_SBI_HTTP_STATUS_OK; + } else + ogs_assert_if_reached(); + + response = ogs_sbi_build_response(message); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, status); + + return true; +} + +bool nrf_nnrf_handle_nf_update( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message) +{ + ogs_sbi_response_t *response = NULL; + OpenAPI_list_t *PatchItemList = NULL; + OpenAPI_lnode_t *node; + + ogs_assert(nf_instance); + ogs_assert(session); + ogs_assert(message); + + SWITCH(message->h.method) + CASE(OGS_SBI_HTTP_METHOD_PUT) + return nrf_nnrf_handle_nf_register( + nf_instance, server, session, message); + + CASE(OGS_SBI_HTTP_METHOD_PATCH) + PatchItemList = message->PatchItemList; + if (!PatchItemList) { + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No PatchItemList Array", NULL); + return false; + } + + OpenAPI_list_for_each(PatchItemList, node) { + OpenAPI_patch_item_t *patch_item = node->data; + if (!patch_item) { + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No PatchItemList", NULL); + return false; + } + } + + response = ogs_sbi_build_response(message); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, + OGS_SBI_HTTP_STATUS_NO_CONTENT); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + message->h.method); + ogs_assert_if_reached(); + END + + return true; +} + +bool nrf_nnrf_handle_nf_status_subscribe(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message) +{ + int status; + ogs_sbi_response_t *response = NULL; + OpenAPI_subscription_data_t *SubscriptionData = NULL; + ogs_sbi_subscription_t *subscription = NULL; + ogs_sbi_client_t *client = NULL; + ogs_sockaddr_t *addr = NULL; + + ogs_uuid_t uuid; + char id[OGS_UUID_FORMATTED_LENGTH + 1]; + + ogs_assert(session); + ogs_assert(message); + + SubscriptionData = message->SubscriptionData; + if (!SubscriptionData) { + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No SubscriptionData", NULL); + return false; + } + + if (!SubscriptionData->nf_status_notification_uri) { + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No SubscriptionData", "NFStatusNotificationURL"); + return false; + } + + ogs_uuid_get(&uuid); + ogs_uuid_format(id, &uuid); + + subscription = ogs_sbi_subscription_add(); + ogs_assert(subscription); + ogs_sbi_subscription_set_id(subscription, id); + ogs_assert(subscription->id); + + if (SubscriptionData->req_nf_instance_id) + subscription->nf_instance_id = + ogs_strdup(SubscriptionData->req_nf_instance_id); + + if (SubscriptionData->subscription_id) { + ogs_warn("NF should not send SubscriptionID[%s]", + SubscriptionData->subscription_id); + ogs_free(SubscriptionData->subscription_id); + } + SubscriptionData->subscription_id = ogs_strdup(subscription->id); + + subscription->notification_uri = + ogs_strdup(SubscriptionData->nf_status_notification_uri); + ogs_assert(subscription->notification_uri); + + addr = ogs_sbi_getaddr_from_uri(subscription->notification_uri); + if (!addr) { + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "Invalid URI", subscription->notification_uri); + return false; + } + + client = ogs_sbi_client_find(addr); + if (!client) { + client = ogs_sbi_client_add(addr); + ogs_assert(client); + } + OGS_SETUP_SBI_CLIENT(subscription, client); + + ogs_freeaddrinfo(addr); + + if (subscription->time.validity) { + char buf[OGS_TIME_ISO8601_FORMATTED_LENGTH]; + struct timeval tv; + struct tm local; + + ogs_gettimeofday(&tv); + tv.tv_sec += subscription->time.validity; + ogs_localtime(tv.tv_sec, &local); + + ogs_strftime(buf, OGS_TIME_ISO8601_FORMATTED_LENGTH, + OGS_TIME_ISO8601_FORMAT, &local); + + SubscriptionData->validity_time = ogs_strdup(buf); + + subscription->t_validity = ogs_timer_add(nrf_self()->timer_mgr, + nrf_timer_subscription_validity, subscription); + ogs_assert(subscription->t_validity); + ogs_timer_start(subscription->t_validity, + ogs_time_from_sec(subscription->time.validity)); + } + + message->http.location = true; + status = OGS_SBI_HTTP_STATUS_CREATED; + + response = ogs_sbi_build_response(message); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, status); + + return true; +} + +bool nrf_nnrf_handle_nf_status_unsubscribe(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message) +{ + ogs_sbi_subscription_t *subscription = NULL; + ogs_assert(session); + ogs_assert(message); + + subscription = ogs_sbi_subscription_find(message->h.resource.id); + if (subscription) { + ogs_sbi_response_t *response = NULL; + ogs_sbi_subscription_remove(subscription); + + response = ogs_sbi_build_response(message); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, + OGS_SBI_HTTP_STATUS_NO_CONTENT); + } else { + ogs_error("Not found [%s]", message->h.resource.id); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_NOT_FOUND, + message, "Not found", message->h.resource.id); + } + + return true; +} + +bool nrf_nnrf_handle_nf_list_retrieval(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg) +{ + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + int i = 0; + + ogs_sbi_links_t *links = NULL; + OpenAPI_lnode_t *node = NULL; + + ogs_assert(session); + ogs_assert(recvmsg); + + links = ogs_calloc(1, sizeof(*links)); + ogs_assert(links); + + links->items = OpenAPI_list_create(); + ogs_assert(links->items); + + links->self = ogs_sbi_server_uri(server, + recvmsg->h.service.name, recvmsg->h.api.version, + recvmsg->h.resource.name, NULL); + + i = 0; + ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) { + + if (recvmsg->param.nf_type && + recvmsg->param.nf_type != nf_instance->nf_type) + continue; + + if (!recvmsg->param.limit || + (recvmsg->param.limit && i < recvmsg->param.limit)) { + OpenAPI_list_add(links->items, + ogs_msprintf("%s/%s", links->self, nf_instance->id)); + } + + i++; + } + + ogs_assert(links->self); + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.links = links; + sendmsg.http.content_type = (char *)OGS_SBI_CONTENT_3GPPHAL_TYPE; + + response = ogs_sbi_build_response(&sendmsg); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, OGS_SBI_HTTP_STATUS_OK); + + OpenAPI_list_for_each(links->items, node) { + if (!node->data) continue; + ogs_free(node->data); + } + OpenAPI_list_free(links->items); + ogs_free(links->self); + ogs_free(links); + + return true; +} + +bool nrf_nnrf_handle_nf_profile_retrieval(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg) +{ + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + + OpenAPI_nf_profile_t *NFProfile = NULL; + + ogs_assert(session); + ogs_assert(recvmsg); + + ogs_assert(recvmsg->h.resource.id); + nf_instance = ogs_sbi_nf_instance_find(recvmsg->h.resource.id); + if (!nf_instance) { + ogs_error("Not found [%s]", recvmsg->h.resource.id); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_NOT_FOUND, + recvmsg, "Not found", recvmsg->h.resource.id); + return false; + } + + NFProfile = ogs_sbi_nnrf_build_nf_profile(nf_instance); + ogs_assert(NFProfile); + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.NFProfile = NFProfile; + + response = ogs_sbi_build_response(&sendmsg); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, OGS_SBI_HTTP_STATUS_OK); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return true; +} + +bool nrf_nnrf_handle_nf_discover(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg) +{ + ogs_sbi_message_t sendmsg; + ogs_sbi_response_t *response = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + + OpenAPI_search_result_t *SearchResult = NULL; + OpenAPI_lnode_t *node = NULL; + int i; + + ogs_assert(session); + ogs_assert(recvmsg); + + if (!recvmsg->param.target_nf_type) { + ogs_error("No target-nf-type [%s]", recvmsg->h.url); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No target-nf-type", NULL); + return false; + } + if (!recvmsg->param.requester_nf_type) { + ogs_error("No requester-nf-type [%s]", recvmsg->h.url); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + recvmsg, "No requester-nf-type", NULL); + return false; + } + + SearchResult = ogs_calloc(1, sizeof(*SearchResult)); + ogs_assert(SearchResult); + + SearchResult->validity_period = ogs_config()->time.nf_instance.validity; + ogs_assert(SearchResult->validity_period); + + SearchResult->nf_instances = OpenAPI_list_create(); + ogs_assert(SearchResult->nf_instances); + + i = 0; + ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) { + OpenAPI_nf_profile_t *NFProfile = NULL; + + if (nf_instance->nf_type != recvmsg->param.target_nf_type) + continue; + if (nf_instance->nf_type == recvmsg->param.requester_nf_type) + continue; + + if (!recvmsg->param.limit || + (recvmsg->param.limit && i < recvmsg->param.limit)) { + NFProfile = ogs_sbi_nnrf_build_nf_profile(nf_instance); + ogs_assert(NFProfile); + + OpenAPI_list_add(SearchResult->nf_instances, NFProfile); + } + + i++; + } + + if (recvmsg->param.limit) SearchResult->num_nf_inst_complete = i; + + memset(&sendmsg, 0, sizeof(sendmsg)); + sendmsg.SearchResult = SearchResult; + sendmsg.http.cache_control = + ogs_msprintf("max-age=%d", SearchResult->validity_period); + + response = ogs_sbi_build_response(&sendmsg); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, OGS_SBI_HTTP_STATUS_OK); + + OpenAPI_list_for_each(SearchResult->nf_instances, node) { + OpenAPI_nf_profile_t *NFProfile = NULL; + if (!node->data) continue; + NFProfile = node->data; + ogs_sbi_nnrf_free_nf_profile(NFProfile); + } + OpenAPI_list_free(SearchResult->nf_instances); + + if (sendmsg.http.cache_control) + ogs_free(sendmsg.http.cache_control); + ogs_free(SearchResult); + + return true; +} diff --git a/src/nrf/nnrf-handler.h b/src/nrf/nnrf-handler.h new file mode 100644 index 000000000..b2a00d5b9 --- /dev/null +++ b/src/nrf/nnrf-handler.h @@ -0,0 +1,54 @@ +/* + * 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 NRF_NNRF_HANDLER_H +#define NRF_NNRF_HANDLER_H + +#include "ogs-sbi.h" +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +bool nrf_nnrf_handle_nf_register( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); +bool nrf_nnrf_handle_nf_update( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); + +bool nrf_nnrf_handle_nf_status_subscribe(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); +bool nrf_nnrf_handle_nf_status_unsubscribe(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); + +bool nrf_nnrf_handle_nf_list_retrieval(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); +bool nrf_nnrf_handle_nf_profile_retrieval(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); + +bool nrf_nnrf_handle_nf_discover(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_NNRF_HANDLER_H */ diff --git a/src/nrf/nrf-sm.c b/src/nrf/nrf-sm.c new file mode 100644 index 000000000..94cfa1bea --- /dev/null +++ b/src/nrf/nrf-sm.c @@ -0,0 +1,257 @@ +/* + * 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 "sbi-path.h" +#include "nnrf-handler.h" + +void nrf_state_initial(ogs_fsm_t *s, nrf_event_t *e) +{ + nrf_sm_debug(e); + + ogs_assert(s); + + OGS_FSM_TRAN(s, &nrf_state_operational); +} + +void nrf_state_final(ogs_fsm_t *s, nrf_event_t *e) +{ + nrf_sm_debug(e); + + ogs_assert(s); +} + +void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e) +{ + int rv; + ogs_sbi_server_t *server = NULL; + ogs_sbi_session_t *session = NULL; + ogs_sbi_request_t *request = NULL; + ogs_sbi_message_t message; + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_subscription_t *subscription = NULL; + + ogs_assert(e); + + nrf_sm_debug(e); + + ogs_assert(s); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + rv = nrf_sbi_open(); + if (rv != OGS_OK) { + ogs_fatal("Can't establish SBI path"); + } + break; + + case OGS_FSM_EXIT_SIG: + nrf_sbi_close(); + break; + + case NRF_EVT_SBI_SERVER: + request = e->sbi.request; + ogs_assert(request); + session = e->sbi.session; + ogs_assert(session); + server = e->sbi.server; + ogs_assert(server); + + 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(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + NULL, "cannot parse HTTP message", NULL); + break; + } + + if (strcmp(message.h.api.version, OGS_SBI_API_VERSION) != 0) { + ogs_error("Not supported version [%s]", message.h.api.version); + ogs_sbi_server_send_error(session, 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_NRF_NFM) + + SWITCH(message.h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + SWITCH(message.h.method) + CASE(OGS_SBI_HTTP_METHOD_GET) + if (message.h.resource.id) { + nrf_nnrf_handle_nf_profile_retrieval( + server, session, &message); + } else { + nrf_nnrf_handle_nf_list_retrieval( + server, session, &message); + } + break; + + DEFAULT + nf_instance = ogs_sbi_nf_instance_find( + message.h.resource.id); + if (!nf_instance) { + SWITCH(message.h.method) + CASE(OGS_SBI_HTTP_METHOD_PUT) + nf_instance = ogs_sbi_nf_instance_add( + message.h.resource.id); + ogs_assert(nf_instance); + nrf_nf_fsm_init(nf_instance); + break; + DEFAULT + ogs_error("Not found [%s]", message.h.resource.id); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_NOT_FOUND, + &message, "Not found", message.h.resource.id); + END + } + + if (nf_instance) { + e->nf_instance = nf_instance; + ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); + + e->sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + if (OGS_FSM_CHECK(&nf_instance->sm, + nrf_nf_state_de_registered)) { + nrf_nf_fsm_fini(nf_instance); + ogs_sbi_nf_instance_remove(nf_instance); + + /* FIXME : Remove unnecessary Client */ + } else if (OGS_FSM_CHECK(&nf_instance->sm, + nrf_nf_state_exception)) { + ogs_error("State machine exception"); + ogs_sbi_message_free(&message); + + nrf_nf_fsm_fini(nf_instance); + ogs_sbi_nf_instance_remove(nf_instance); + + /* FIXME : Remove unnecessary Client */ + } + } + END + break; + + CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) + SWITCH(message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + nrf_nnrf_handle_nf_status_subscribe( + server, session, &message); + break; + + CASE(OGS_SBI_HTTP_METHOD_DELETE) + nrf_nnrf_handle_nf_status_unsubscribe( + server, session, &message); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + message.h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + "Invalid HTTP method", message.h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message.h.resource.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + "Unknown resource name", message.h.resource.name); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NRF_DISC) + + SWITCH(message.h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + + SWITCH(message.h.method) + CASE(OGS_SBI_HTTP_METHOD_GET) + nrf_nnrf_handle_nf_discover(server, session, &message); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + message.h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + &message, + "Invalid HTTP method", message.h.method); + END + + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message.h.resource.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + "Unknown resource name", message.h.resource.name); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", message.h.service.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &message, + "Invalid API name", message.h.resource.name); + END + + /* In lib/sbi/server.c, notify_completed() releases 'request' buffer. */ + ogs_sbi_message_free(&message); + break; + + case NRF_EVT_SBI_TIMER: + switch(e->timer_id) { + case NRF_TIMER_NF_INSTANCE_HEARTBEAT: + nf_instance = e->nf_instance; + ogs_assert(nf_instance); + + ogs_warn("No heartbeat [%s]", nf_instance->id); + nf_instance->nf_status = OpenAPI_nf_status_SUSPENDED; + + nrf_nf_fsm_fini(nf_instance); + ogs_sbi_nf_instance_remove(nf_instance); + + /* FIXME : Remove unnecessary Client */ + break; + + case NRF_TIMER_SUBSCRIPTION_VALIDITY: + subscription = e->subscription; + ogs_assert(subscription); + + ogs_info("Subscription validity expired [%s]", subscription->id); + ogs_sbi_subscription_remove(subscription); + break; + + default: + ogs_error("Unknown timer[%s:%d]", + nrf_timer_get_name(e->timer_id), e->timer_id); + } + break; + + default: + ogs_error("No handler for event %s", nrf_event_get_name(e)); + break; + } +} diff --git a/src/nrf/nrf-sm.h b/src/nrf/nrf-sm.h new file mode 100644 index 000000000..1e51d7842 --- /dev/null +++ b/src/nrf/nrf-sm.h @@ -0,0 +1,50 @@ +/* + * 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 NRF_SM_H +#define NRF_SM_H + +#include "event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void nrf_state_initial(ogs_fsm_t *s, nrf_event_t *e); +void nrf_state_final(ogs_fsm_t *s, nrf_event_t *e); +void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e); + +void nrf_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance); +void nrf_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance); + +void nrf_nf_state_initial(ogs_fsm_t *s, nrf_event_t *e); +void nrf_nf_state_final(ogs_fsm_t *s, nrf_event_t *e); +void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e); +void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e); +void nrf_nf_state_de_registered(ogs_fsm_t *s, nrf_event_t *e); +void nrf_nf_state_exception(ogs_fsm_t *s, nrf_event_t *e); + +#define nrf_sm_debug(__pe) \ + ogs_debug("%s(): %s", __func__, nrf_event_get_name(__pe)) + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_SM_H */ diff --git a/src/nrf/sbi-path.c b/src/nrf/sbi-path.c new file mode 100644 index 000000000..c474ccb14 --- /dev/null +++ b/src/nrf/sbi-path.c @@ -0,0 +1,119 @@ +/* + * 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 "sbi-path.h" + +static int server_cb(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_request_t *request) +{ + nrf_event_t *e = NULL; + int rv; + + ogs_assert(session); + ogs_assert(request); + + e = nrf_event_new(NRF_EVT_SBI_SERVER); + ogs_assert(e); + + e->sbi.server = server; + e->sbi.session = session; + e->sbi.request = request; + + rv = ogs_queue_push(nrf_self()->queue, e); + if (rv != OGS_OK) { + ogs_warn("ogs_queue_push() failed:%d", (int)rv); + nrf_event_free(e); + return OGS_ERROR; + } + + return OGS_OK; +} + +static int client_notify_cb(ogs_sbi_response_t *response, void *data) +{ + int rv; + + ogs_sbi_client_t *client = NULL; + ogs_sbi_message_t message; + + ogs_assert(response); + client = data; + ogs_assert(client); + + 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); + return OGS_ERROR; + } + + if (message.res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT) + ogs_error("Subscription notification failed [%d]", message.res_status); + + ogs_sbi_message_free(&message); + ogs_sbi_response_free(response); + return OGS_OK; +} + +int nrf_sbi_open(void) +{ + ogs_sbi_server_start_all(server_cb); + + return OGS_OK; +} + +void nrf_sbi_close(void) +{ + ogs_sbi_server_stop_all(); +} + +void nrf_sbi_send_nf_status_notify(ogs_sbi_subscription_t *subscription, + OpenAPI_notification_event_type_e event, + ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(subscription); + client = subscription->client; + ogs_assert(client); + client->cb = client_notify_cb; + + request = nrf_nnrf_build_nf_status_notify( + client, subscription, event, nf_instance); + ogs_assert(request); + ogs_sbi_client_send_request(client, request, client); +} + +void nrf_sbi_send_nf_status_notify_all(OpenAPI_notification_event_type_e event, + ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_subscription_t *subscription = NULL; + + ogs_assert(nf_instance); + + ogs_list_for_each(&ogs_sbi_self()->subscription_list, subscription) { + + if (strcmp(subscription->nf_instance_id, nf_instance->id) == 0) + continue; + + nrf_sbi_send_nf_status_notify(subscription, event, nf_instance); + } +} diff --git a/src/nrf/sbi-path.h b/src/nrf/sbi-path.h new file mode 100644 index 000000000..db22b4dcc --- /dev/null +++ b/src/nrf/sbi-path.h @@ -0,0 +1,43 @@ +/* + * 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 NRF_SBI_PATH_H +#define NRF_SBI_PATH_H + +#include "ogs-sbi.h" +#include "nnrf-build.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int nrf_sbi_open(void); +void nrf_sbi_close(void); + +void nrf_sbi_send_nf_status_notify(ogs_sbi_subscription_t *subscription, + OpenAPI_notification_event_type_e event, + ogs_sbi_nf_instance_t *nf_instance); +void nrf_sbi_send_nf_status_notify_all(OpenAPI_notification_event_type_e event, + ogs_sbi_nf_instance_t *nf_instance); + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_SBI_PATH_H */ diff --git a/src/nrf/timer.c b/src/nrf/timer.c new file mode 100644 index 000000000..31d517d95 --- /dev/null +++ b/src/nrf/timer.c @@ -0,0 +1,84 @@ +/* + * 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 "context.h" + +static nrf_timer_cfg_t g_nrf_timer_cfg[MAX_NUM_OF_NRF_TIMER] = { + /* Nothing */ +}; + +nrf_timer_cfg_t *nrf_timer_cfg(nrf_timer_e id) +{ + ogs_assert(id < MAX_NUM_OF_NRF_TIMER); + return &g_nrf_timer_cfg[id]; +} + +const char *nrf_timer_get_name(nrf_timer_e id) +{ + switch (id) { + case NRF_TIMER_NF_INSTANCE_HEARTBEAT: + return "NRF_TIMER_NF_INSTANCE_HEARTBEAT"; + case NRF_TIMER_SUBSCRIPTION_VALIDITY: + return "NRF_TIMER_SUBSCRIPTION_VALIDITY"; + default: + break; + } + + return "UNKNOWN_TIMER"; +} + +static void timer_send_event(int timer_id, void *data) +{ + int rv; + nrf_event_t *e = NULL; + ogs_assert(data); + + switch (timer_id) { + case NRF_TIMER_NF_INSTANCE_HEARTBEAT: + e = nrf_event_new(NRF_EVT_SBI_TIMER); + e->timer_id = timer_id; + e->nf_instance = data; + break; + case NRF_TIMER_SUBSCRIPTION_VALIDITY: + e = nrf_event_new(NRF_EVT_SBI_TIMER); + e->timer_id = timer_id; + e->subscription = data; + break; + default: + ogs_fatal("Unknown timer id[%d]", timer_id); + ogs_assert_if_reached(); + break; + } + + rv = ogs_queue_push(nrf_self()->queue, e); + if (rv != OGS_OK) { + ogs_warn("ogs_queue_push() failed:%d", (int)rv); + nrf_event_free(e); + } +} + +void nrf_timer_nf_instance_heartbeat(void *data) +{ + timer_send_event(NRF_TIMER_NF_INSTANCE_HEARTBEAT, data); +} + +void nrf_timer_subscription_validity(void *data) +{ + timer_send_event(NRF_TIMER_SUBSCRIPTION_VALIDITY, data); +} diff --git a/src/nrf/timer.h b/src/nrf/timer.h new file mode 100644 index 000000000..d983d43fb --- /dev/null +++ b/src/nrf/timer.h @@ -0,0 +1,56 @@ +/* + * 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 NRF_TIMER_H +#define NRF_TIMER_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* forward declaration */ +typedef enum { + NRF_TIMER_BASE = 0, + + NRF_TIMER_NF_INSTANCE_HEARTBEAT, + NRF_TIMER_SUBSCRIPTION_VALIDITY, + + MAX_NUM_OF_NRF_TIMER, + +} nrf_timer_e; + +typedef struct nrf_timer_cfg_s { + int max_count; + ogs_time_t duration; +} nrf_timer_cfg_t; + +nrf_timer_cfg_t *nrf_timer_cfg(nrf_timer_e id); + +const char *nrf_timer_get_name(nrf_timer_e id); + +void nrf_timer_nf_instance_heartbeat(void *data); +void nrf_timer_subscription_validity(void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* NRF_TIMER_H */ diff --git a/src/pgw/pgw-event.c b/src/pgw/pgw-event.c index 7fc775f1e..4ebaa7afd 100644 --- a/src/pgw/pgw-event.c +++ b/src/pgw/pgw-event.c @@ -80,6 +80,8 @@ pgw_event_t *pgw_event_new(pgw_event_e id) ogs_pool_alloc(&pool, &e); ogs_assert(e); + memset(e, 0, sizeof(*e)); + e->id = id; return e; diff --git a/src/sgw/sgw-event.c b/src/sgw/sgw-event.c index 3896b17b2..b928f5e08 100644 --- a/src/sgw/sgw-event.c +++ b/src/sgw/sgw-event.c @@ -59,6 +59,8 @@ sgw_event_t *sgw_event_new(sgw_event_e id) ogs_pool_alloc(&pool, &e); ogs_assert(e); + memset(e, 0, sizeof(*e)); + e->id = id; return e; diff --git a/src/smf/context.c b/src/smf/context.c index 5753afed3..5f23bd8cb 100644 --- a/src/smf/context.c +++ b/src/smf/context.c @@ -18,7 +18,6 @@ */ #include "context.h" -#include "smf-sm.h" static smf_context_t self; static ogs_diam_config_t g_diam_conf; @@ -30,7 +29,7 @@ static OGS_POOL(smf_bearer_pool, smf_bearer_t); static OGS_POOL(smf_pf_pool, smf_pf_t); -static int context_initiaized = 0; +static int context_initialized = 0; int num_sessions = 0; void stats_add_session(void) { @@ -47,7 +46,7 @@ void stats_remove_session(void) { void smf_context_init(void) { - ogs_assert(context_initiaized == 0); + ogs_assert(context_initialized == 0); /* Initial FreeDiameter Config */ memset(&g_diam_conf, 0, sizeof(ogs_diam_config_t)); @@ -78,12 +77,12 @@ void smf_context_init(void) self.ipv4_hash = ogs_hash_make(); self.ipv6_hash = ogs_hash_make(); - context_initiaized = 1; + context_initialized = 1; } void smf_context_final(void) { - ogs_assert(context_initiaized == 1); + ogs_assert(context_initialized == 1); smf_sess_remove_all(); @@ -103,7 +102,7 @@ void smf_context_final(void) ogs_gtp_node_final(); - context_initiaized = 0; + context_initialized = 0; } smf_context_t *smf_self(void) @@ -116,6 +115,7 @@ static int smf_context_prepare(void) self.gtpc_port = OGS_GTPV2_C_UDP_PORT; self.diam_config->cnf_port = DIAMETER_PORT; self.diam_config->cnf_port_tls = DIAMETER_SECURE_PORT; + self.nf_type = OpenAPI_nf_type_SMF; return OGS_OK; } @@ -418,10 +418,6 @@ int smf_context_parse_config(void) NULL, self.gtpc_port); ogs_assert(rv == OGS_OK); } - } else if (!strcmp(smf_key, "pfcp")) { - /* handle config in pfcp library */ - } else if (!strcmp(smf_key, "pdn")) { - /* handle config in pfcp library */ } else if (!strcmp(smf_key, "dns")) { ogs_yaml_iter_t dns_iter; ogs_yaml_iter_recurse(&smf_iter, &dns_iter); @@ -505,8 +501,13 @@ int smf_context_parse_config(void) } while ( ogs_yaml_iter_type(&dns_iter) == YAML_SEQUENCE_NODE); - } - else + } else if (!strcmp(smf_key, "pfcp")) { + /* handle config in pfcp library */ + } else if (!strcmp(smf_key, "pdn")) { + /* handle config in pfcp library */ + } else if (!strcmp(smf_key, "sbi")) { + /* handle config in pfcp library */ + } else ogs_warn("unknown key `%s`", smf_key); } } diff --git a/src/smf/context.h b/src/smf/context.h index a0313cbd0..748b6780a 100644 --- a/src/smf/context.h +++ b/src/smf/context.h @@ -29,6 +29,7 @@ #include "ogs-gtp.h" #include "ogs-diameter-gx.h" #include "ogs-pfcp.h" +#include "ogs-sbi.h" #include "ogs-app.h" #include "ipfw/ogs-ipfw.h" @@ -48,6 +49,8 @@ typedef struct smf_context_s { const char* diam_conf_path; /* SMF Diameter conf path */ ogs_diam_config_t *diam_config; /* SMF Diameter config */ + OpenAPI_nf_type_e nf_type; + uint32_t gtpc_port; /* Default: SMF GTP-C local port */ ogs_list_t gtpc_list; /* SMF GTPC IPv4 Server List */ diff --git a/src/smf/event.c b/src/smf/event.c index 1e9e43376..14c2701e1 100644 --- a/src/smf/event.c +++ b/src/smf/event.c @@ -35,12 +35,6 @@ void smf_event_init(void) ogs_assert(smf_self()->pollset); } -void smf_event_term(void) -{ - ogs_queue_term(smf_self()->queue); - ogs_pollset_notify(smf_self()->pollset); -} - void smf_event_final(void) { if (smf_self()->pollset) @@ -59,6 +53,8 @@ smf_event_t *smf_event_new(smf_event_e id) ogs_pool_alloc(&pool, &e); ogs_assert(e); + memset(e, 0, sizeof(*e)); + e->id = id; return e; @@ -92,6 +88,13 @@ const char *smf_event_get_name(smf_event_t *e) case SMF_EVT_N4_NO_HEARTBEAT: return "SMF_EVT_N4_NO_HEARTBEAT"; + case SMF_EVT_SBI_SERVER: + return "SMF_EVT_SBI_SERVER"; + case SMF_EVT_SBI_CLIENT: + return "SMF_EVT_SBI_CLIENT"; + case SMF_EVT_SBI_TIMER: + return "SMF_EVT_SBI_TIMER"; + default: break; } diff --git a/src/smf/event.h b/src/smf/event.h index 8afc5c749..2cc59babc 100644 --- a/src/smf/event.h +++ b/src/smf/event.h @@ -33,6 +33,12 @@ typedef struct ogs_pfcp_xact_s ogs_pfcp_xact_t; typedef struct ogs_pfcp_message_s ogs_pfcp_message_t; typedef struct smf_sess_s smf_sess_t; typedef struct smf_upf_s smf_upf_t; +typedef struct ogs_sbi_server_s ogs_sbi_server_t; +typedef struct ogs_sbi_session_s ogs_sbi_session_t; +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_subscription_s ogs_sbi_subscription_t; typedef enum { SMF_EVT_BASE = OGS_FSM_USER_SIG, @@ -44,6 +50,10 @@ typedef enum { SMF_EVT_N4_TIMER, SMF_EVT_N4_NO_HEARTBEAT, + SMF_EVT_SBI_SERVER, + SMF_EVT_SBI_CLIENT, + SMF_EVT_SBI_TIMER, + SMF_EVT_TOP, } smf_event_e; @@ -60,11 +70,23 @@ typedef struct smf_event_s { ogs_pfcp_xact_t *pfcp_xact; ogs_pfcp_message_t *pfcp_message; + struct { + /* OGS_EVT_SBI_SERVER */ + ogs_sbi_request_t *request; + ogs_sbi_session_t *session; + ogs_sbi_server_t *server; + + /* OGS_EVT_SBI_CLIENT */ + ogs_sbi_response_t *response; + void *data; + + ogs_sbi_message_t *message; + } sbi; + smf_sess_t *sess; } smf_event_t; void smf_event_init(void); -void smf_event_term(void); void smf_event_final(void); smf_event_t *smf_event_new(smf_event_e id); diff --git a/src/smf/fd-path.c b/src/smf/fd-path.c index 155a0ceaa..70c194bee 100644 --- a/src/smf/fd-path.c +++ b/src/smf/fd-path.c @@ -739,7 +739,7 @@ out: e->gtp_xact = xact; rv = ogs_queue_push(smf_self()->queue, e); if (rv != OGS_OK) { - ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_warn("ogs_queue_push() failed:%d", (int)rv); ogs_diam_gx_message_free(gx_message); ogs_pkbuf_free(e->pkbuf); smf_event_free(e); @@ -963,7 +963,7 @@ static int smf_gx_rar_cb( struct msg **msg, struct avp *avp, e->pkbuf = gxbuf; rv = ogs_queue_push(smf_self()->queue, e); if (rv != OGS_OK) { - ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_warn("ogs_queue_push() failed:%d", (int)rv); ogs_diam_gx_message_free(gx_message); ogs_pkbuf_free(e->pkbuf); smf_event_free(e); diff --git a/src/smf/gtp-path.c b/src/smf/gtp-path.c index e15fd7783..d386724fc 100644 --- a/src/smf/gtp-path.c +++ b/src/smf/gtp-path.c @@ -62,7 +62,7 @@ static void _gtpv2_c_recv_cb(short when, ogs_socket_t fd, void *data) rv = ogs_queue_push(smf_self()->queue, e); if (rv != OGS_OK) { - ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_warn("ogs_queue_push() failed:%d", (int)rv); ogs_pkbuf_free(e->pkbuf); smf_event_free(e); } diff --git a/src/smf/init.c b/src/smf/init.c index 7f0e2dddc..80a100710 100644 --- a/src/smf/init.c +++ b/src/smf/init.c @@ -18,9 +18,6 @@ */ #include "context.h" -#include "event.h" -#include "smf-sm.h" - #include "fd-path.h" static ogs_thread_t *thread; @@ -34,7 +31,8 @@ int smf_initialize() ogs_pfcp_context_init(ogs_config()->max.upf * OGS_MAX_NUM_OF_GTPU_RESOURCE); smf_context_init(); - smf_event_init(); + smf_event_init(); /* Create event with poll, timer */ + ogs_sbi_context_init(smf_self()->pollset, smf_self()->timer_mgr); rv = ogs_gtp_xact_init(smf_self()->timer_mgr, 512); if (rv != OGS_OK) return rv; @@ -45,6 +43,9 @@ int smf_initialize() rv = ogs_pfcp_context_parse_config("smf", "upf"); if (rv != OGS_OK) return rv; + rv = ogs_sbi_context_parse_config("smf", "nrf"); + if (rv != OGS_OK) return rv; + rv = smf_context_parse_config(); if (rv != OGS_OK) return rv; @@ -66,23 +67,46 @@ int smf_initialize() 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) + smf_nf_fsm_fini(nf_instance); + + /* Starting holding timer */ + t_termination_holding = ogs_timer_add(smf_self()->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(smf_self()->queue); + ogs_pollset_notify(smf_self()->pollset); +} + void smf_terminate(void) { if (!initialized) return; - smf_event_term(); - + /* Daemon terminating */ + event_termination(); ogs_thread_destroy(thread); + ogs_timer_delete(t_termination_holding); smf_fd_final(); smf_context_final(); ogs_pfcp_context_final(); + ogs_sbi_context_final(); ogs_pfcp_xact_final(); ogs_gtp_xact_final(); - smf_event_final(); + smf_event_final(); /* Destroy event */ } static void smf_main(void *data) @@ -97,30 +121,19 @@ static void smf_main(void *data) ogs_pollset_poll(smf_self()->pollset, ogs_timer_mgr_next(smf_self()->timer_mgr)); - /* Process the MESSAGE FIRST. + /* + * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * For example, if UE Context Release Complete is received, - * the MME_TIMER_UE_CONTEXT_RELEASE is first stopped */ - for ( ;; ) { - smf_event_t *e = NULL; - - rv = ogs_queue_trypop(smf_self()->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(&smf_sm, e); - smf_event_free(e); - } - + * 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(smf_self()->timer_mgr); - /* AND THEN, process the TIMER. */ for ( ;; ) { smf_event_t *e = NULL; diff --git a/src/smf/meson.build b/src/smf/meson.build index b596ede57..82b9543f4 100644 --- a/src/smf/meson.build +++ b/src/smf/meson.build @@ -44,6 +44,9 @@ libsmf_sources = files(''' n4-build.h n4-handler.h bearer-binding.h + nnrf-build.h + nnrf-handler.h + sbi-path.h init.c event.c @@ -60,21 +63,31 @@ libsmf_sources = files(''' n4-build.c n4-handler.c bearer-binding.c + nnrf-build.c + nnrf-handler.c + sbi-path.c + nf-sm.c '''.split()) libsmf = static_library('smf', sources : libsmf_sources, link_with : libipfw, - dependencies : [ - libapp_dep, libdiameter_gx_dep, libgtp_dep, libpfcp_dep, libipfw_dep - ], + dependencies : [libapp_dep, + libsbi_dep, + libdiameter_gx_dep, + libgtp_dep, + libpfcp_dep, + libipfw_dep], install : false) libsmf_dep = declare_dependency( link_with : libsmf, - dependencies : [ - libapp_dep, libdiameter_gx_dep, libgtp_dep, libpfcp_dep, libipfw_dep - ]) + dependencies : [libapp_dep, + libsbi_dep, + libdiameter_gx_dep, + libgtp_dep, + libpfcp_dep, + libipfw_dep]) smf_sources = files(''' app.c diff --git a/src/smf/n4-handler.c b/src/smf/n4-handler.c index 80cdc62b2..fda17e124 100644 --- a/src/smf/n4-handler.c +++ b/src/smf/n4-handler.c @@ -134,7 +134,7 @@ void smf_n4_handle_heartbeat_response( ogs_pfcp_xact_commit(xact); ogs_timer_start(node->t_heartbeat, - smf_timer_cfg(SMF_TIMER_HEARTBEAT)->duration); + smf_timer_cfg(SMF_TIMER_PFCP_HEARTBEAT)->duration); } void smf_n4_handle_session_establishment_response( diff --git a/src/smf/nf-sm.c b/src/smf/nf-sm.c new file mode 100644 index 000000000..09da81df0 --- /dev/null +++ b/src/smf/nf-sm.c @@ -0,0 +1,383 @@ +/* + * 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 "context.h" + +#include "sbi-path.h" +#include "nnrf-handler.h" + +void smf_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance) +{ + smf_event_t e; + + ogs_assert(nf_instance); + + e.sbi.data = nf_instance; + + ogs_fsm_create(&nf_instance->sm, + smf_nf_state_initial, smf_nf_state_final); + ogs_fsm_init(&nf_instance->sm, &e); +} + +void smf_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance) +{ + smf_event_t e; + + ogs_assert(nf_instance); + e.sbi.data = nf_instance; + + ogs_fsm_fini(&nf_instance->sm, &e); + ogs_fsm_delete(&nf_instance->sm); +} + +void smf_nf_state_initial(ogs_fsm_t *s, smf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(s); + ogs_assert(e); + + smf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + ogs_assert(nf_instance->id); + + nf_instance->t_registration_interval = ogs_timer_add(smf_self()->timer_mgr, + smf_timer_nf_instance_registration_interval, nf_instance); + ogs_assert(nf_instance->t_registration_interval); + nf_instance->t_heartbeat_interval = ogs_timer_add(smf_self()->timer_mgr, + smf_timer_nf_instance_heartbeat_interval, nf_instance); + ogs_assert(nf_instance->t_heartbeat_interval); + nf_instance->t_heartbeat = ogs_timer_add(smf_self()->timer_mgr, + smf_timer_nf_instance_heartbeat, nf_instance); + ogs_assert(nf_instance->t_heartbeat); + nf_instance->t_validity = ogs_timer_add(smf_self()->timer_mgr, + smf_timer_nf_instance_validity, nf_instance); + ogs_assert(nf_instance->t_validity); + + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + OGS_FSM_TRAN(s, &smf_nf_state_will_register); + } else { + OGS_FSM_TRAN(s, &smf_nf_state_registered); + } +} + +void smf_nf_state_final(ogs_fsm_t *s, smf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + + ogs_assert(s); + ogs_assert(e); + + smf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + + ogs_timer_delete(nf_instance->t_registration_interval); + ogs_timer_delete(nf_instance->t_heartbeat_interval); + ogs_timer_delete(nf_instance->t_heartbeat); + ogs_timer_delete(nf_instance->t_validity); +} + +void smf_nf_state_will_register(ogs_fsm_t *s, smf_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); + + smf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + ogs_timer_start(nf_instance->t_registration_interval, + smf_timer_cfg(SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)-> + duration); + + smf_sbi_send_nf_register(nf_instance); + break; + + case OGS_FSM_EXIT_SIG: + ogs_timer_stop(nf_instance->t_registration_interval); + break; + + case SMF_EVT_SBI_CLIENT: + message = e->sbi.message; + ogs_assert(message); + + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NRF_NFM) + + SWITCH(message->h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + + if (message->res_status == OGS_SBI_HTTP_STATUS_OK || + message->res_status == OGS_SBI_HTTP_STATUS_CREATED) { + smf_nnrf_handle_nf_register(nf_instance, message); + OGS_FSM_TRAN(s, &smf_nf_state_registered); + } else { + ogs_error("HTTP Response Status Code [%d]", + message->res_status); + OGS_FSM_TRAN(s, &smf_nf_state_exception); + } + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message->h.resource.name); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", message->h.service.name); + END + break; + + case SMF_EVT_SBI_TIMER: + switch(e->timer_id) { + case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + client = nf_instance->client; + ogs_assert(client); + addr = client->addr; + ogs_assert(addr); + + ogs_warn("Retry to registration with NRF [%s]", nf_instance->id); + + ogs_timer_start(nf_instance->t_registration_interval, + smf_timer_cfg(SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)-> + duration); + + smf_sbi_send_nf_register(nf_instance); + break; + + default: + ogs_error("Unknown timer[%s:%d]", + smf_timer_get_name(e->timer_id), e->timer_id); + } + break; + + default: + ogs_error("Unknown event %s", smf_event_get_name(e)); + break; + } +} + +void smf_nf_state_registered(ogs_fsm_t *s, smf_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); + + smf_sm_debug(e); + + nf_instance = e->sbi.data; + ogs_assert(nf_instance); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + client = nf_instance->client; + ogs_assert(client); + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + ogs_info("NF registered [%s]", nf_instance->id); + + if (nf_instance->time.heartbeat) { + ogs_timer_start(nf_instance->t_heartbeat_interval, + ogs_time_from_sec(nf_instance->time.heartbeat)); + ogs_timer_start(nf_instance->t_heartbeat, + ogs_time_from_sec(nf_instance->time.heartbeat * + OGS_SBI_HEARTBEAT_RETRYCOUNT)); + } + + smf_sbi_send_nf_status_subscribe(client, + smf_self()->nf_type, nf_instance->id); + } + + break; + + case OGS_FSM_EXIT_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + ogs_info("NF de-registered [%s]", nf_instance->id); + + if (nf_instance->time.heartbeat) { + ogs_timer_stop(nf_instance->t_heartbeat_interval); + ogs_timer_stop(nf_instance->t_heartbeat); + } + + smf_sbi_send_nf_de_register(nf_instance); + } + break; + + case SMF_EVT_SBI_CLIENT: + message = e->sbi.message; + ogs_assert(message); + + SWITCH(message->h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NRF_NFM) + + SWITCH(message->h.resource.name) + 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) + ogs_timer_start(nf_instance->t_heartbeat, + ogs_time_from_sec(nf_instance->time.heartbeat * + OGS_SBI_HEARTBEAT_RETRYCOUNT)); + } else { + ogs_error("HTTP response error : %d", message->res_status); + } + + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + message->h.resource.name); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", message->h.service.name); + END + break; + + case SMF_EVT_SBI_TIMER: + switch(e->timer_id) { + case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + if (nf_instance->time.heartbeat) { + ogs_timer_start(nf_instance->t_heartbeat_interval, + ogs_time_from_sec(nf_instance->time.heartbeat)); + } + + smf_sbi_send_nf_update(nf_instance); + break; + + case SMF_TIMER_NF_INSTANCE_HEARTBEAT: + OGS_FSM_TRAN(s, &smf_nf_state_will_register); + break; + + case SMF_TIMER_NF_INSTANCE_VALIDITY: + if (NF_INSTANCE_IS_OTHERS(nf_instance->id)) { + ogs_info("NF expired [%s]", nf_instance->id); + OGS_FSM_TRAN(s, &smf_nf_state_de_registered); + } + break; + + default: + ogs_error("Unknown timer[%s:%d]", + smf_timer_get_name(e->timer_id), e->timer_id); + break; + } + break; + + default: + ogs_error("Unknown event %s", smf_event_get_name(e)); + break; + } +} + +void smf_nf_state_de_registered(ogs_fsm_t *s, smf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_assert(s); + ogs_assert(e); + + smf_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("NF de-registered [%s]", nf_instance->id); + } + break; + + case OGS_FSM_EXIT_SIG: + break; + + default: + ogs_error("Unknown event %s", smf_event_get_name(e)); + break; + } +} + +void smf_nf_state_exception(ogs_fsm_t *s, smf_event_t *e) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_client_t *client = NULL; + ogs_sockaddr_t *addr = NULL; + ogs_assert(s); + ogs_assert(e); + + smf_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, + smf_timer_cfg(SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)-> + duration); + } + break; + + case OGS_FSM_EXIT_SIG: + if (NF_INSTANCE_IS_SELF(nf_instance->id)) { + ogs_timer_stop(nf_instance->t_registration_interval); + } + break; + + case SMF_EVT_SBI_TIMER: + switch(e->timer_id) { + case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + client = nf_instance->client; + ogs_assert(client); + addr = client->addr; + ogs_assert(addr); + + ogs_warn("Retry to registration with NRF [%s]", nf_instance->id); + + OGS_FSM_TRAN(s, &smf_nf_state_will_register); + break; + + default: + ogs_error("Unknown timer[%s:%d]", + smf_timer_get_name(e->timer_id), e->timer_id); + break; + } + break; + + default: + ogs_error("Unknown event %s", smf_event_get_name(e)); + break; + } +} diff --git a/src/smf/nnrf-build.c b/src/smf/nnrf-build.c new file mode 100644 index 000000000..3bd6f1938 --- /dev/null +++ b/src/smf/nnrf-build.c @@ -0,0 +1,204 @@ +/* + * 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 "nnrf-build.h" + +ogs_sbi_request_t *smf_nnrf_build_nf_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_NRF_NFM; + message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.resource.name = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; + message.h.resource.id = ogs_sbi_self()->nf_instance_id; + + message.http.content_encoding = (char*)ogs_sbi_self()->content_encoding; + + NFProfile = ogs_sbi_nnrf_build_nf_profile(nf_instance); + ogs_assert(NFProfile); + + NFProfile->heart_beat_timer = nf_instance->time.heartbeat; + + message.NFProfile = NFProfile; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + ogs_sbi_nnrf_free_nf_profile(NFProfile); + + return request; +} + +ogs_sbi_request_t *smf_nnrf_build_nf_update(ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + OpenAPI_list_t *PatchItemList; + OpenAPI_patch_item_t item; + + ogs_assert(nf_instance); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_PATCH; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NRF_NFM; + message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.resource.name = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; + message.h.resource.id = ogs_sbi_self()->nf_instance_id; + message.http.content_type = (char *)OGS_SBI_CONTENT_PATCH_TYPE; + + PatchItemList = OpenAPI_list_create(); + ogs_assert(PatchItemList); + + memset(&item, 0, sizeof(item)); + item.op = OpenAPI_patch_operation_replace; + item.path = (char *)"/nfStatus"; + item.value = OpenAPI_nf_status_ToString(OpenAPI_nf_status_REGISTERED); + + OpenAPI_list_add(PatchItemList, &item); + + message.PatchItemList = PatchItemList; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + OpenAPI_list_free(PatchItemList); + + return request; +} + +ogs_sbi_request_t *smf_nnrf_build_nf_de_register( + ogs_sbi_nf_instance_t *nf_instance) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_assert(nf_instance); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NRF_NFM; + message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.resource.name = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; + message.h.resource.id = nf_instance->id; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + return request; +} + +ogs_sbi_request_t *smf_nnrf_build_nf_status_subscribe( + ogs_sbi_subscription_t *subscription) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + ogs_sbi_server_t *server = NULL; + + OpenAPI_subscription_data_t *SubscriptionData = NULL; + + ogs_assert(subscription); + ogs_assert(subscription->nf_type); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NRF_NFM; + message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.resource.name = (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS; + + SubscriptionData = ogs_calloc(1, sizeof(*SubscriptionData)); + ogs_assert(SubscriptionData); + + server = ogs_list_first(&ogs_sbi_self()->server_list); + ogs_assert(server); + + SubscriptionData->nf_status_notification_uri = ogs_sbi_server_uri(server, + OGS_SBI_SERVICE_NAME_NRF_NFM, OGS_SBI_API_VERSION, + OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY, NULL); + ogs_assert(SubscriptionData->nf_status_notification_uri); + + SubscriptionData->req_nf_type = subscription->nf_type; + SubscriptionData->req_nf_instance_id = subscription->nf_instance_id; + + message.SubscriptionData = SubscriptionData; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + ogs_free(SubscriptionData->nf_status_notification_uri); + ogs_free(SubscriptionData); + + return request; +} + +ogs_sbi_request_t *smf_nnrf_build_nf_status_unsubscribe( + ogs_sbi_subscription_t *subscription) +{ + ogs_sbi_message_t message; + ogs_sbi_request_t *request = NULL; + + ogs_assert(subscription); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NRF_NFM; + message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.resource.name = (char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS; + message.h.resource.id = subscription->id; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + return request; +} + +ogs_sbi_request_t *smf_nnrf_build_nf_discover( + 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(target_nf_type); + ogs_assert(requester_nf_type); + + memset(&message, 0, sizeof(message)); + message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; + message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NRF_DISC; + message.h.api.version = (char *)OGS_SBI_API_VERSION; + message.h.resource.name = (char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES; + + message.param.target_nf_type = target_nf_type; + message.param.requester_nf_type = requester_nf_type; + + request = ogs_sbi_build_request(&message); + ogs_assert(request); + + return request; +} diff --git a/src/smf/nnrf-build.h b/src/smf/nnrf-build.h new file mode 100644 index 000000000..a2a62fc96 --- /dev/null +++ b/src/smf/nnrf-build.h @@ -0,0 +1,49 @@ +/* + * 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 SMF_NNRF_BUILD_H +#define SMF_NNRF_BUILD_H + +#include "ogs-sbi.h" +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ogs_sbi_request_t *smf_nnrf_build_nf_register( + ogs_sbi_nf_instance_t *nf_instance); +ogs_sbi_request_t *smf_nnrf_build_nf_update( + ogs_sbi_nf_instance_t *nf_instance); +ogs_sbi_request_t *smf_nnrf_build_nf_de_register( + ogs_sbi_nf_instance_t *nf_instance); + +ogs_sbi_request_t *smf_nnrf_build_nf_status_subscribe( + ogs_sbi_subscription_t *subscription); +ogs_sbi_request_t *smf_nnrf_build_nf_status_unsubscribe( + ogs_sbi_subscription_t *subscription); + +ogs_sbi_request_t *smf_nnrf_build_nf_discover( + OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NNRF_BUILD_H */ diff --git a/src/smf/nnrf-handler.c b/src/smf/nnrf-handler.c new file mode 100644 index 000000000..810c1e11c --- /dev/null +++ b/src/smf/nnrf-handler.c @@ -0,0 +1,282 @@ +/* + * 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 "sbi-path.h" +#include "nnrf-handler.h" + +void smf_nnrf_handle_nf_register( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_message_t *message) +{ + OpenAPI_nf_profile_t *NFProfile = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(message); + ogs_assert(nf_instance); + client = nf_instance->client; + ogs_assert(client); + + NFProfile = message->NFProfile; + if (!NFProfile) { + ogs_error("No NFProfile"); + return; + } + + /* TIME : Update heartbeat from NRF */ + nf_instance->time.heartbeat = NFProfile->heart_beat_timer; +} + +void smf_nnrf_handle_nf_status_subscribe( + ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message) +{ + OpenAPI_subscription_data_t *SubscriptionData = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(message); + ogs_assert(subscription); + client = subscription->client; + ogs_assert(client); + + SubscriptionData = message->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) { + struct timeval tv; + struct tm local, next; + ogs_time_t diff, duration; + if (ogs_strptime(SubscriptionData->validity_time, + OGS_TIME_ISO8601_FORMAT, &next)) { + ogs_gettimeofday(&tv); + ogs_localtime(tv.tv_sec, &local); + diff = ogs_mktime(&next) - ogs_mktime(&local); +#define VALIDITY_MARGIN 5 /* 5 seconds */ +#define VALIDITY_MINIMUM 60 /* 60 seconds */ + duration = diff - (int)VALIDITY_MARGIN; + + if (duration < (int)VALIDITY_MINIMUM) { + ogs_warn("Validation period [%d seconds, %s] is too small", + (int)diff, SubscriptionData->validity_time); + duration = VALIDITY_MINIMUM; + ogs_warn("Forced to %d seconds", VALIDITY_MINIMUM); + } + + subscription->t_validity = ogs_timer_add(smf_self()->timer_mgr, + smf_timer_subscription_validity, subscription); + ogs_assert(subscription->t_validity); + ogs_timer_start( + subscription->t_validity, ogs_time_from_sec(duration)); + } + } +} + +bool smf_nnrf_handle_nf_status_notify(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message) +{ + ogs_sbi_response_t *response = NULL; + OpenAPI_notification_data_t *NotificationData = NULL; + OpenAPI_nf_profile_t *NFProfile = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + bool handled; + + ogs_assert(session); + ogs_assert(message); + + NotificationData = message->NotificationData; + if (!NotificationData) { + ogs_error("No NotificationData"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No NotificationData", NULL); + return false; + } + + NFProfile = NotificationData->nf_profile; + if (!NFProfile) { + ogs_error("No NFProfile"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No NFProfile", NULL); + return false; + } + + if (!NFProfile->nf_instance_id) { + ogs_error("No NFProfile.NFInstanceId"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No NFProfile", "NFInstanceId"); + return false; + } + + if (!NFProfile->nf_instance_id) { + ogs_error("No NFProfile.NFInstanceId"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "No NFProfile", "NFInstanceId"); + return false; + } + + if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) { + ogs_error("The notification is not allowed [%s]", + NFProfile->nf_instance_id); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN, + message, "The notification is not allowed", + NFProfile->nf_instance_id); + return false; + } + + if (NotificationData->event == + OpenAPI_notification_event_type_NF_REGISTERED) { + ogs_sbi_client_t *client = NULL; + + 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); + smf_nf_fsm_init(nf_instance); + + client = ogs_sbi_nf_instance_find_client(nf_instance); + if (!client) { + ogs_error("Cannot find client [%s]", nf_instance->id); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "Cannot find client", nf_instance->id); + return false; + } + smf_sbi_nf_associate_client(nf_instance, client); + + ogs_info("(NRF-notify) NF registered [%s]", nf_instance->id); + } else + ogs_warn("(NRF-notify) NF [%s] has already been added", + NFProfile->nf_instance_id); + + handled = ogs_sbi_nnrf_handle_nf_profile( + nf_instance, NFProfile, session, message); + if (!handled) return false; + + ogs_info("(NRF-notify) NF Profile updated [%s]", nf_instance->id); + + + } else if (NotificationData->event == + OpenAPI_notification_event_type_NF_DEREGISTERED) { + nf_instance = ogs_sbi_nf_instance_find(NFProfile->nf_instance_id); + if (nf_instance) { + ogs_info("(NRF-notify) NF de-registered [%s]", nf_instance->id); + smf_nf_fsm_fini(nf_instance); + ogs_sbi_nf_instance_remove(nf_instance); + + /* FIXME : Remove unnecessary Client */ + } else + ogs_warn("(NRF-notify) NF [%s] has already been removed", + NFProfile->nf_instance_id); + } 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(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + message, "Not supported event", + eventstr ? eventstr : "Unknown"); + return false; + } + + response = ogs_sbi_build_response(message); + ogs_assert(response); + ogs_sbi_server_send_response(session, response, + OGS_SBI_HTTP_STATUS_NO_CONTENT); + + return true; +} + +void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message) +{ + OpenAPI_search_result_t *SearchResult = NULL; + OpenAPI_lnode_t *node = NULL; + bool handled; + + ogs_assert(message); + + SearchResult = message->SearchResult; + if (!SearchResult) { + ogs_error("No SearchResult"); + return; + } + + OpenAPI_list_for_each(SearchResult->nf_instances, node) { + OpenAPI_nf_profile_t *NFProfile = NULL; + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_client_t *client = 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); + smf_nf_fsm_init(nf_instance); + + client = ogs_sbi_nf_instance_find_client(nf_instance); + if (!client) { + ogs_error("Cannot find client [%s]", nf_instance->id); + continue; + } + smf_sbi_nf_associate_client(nf_instance, client); + + ogs_info("(NF-Discover) NF registered [%s]", nf_instance->id); + } else + ogs_warn("(NF-Discover) NF [%s] 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); + continue; + } + + client = ogs_sbi_nf_instance_find_client(nf_instance); + if (!client) { + ogs_error("Cannot find client [%s]", nf_instance->id); + continue; + } + smf_sbi_nf_associate_client(nf_instance, client); + + /* TIME : Update validity from NRF */ + if (SearchResult->validity_period) { + nf_instance->time.validity = SearchResult->validity_period; + + ogs_assert(nf_instance->t_validity); + ogs_timer_start(nf_instance->t_validity, + ogs_time_from_sec(nf_instance->time.validity)); + + } else + ogs_warn("NF Instance validity-time should not 0"); + + ogs_info("(NF-Discover) NF Profile updated [%s]", nf_instance->id); + } + } +} diff --git a/src/smf/nnrf-handler.h b/src/smf/nnrf-handler.h new file mode 100644 index 000000000..ed000cb96 --- /dev/null +++ b/src/smf/nnrf-handler.h @@ -0,0 +1,44 @@ +/* + * 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 SMF_NNRF_HANDLER_H +#define SMF_NNRF_HANDLER_H + +#include "ogs-sbi.h" +#include "context.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void smf_nnrf_handle_nf_register( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_message_t *message); +void smf_nnrf_handle_nf_status_subscribe( + ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *message); + +bool smf_nnrf_handle_nf_status_notify(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_message_t *message); + +void smf_nnrf_handle_nf_discover(ogs_sbi_message_t *message); + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_NNRF_HANDLER_H */ diff --git a/src/smf/pfcp-path.c b/src/smf/pfcp-path.c index 1e13665de..65955d942 100644 --- a/src/smf/pfcp-path.c +++ b/src/smf/pfcp-path.c @@ -31,7 +31,7 @@ static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_assoicate) if (try_to_assoicate == true) { node->t_association = ogs_timer_add(smf_self()->timer_mgr, - smf_timer_association, node); + smf_timer_pfcp_association, node); ogs_assert(node->t_association); } @@ -110,7 +110,7 @@ static void pfcp_recv_cb(short when, ogs_socket_t fd, void *data) rv = ogs_queue_push(smf_self()->queue, e); if (rv != OGS_OK) { - ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_warn("ogs_queue_push() failed:%d", (int)rv); ogs_pkbuf_free(e->pkbuf); smf_event_free(e); } diff --git a/src/smf/pfcp-sm.c b/src/smf/pfcp-sm.c index 6a059b7bc..ec06b7f13 100644 --- a/src/smf/pfcp-sm.c +++ b/src/smf/pfcp-sm.c @@ -18,9 +18,7 @@ */ #include "context.h" -#include "event.h" #include "timer.h" -#include "smf-sm.h" #include "pfcp-path.h" #include "n4-handler.h" @@ -43,7 +41,7 @@ void smf_pfcp_state_initial(ogs_fsm_t *s, smf_event_t *e) ogs_assert(rv == OGS_OK); node->t_heartbeat = ogs_timer_add(smf_self()->timer_mgr, - smf_timer_heartbeat, node); + smf_timer_pfcp_heartbeat, node); ogs_assert(node->t_heartbeat); OGS_FSM_TRAN(s, &smf_pfcp_state_will_associate); @@ -87,7 +85,7 @@ void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e) case OGS_FSM_ENTRY_SIG: if (node->t_association) { ogs_timer_start(node->t_association, - smf_timer_cfg(SMF_TIMER_ASSOCIATION)->duration); + smf_timer_cfg(SMF_TIMER_PFCP_ASSOCIATION)->duration); smf_pfcp_send_association_setup_request(node); } @@ -101,7 +99,7 @@ void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e) case SMF_EVT_N4_TIMER: switch(e->timer_id) { - case SMF_TIMER_ASSOCIATION: + case SMF_TIMER_PFCP_ASSOCIATION: node = e->pfcp_node; ogs_assert(node); @@ -110,7 +108,7 @@ void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e) ogs_assert(node->t_association); ogs_timer_start(node->t_association, - smf_timer_cfg(SMF_TIMER_ASSOCIATION)->duration); + smf_timer_cfg(SMF_TIMER_PFCP_ASSOCIATION)->duration); smf_pfcp_send_association_setup_request(node); break; @@ -174,7 +172,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e) case OGS_FSM_ENTRY_SIG: ogs_info("PFCP associated"); ogs_timer_start(node->t_heartbeat, - smf_timer_cfg(SMF_TIMER_HEARTBEAT)->duration); + smf_timer_cfg(SMF_TIMER_PFCP_HEARTBEAT)->duration); break; case OGS_FSM_EXIT_SIG: ogs_info("PFCP de-associated"); @@ -229,7 +227,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e) break; case SMF_EVT_N4_TIMER: switch(e->timer_id) { - case SMF_TIMER_HEARTBEAT: + case SMF_TIMER_PFCP_HEARTBEAT: node = e->pfcp_node; ogs_assert(node); diff --git a/src/smf/sbi-path.c b/src/smf/sbi-path.c new file mode 100644 index 000000000..2661c2ccc --- /dev/null +++ b/src/smf/sbi-path.c @@ -0,0 +1,199 @@ +/* + * 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 "context.h" +#include "sbi-path.h" + +static int server_cb(ogs_sbi_server_t *server, + ogs_sbi_session_t *session, ogs_sbi_request_t *request) +{ + smf_event_t *e = NULL; + int rv; + + ogs_assert(session); + ogs_assert(request); + + e = smf_event_new(SMF_EVT_SBI_SERVER); + ogs_assert(e); + + e->sbi.server = server; + e->sbi.session = session; + e->sbi.request = request; + + rv = ogs_queue_push(smf_self()->queue, e); + if (rv != OGS_OK) { + ogs_warn("ogs_queue_push() failed:%d", (int)rv); + smf_event_free(e); + return OGS_ERROR; + } + + return OGS_OK; +} + +static int client_cb(ogs_sbi_response_t *response, void *data) +{ + smf_event_t *e = NULL; + int rv; + + ogs_assert(response); + + e = smf_event_new(SMF_EVT_SBI_CLIENT); + ogs_assert(e); + e->sbi.response = response; + e->sbi.data = data; + + rv = ogs_queue_push(smf_self()->queue, e); + if (rv != OGS_OK) { + ogs_warn("ogs_queue_push() failed:%d", (int)rv); + smf_event_free(e); + return OGS_ERROR; + } + + return OGS_OK; +} + +int smf_sbi_open(void) +{ + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_sbi_server_start_all(server_cb); + + ogs_list_for_each(&ogs_sbi_self()->client_list, client) { + ogs_sbi_nf_service_t *service = NULL; + + nf_instance = ogs_sbi_nf_instance_build_default( + smf_self()->nf_type, client); + ogs_assert(nf_instance); + + service = ogs_sbi_nf_service_build_default(nf_instance, + (char*)OGS_SBI_SERVICE_NAME_SMF_PDUSESSION, client); + ogs_assert(service); + ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_VERSION, + (char*)OGS_SBI_API_FULL_VERSION, NULL); + + smf_sbi_nf_associate_client(nf_instance, client); + smf_nf_fsm_init(nf_instance); + } + + return OGS_OK; +} + +void smf_sbi_close(void) +{ + ogs_sbi_server_stop_all(); +} + +void smf_sbi_nf_associate_client( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_client_t *client) +{ + ogs_assert(nf_instance); + ogs_assert(client); + + OGS_SETUP_SBI_CLIENT(nf_instance, client); + client->cb = client_cb; +} + +void smf_sbi_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_build_nf_register(nf_instance); + ogs_assert(request); + ogs_sbi_client_send_request(client, request, nf_instance); +} + +void smf_sbi_send_nf_update(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_build_nf_update(nf_instance); + ogs_assert(request); + ogs_sbi_client_send_request(client, request, nf_instance); +} + +void smf_sbi_send_nf_de_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_build_nf_de_register(nf_instance); + ogs_assert(request); + ogs_sbi_client_send_request(client, request, nf_instance); +} + +void smf_sbi_send_nf_status_subscribe(ogs_sbi_client_t *client, + OpenAPI_nf_type_e nf_type, char *nf_instance_id) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_subscription_t *subscription = NULL; + + ogs_assert(client); + + subscription = ogs_sbi_subscription_add(); + ogs_assert(subscription); + subscription->client = client; + subscription->nf_type = nf_type; + if (nf_instance_id) + subscription->nf_instance_id = ogs_strdup(nf_instance_id); + + request = smf_nnrf_build_nf_status_subscribe(subscription); + ogs_assert(request); + ogs_sbi_client_send_request(client, request, subscription); +} + +void smf_sbi_send_nf_status_unsubscribe(ogs_sbi_subscription_t *subscription) +{ + ogs_sbi_request_t *request = NULL; + ogs_sbi_client_t *client = NULL; + + ogs_assert(subscription); + client = subscription->client; + ogs_assert(client); + + request = smf_nnrf_build_nf_status_unsubscribe(subscription); + ogs_assert(request); + ogs_sbi_client_send_request(client, request, subscription); +} + +void smf_sbi_send_nf_discover(ogs_sbi_client_t *client, + OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type) +{ + ogs_sbi_request_t *request = NULL; + + ogs_assert(client); + + request = smf_nnrf_build_nf_discover(target_nf_type, requester_nf_type); + ogs_assert(request); + ogs_sbi_client_send_request(client, request, NULL); +} diff --git a/src/smf/sbi-path.h b/src/smf/sbi-path.h new file mode 100644 index 000000000..66e20861f --- /dev/null +++ b/src/smf/sbi-path.h @@ -0,0 +1,51 @@ +/* + * 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 SMF_SBI_PATH_H +#define SMF_SBI_PATH_H + +#include "nnrf-build.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int smf_sbi_open(void); +void smf_sbi_close(void); + +void smf_sbi_nf_associate_client( + ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_client_t *client); + +void smf_sbi_send_nf_register(ogs_sbi_nf_instance_t *nf_instance); +void smf_sbi_send_nf_update(ogs_sbi_nf_instance_t *nf_instance); +void smf_sbi_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance); + +void smf_sbi_send_nf_status_subscribe(ogs_sbi_client_t *client, + OpenAPI_nf_type_e nf_type, char *nf_instance_id); +void smf_sbi_send_nf_status_unsubscribe(ogs_sbi_subscription_t *subscription); + +void smf_sbi_send_nf_discover(ogs_sbi_client_t *client, + OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type); + + +#ifdef __cplusplus +} +#endif + +#endif /* SMF_SBI_PATH_H */ diff --git a/src/smf/smf-sm.c b/src/smf/smf-sm.c index c8c5b5277..a95074c76 100644 --- a/src/smf/smf-sm.c +++ b/src/smf/smf-sm.c @@ -17,14 +17,14 @@ * along with this program. If not, see . */ -#include "smf-sm.h" #include "context.h" -#include "event.h" #include "gtp-path.h" #include "fd-path.h" #include "pfcp-path.h" +#include "sbi-path.h" #include "s5c-handler.h" #include "gx-handler.h" +#include "nnrf-handler.h" void smf_state_initial(ogs_fsm_t *s, smf_event_t *e) { @@ -58,6 +58,15 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) ogs_pfcp_xact_t *pfcp_xact = NULL; ogs_pfcp_message_t pfcp_message; + ogs_sbi_server_t *server = NULL; + ogs_sbi_session_t *session = NULL; + ogs_sbi_request_t *sbi_request = NULL; + + ogs_sbi_nf_instance_t *nf_instance = NULL; + ogs_sbi_subscription_t *subscription = NULL; + ogs_sbi_response_t *sbi_response = NULL; + ogs_sbi_message_t sbi_message; + smf_sm_debug(e); ogs_assert(s); @@ -73,11 +82,17 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) if (rv != OGS_OK) { ogs_fatal("Can't establish N4-PFCP path"); } + + rv = smf_sbi_open(); + if (rv != OGS_OK) { + ogs_fatal("Can't establish SBI path"); + } break; case OGS_FSM_EXIT_SIG: smf_gtp_close(); smf_pfcp_close(); + smf_sbi_close(); break; case SMF_EVT_S5C_MESSAGE: @@ -155,7 +170,6 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) case SMF_EVT_GX_MESSAGE: ogs_assert(e); - recvbuf = e->pkbuf; ogs_assert(recvbuf); gx_message = (ogs_diam_gx_message_t *)recvbuf->data; @@ -228,12 +242,219 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) break; case SMF_EVT_N4_TIMER: case SMF_EVT_N4_NO_HEARTBEAT: + ogs_assert(e); pfcp_node = e->pfcp_node; ogs_assert(pfcp_node); ogs_assert(OGS_FSM_STATE(&pfcp_node->sm)); ogs_fsm_dispatch(&pfcp_node->sm, e); break; + + case SMF_EVT_SBI_SERVER: + sbi_request = e->sbi.request; + ogs_assert(sbi_request); + session = e->sbi.session; + ogs_assert(session); + server = e->sbi.server; + ogs_assert(server); + + rv = ogs_sbi_parse_request(&sbi_message, sbi_request); + if (rv != OGS_OK) { + /* 'sbi_message' buffer is released in ogs_sbi_parse_request() */ + ogs_error("cannot parse HTTP sbi_message"); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + NULL, "cannot parse HTTP sbi_message", NULL); + break; + } + + if (strcmp(sbi_message.h.api.version, OGS_SBI_API_VERSION) != 0) { + ogs_error("Not supported version [%s]", sbi_message.h.api.version); + ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_BAD_REQUEST, + &sbi_message, "Not supported version", NULL); + ogs_sbi_message_free(&sbi_message); + break; + } + + SWITCH(sbi_message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NRF_NFM) + + SWITCH(sbi_message.h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY) + SWITCH(sbi_message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + smf_nnrf_handle_nf_status_notify( + server, session, &sbi_message); + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", + sbi_message.h.method); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, + &sbi_message, + "Invalid HTTP method", sbi_message.h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message.h.resource.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &sbi_message, + "Unknown resource name", sbi_message.h.resource.name); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", sbi_message.h.service.name); + ogs_sbi_server_send_error(session, + OGS_SBI_HTTP_STATUS_MEHTOD_NOT_ALLOWED, &sbi_message, + "Invalid API name", sbi_message.h.resource.name); + END + + /* In lib/sbi/server.c, notify_completed() releases 'request' buffer. */ + ogs_sbi_message_free(&sbi_message); + break; + + case SMF_EVT_SBI_CLIENT: + ogs_assert(e); + + sbi_response = e->sbi.response; + ogs_assert(sbi_response); + rv = ogs_sbi_parse_response(&sbi_message, sbi_response); + if (rv != OGS_OK) { + ogs_error("cannot parse HTTP response"); + ogs_sbi_message_free(&sbi_message); + ogs_sbi_response_free(sbi_response); + break; + } + + if (strcmp(sbi_message.h.api.version, OGS_SBI_API_VERSION) != 0) { + ogs_error("Not supported version [%s]", sbi_message.h.api.version); + ogs_sbi_message_free(&sbi_message); + ogs_sbi_response_free(sbi_response); + break; + } + + SWITCH(sbi_message.h.service.name) + CASE(OGS_SBI_SERVICE_NAME_NRF_NFM) + + SWITCH(sbi_message.h.resource.name) + 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 = &sbi_message; + ogs_fsm_dispatch(&nf_instance->sm, e); + + if (OGS_FSM_CHECK(&nf_instance->sm, smf_nf_state_exception)) { + ogs_error("State machine exception"); + } + break; + + CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) + subscription = e->sbi.data; + ogs_assert(subscription); + + SWITCH(sbi_message.h.method) + CASE(OGS_SBI_HTTP_METHOD_POST) + if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_CREATED || + sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) { + smf_nnrf_handle_nf_status_subscribe( + subscription, &sbi_message); + } else { + ogs_error("HTTP response error : %d", + sbi_message.res_status); + } + break; + + CASE(OGS_SBI_HTTP_METHOD_DELETE) + if (sbi_message.res_status == + OGS_SBI_HTTP_STATUS_NO_CONTENT) { + ogs_sbi_subscription_remove(subscription); + } else { + ogs_error("HTTP response error : %d", + sbi_message.res_status); + } + break; + + DEFAULT + ogs_error("Invalid HTTP method [%s]", sbi_message.h.method); + END + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message.h.resource.name); + END + break; + + CASE(OGS_SBI_SERVICE_NAME_NRF_DISC) + SWITCH(sbi_message.h.resource.name) + CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) + if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) { + smf_nnrf_handle_nf_discover(&sbi_message); + } else { + ogs_error("HTTP response error : %d", + sbi_message.res_status); + } + break; + + DEFAULT + ogs_error("Invalid resource name [%s]", + sbi_message.h.resource.name); + END + break; + + DEFAULT + ogs_error("Invalid API name [%s]", sbi_message.h.service.name); + END + + ogs_sbi_message_free(&sbi_message); + ogs_sbi_response_free(sbi_response); + break; + + case SMF_EVT_SBI_TIMER: + ogs_assert(e); + + switch(e->timer_id) { + case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + case SMF_TIMER_NF_INSTANCE_HEARTBEAT: + case SMF_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, smf_nf_state_de_registered)) { + smf_nf_fsm_fini(nf_instance); + ogs_sbi_nf_instance_remove(nf_instance); + + } else if (OGS_FSM_CHECK(&nf_instance->sm, + smf_nf_state_exception)) { + ogs_error("State machine exception"); + } + break; + + case SMF_TIMER_SUBSCRIPTION_VALIDITY: + subscription = e->sbi.data; + ogs_assert(subscription); + + ogs_info("Subscription validity expired [%s]", subscription->id); + ogs_sbi_subscription_remove(subscription); + + smf_sbi_send_nf_status_subscribe(subscription->client, + smf_self()->nf_type, subscription->nf_instance_id); + break; + + default: + ogs_error("Unknown timer[%s:%d]", + smf_timer_get_name(e->timer_id), e->timer_id); + } + break; + default: ogs_error("No handler for event %s", smf_event_get_name(e)); break; diff --git a/src/smf/smf-sm.h b/src/smf/smf-sm.h index 7b80e4478..d769a536d 100644 --- a/src/smf/smf-sm.h +++ b/src/smf/smf-sm.h @@ -31,6 +31,16 @@ void smf_state_final(ogs_fsm_t *s, smf_event_t *e); void smf_state_operational(ogs_fsm_t *s, smf_event_t *e); void smf_state_exception(ogs_fsm_t *s, smf_event_t *e); +void smf_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance); +void smf_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance); + +void smf_nf_state_initial(ogs_fsm_t *s, smf_event_t *e); +void smf_nf_state_final(ogs_fsm_t *s, smf_event_t *e); +void smf_nf_state_will_register(ogs_fsm_t *s, smf_event_t *e); +void smf_nf_state_registered(ogs_fsm_t *s, smf_event_t *e); +void smf_nf_state_de_registered(ogs_fsm_t *s, smf_event_t *e); +void smf_nf_state_exception(ogs_fsm_t *s, smf_event_t *e); + void smf_pfcp_state_initial(ogs_fsm_t *s, smf_event_t *e); void smf_pfcp_state_final(ogs_fsm_t *s, smf_event_t *e); void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e); diff --git a/src/smf/timer.c b/src/smf/timer.c index 02030790c..7c1210834 100644 --- a/src/smf/timer.c +++ b/src/smf/timer.c @@ -22,10 +22,12 @@ #include "context.h" static smf_timer_cfg_t g_smf_timer_cfg[MAX_NUM_OF_SMF_TIMER] = { - [SMF_TIMER_ASSOCIATION] = + [SMF_TIMER_PFCP_ASSOCIATION] = { .duration = ogs_time_from_sec(12) }, - [SMF_TIMER_HEARTBEAT] = + [SMF_TIMER_PFCP_HEARTBEAT] = { .duration = ogs_time_from_sec(12) }, + [SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] = + { .duration = ogs_time_from_sec(3) }, }; smf_timer_cfg_t *smf_timer_cfg(smf_timer_e id) @@ -37,10 +39,20 @@ smf_timer_cfg_t *smf_timer_cfg(smf_timer_e id) const char *smf_timer_get_name(smf_timer_e id) { switch (id) { - case SMF_TIMER_ASSOCIATION: - return "SMF_TIMER_ASSOCIATION"; - case SMF_TIMER_HEARTBEAT: - return "SMF_TIMER_HEARTBEAT"; + case SMF_TIMER_PFCP_ASSOCIATION: + return "SMF_TIMER_PFCP_ASSOCIATION"; + case SMF_TIMER_PFCP_HEARTBEAT: + return "SMF_TIMER_PFCP_HEARTBEAT"; + case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + return "SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL"; + case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + return "SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL"; + case SMF_TIMER_NF_INSTANCE_HEARTBEAT: + return "SMF_TIMER_NF_INSTANCE_HEARTBEAT"; + case SMF_TIMER_NF_INSTANCE_VALIDITY: + return "SMF_TIMER_NF_INSTANCE_VALIDITY"; + case SMF_TIMER_SUBSCRIPTION_VALIDITY: + return "SMF_TIMER_SUBSCRIPTION_VALIDITY"; default: break; } @@ -54,23 +66,69 @@ static void timer_send_event(int timer_id, void *data) smf_event_t *e = NULL; ogs_assert(data); - e = smf_event_new(SMF_EVT_N4_TIMER); - e->timer_id = timer_id; - e->pfcp_node = data; + switch (timer_id) { + case SMF_TIMER_PFCP_ASSOCIATION: + case SMF_TIMER_PFCP_HEARTBEAT: + e = smf_event_new(SMF_EVT_N4_TIMER); + ogs_assert(e); + e->timer_id = timer_id; + e->pfcp_node = data; + break; + case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL: + case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL: + case SMF_TIMER_NF_INSTANCE_HEARTBEAT: + case SMF_TIMER_NF_INSTANCE_VALIDITY: + case SMF_TIMER_SUBSCRIPTION_VALIDITY: + e = smf_event_new(SMF_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(smf_self()->queue, e); if (rv != OGS_OK) { - ogs_warn("ogs_queue_push() failed:%d", (int)rv); + ogs_warn("ogs_queue_push() failed [%d] in %s", + (int)rv, smf_timer_get_name(e->timer_id)); smf_event_free(e); } } -void smf_timer_association(void *data) +void smf_timer_pfcp_association(void *data) { - timer_send_event(SMF_TIMER_ASSOCIATION, data); + timer_send_event(SMF_TIMER_PFCP_ASSOCIATION, data); } -void smf_timer_heartbeat(void *data) +void smf_timer_pfcp_heartbeat(void *data) { - timer_send_event(SMF_TIMER_HEARTBEAT, data); + timer_send_event(SMF_TIMER_PFCP_HEARTBEAT, data); +} + +void smf_timer_nf_instance_registration_interval(void *data) +{ + timer_send_event(SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL, data); +} + +void smf_timer_nf_instance_heartbeat_interval(void *data) +{ + timer_send_event(SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, data); +} + +void smf_timer_nf_instance_heartbeat(void *data) +{ + timer_send_event(SMF_TIMER_NF_INSTANCE_HEARTBEAT, data); +} + +void smf_timer_nf_instance_validity(void *data) +{ + timer_send_event(SMF_TIMER_NF_INSTANCE_VALIDITY, data); +} + +void smf_timer_subscription_validity(void *data) +{ + timer_send_event(SMF_TIMER_SUBSCRIPTION_VALIDITY, data); } diff --git a/src/smf/timer.h b/src/smf/timer.h index 852480e23..c39c51009 100644 --- a/src/smf/timer.h +++ b/src/smf/timer.h @@ -30,8 +30,14 @@ extern "C" { typedef enum { SMF_TIMER_BASE = 0, - SMF_TIMER_ASSOCIATION, - SMF_TIMER_HEARTBEAT, + SMF_TIMER_PFCP_ASSOCIATION, + SMF_TIMER_PFCP_HEARTBEAT, + + SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL, + SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, + SMF_TIMER_NF_INSTANCE_HEARTBEAT, + SMF_TIMER_NF_INSTANCE_VALIDITY, + SMF_TIMER_SUBSCRIPTION_VALIDITY, MAX_NUM_OF_SMF_TIMER, @@ -46,8 +52,14 @@ smf_timer_cfg_t *smf_timer_cfg(smf_timer_e id); const char *smf_timer_get_name(smf_timer_e id); -void smf_timer_association(void *data); -void smf_timer_heartbeat(void *data); +void smf_timer_pfcp_association(void *data); +void smf_timer_pfcp_heartbeat(void *data); + +void smf_timer_nf_instance_registration_interval(void *data); +void smf_timer_nf_instance_heartbeat_interval(void *data); +void smf_timer_nf_instance_heartbeat(void *data); +void smf_timer_nf_instance_validity(void *data); +void smf_timer_subscription_validity(void *data); #ifdef __cplusplus } diff --git a/src/upf/context.c b/src/upf/context.c index 0731285e5..61ebca455 100644 --- a/src/upf/context.c +++ b/src/upf/context.c @@ -26,7 +26,7 @@ int __upf_log_domain; static OGS_POOL(upf_sess_pool, upf_sess_t); static OGS_POOL(upf_sdf_filter_pool, upf_sdf_filter_t); -static int context_initiaized = 0; +static int context_initialized = 0; int num_sessions = 0; void stats_add_session(void) { @@ -43,7 +43,7 @@ void stats_remove_session(void) { void upf_context_init(void) { - ogs_assert(context_initiaized == 0); + ogs_assert(context_initialized == 0); /* Initialize UPF context */ memset(&self, 0, sizeof(upf_context_t)); @@ -68,12 +68,12 @@ void upf_context_init(void) self.ipv4_hash = ogs_hash_make(); self.ipv6_hash = ogs_hash_make(); - context_initiaized = 1; + context_initialized = 1; } void upf_context_final(void) { - ogs_assert(context_initiaized == 1); + ogs_assert(context_initialized == 1); upf_sess_remove_all(); @@ -92,7 +92,7 @@ void upf_context_final(void) ogs_gtp_node_final(); ogs_pfcp_gtpu_resource_remove_all(&self.gtpu_resource_list); - context_initiaized = 0; + context_initialized = 0; } upf_context_t *upf_self(void) diff --git a/src/upf/event.c b/src/upf/event.c index 284c17775..c29bde4d7 100644 --- a/src/upf/event.c +++ b/src/upf/event.c @@ -20,6 +20,23 @@ #include "event.h" #include "context.h" +#if defined(HAVE_KQUEUE) +/* + * kqueue does not support TUN/TAP character device + * So, PGW should use select action in I/O multiplexing + */ +extern const ogs_pollset_actions_t ogs_select_actions; + +extern ogs_pollset_actions_t ogs_pollset_actions; +extern bool ogs_pollset_actions_initialized; + +static void pollset_action_setup(void) +{ + ogs_pollset_actions = ogs_select_actions; + ogs_pollset_actions_initialized = true; +} +#endif + #define EVENT_POOL 32 /* FIXME : 32 */ static OGS_POOL(pool, upf_event_t); @@ -27,6 +44,10 @@ void upf_event_init(void) { ogs_pool_init(&pool, EVENT_POOL); +#if defined(HAVE_KQUEUE) + pollset_action_setup(); +#endif + upf_self()->queue = ogs_queue_create(EVENT_POOL); ogs_assert(upf_self()->queue); upf_self()->timer_mgr = ogs_timer_mgr_create(); @@ -59,6 +80,8 @@ upf_event_t *upf_event_new(upf_event_e id) ogs_pool_alloc(&pool, &e); ogs_assert(e); + memset(e, 0, sizeof(*e)); + e->id = id; return e; diff --git a/src/upf/pfcp-path.c b/src/upf/pfcp-path.c index 3d862cbbb..9649a7cd2 100644 --- a/src/upf/pfcp-path.c +++ b/src/upf/pfcp-path.c @@ -110,7 +110,7 @@ static void pfcp_recv_cb(short when, ogs_socket_t fd, void *data) rv = ogs_queue_push(upf_self()->queue, e); if (rv != OGS_OK) { - ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_warn("ogs_queue_push() failed:%d", (int)rv); ogs_pkbuf_free(e->pkbuf); upf_event_free(e); } diff --git a/tests/core/abts-main.c b/tests/core/abts-main.c index bc9a6baf4..aa6c187c7 100644 --- a/tests/core/abts-main.c +++ b/tests/core/abts-main.c @@ -37,6 +37,7 @@ abts_suite *test_poll(abts_suite *suite); abts_suite *test_tlv(abts_suite *suite); abts_suite *test_fsm(abts_suite *suite); abts_suite *test_hash(abts_suite *suite); +abts_suite *test_uuid(abts_suite *suite); const struct testlist { abts_suite *(*func)(abts_suite *suite); @@ -58,6 +59,7 @@ const struct testlist { {test_tlv}, {test_fsm}, {test_hash}, + {test_uuid}, {NULL}, }; diff --git a/tests/core/meson.build b/tests/core/meson.build index 1a80fd565..155b553ec 100644 --- a/tests/core/meson.build +++ b/tests/core/meson.build @@ -33,6 +33,7 @@ testcore_sources = files(''' tlv-test.c fsm-test.c hash-test.c + uuid-test.c abts-main.c '''.split()) diff --git a/tests/core/uuid-test.c b/tests/core/uuid-test.c new file mode 100644 index 000000000..6b0f4beb5 --- /dev/null +++ b/tests/core/uuid-test.c @@ -0,0 +1,58 @@ +/* + * 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 "ogs-core.h" +#include "core/abts.h" + +static void uuid_test1(abts_case *tc, void *data) +{ + ogs_uuid_t uuid; + ogs_uuid_t uuid2; + char buf[OGS_UUID_FORMATTED_LENGTH + 1]; + + ogs_uuid_get(&uuid); + ogs_uuid_format(buf, &uuid); + + ogs_uuid_parse(&uuid2, buf); + ABTS_ASSERT(tc, "parse produced a different UUID", + memcmp(&uuid, &uuid2, sizeof(uuid)) == 0); +} + +static void uuid_test2(abts_case *tc, void *data) +{ + ogs_uuid_t uuid; + ogs_uuid_t uuid2; + + /* generate two of them quickly */ + ogs_uuid_get(&uuid); + ogs_uuid_get(&uuid2); + + ABTS_ASSERT(tc, "generated the same UUID twice", + memcmp(&uuid, &uuid2, sizeof(uuid)) != 0); +} + +abts_suite *test_uuid(abts_suite *suite) +{ + suite = ADD_SUITE(suite) + + abts_run_test(suite, uuid_test1, NULL); + abts_run_test(suite, uuid_test2, NULL); + + return suite; +} diff --git a/tests/cups/abts-main.c b/tests/cups/abts-main.c index adafb3cc3..d592c8a7f 100644 --- a/tests/cups/abts-main.c +++ b/tests/cups/abts-main.c @@ -30,6 +30,7 @@ const struct testlist { {NULL}, }; +static ogs_thread_t *nrf_thread = NULL; static ogs_thread_t *pcrf_thread = NULL; static ogs_thread_t *upf_thread = NULL; static ogs_thread_t *smf_thread = NULL; @@ -49,6 +50,7 @@ static void terminate(void) if (smf_thread) ogs_thread_destroy(smf_thread); if (upf_thread) ogs_thread_destroy(upf_thread); if (pcrf_thread) ogs_thread_destroy(pcrf_thread); + if (nrf_thread) ogs_thread_destroy(nrf_thread); pcscf_fd_final(); @@ -67,6 +69,7 @@ static void initialize(const char *const argv[]) rv = ogs_app_initialize(NULL, argv); ogs_assert(rv == OGS_OK); + nrf_thread = test_child_create("nrf", argv); pcrf_thread = test_child_create("pcrf", argv); upf_thread = test_child_create("upf", argv); smf_thread = test_child_create("smf", argv); diff --git a/tests/unit/abts-main.c b/tests/unit/abts-main.c index 4e8977053..400d21ae0 100644 --- a/tests/unit/abts-main.c +++ b/tests/unit/abts-main.c @@ -22,6 +22,7 @@ abts_suite *test_s1ap_message(abts_suite *suite); abts_suite *test_nas_message(abts_suite *suite); abts_suite *test_gtp_message(abts_suite *suite); +abts_suite *test_sbi_message(abts_suite *suite); abts_suite *test_security(abts_suite *suite); abts_suite *test_crash(abts_suite *suite); @@ -31,6 +32,7 @@ const struct testlist { {test_s1ap_message}, {test_nas_message}, {test_gtp_message}, + {test_sbi_message}, {test_security}, {test_crash}, {NULL}, diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 8bd9304b4..c0fee43f2 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -20,13 +20,14 @@ testunit_sources = files(''' s1ap-message-test.c nas-message-test.c gtp-message-test.c + sbi-message-test.c security-test.c crash-test.c '''.split()) testunit_exe = executable('unit', sources : testunit_sources, - c_args : testcore_cc_flags, - dependencies : libtestapp_dep) + c_args : [testcore_cc_flags, sbi_cc_flags], + dependencies : [libtestapp_dep, libsbi_dep]) test('unit', testunit_exe, is_parallel : false, suite: 'unit') diff --git a/tests/unit/sbi-message-test.c b/tests/unit/sbi-message-test.c new file mode 100644 index 000000000..5a847250f --- /dev/null +++ b/tests/unit/sbi-message-test.c @@ -0,0 +1,356 @@ +/* + * 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 "test-app.h" + +#include "ogs-sbi.h" + +static void sbi_message_test1(abts_case *tc, void *data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *entry; + + OpenAPI_nf_profile_t *nf_profile1; + OpenAPI_nf_profile_t *nf_profile2; + + OpenAPI_udr_info_t *udr_info1; + OpenAPI_udr_info_t *udr_info2; + + OpenAPI_identity_range_t *identity_range1; + OpenAPI_identity_range_t *identity_range2; + + OpenAPI_plmn_id_t plmn_id1[3]; + OpenAPI_plmn_id_t *plmn_id2; + + char *nsi; + + nf_profile1 = ogs_calloc(1, sizeof(*nf_profile1)); + ABTS_PTR_NOTNULL(tc, nf_profile1); + nf_profile1->nf_instance_id = "NF_INSTANCE_ID"; + nf_profile1->nf_type = OpenAPI_nf_type_SMF; + nf_profile1->nf_status = OpenAPI_nf_status_REGISTERED; + + memset(plmn_id1, 0, sizeof(plmn_id1)); + + nf_profile1->plmn_list = OpenAPI_list_create(); + ABTS_PTR_NOTNULL(tc, nf_profile1->plmn_list); + + plmn_id1[0].mcc = "111"; + plmn_id1[0].mnc = "222"; + OpenAPI_list_add(nf_profile1->plmn_list, &plmn_id1[0]); + plmn_id1[1].mcc = "333"; + plmn_id1[1].mnc = "444"; + OpenAPI_list_add(nf_profile1->plmn_list, &plmn_id1[1]); + plmn_id1[2].mcc = "555"; + plmn_id1[2].mnc = "666"; + OpenAPI_list_add(nf_profile1->plmn_list, &plmn_id1[2]); + + nf_profile1->nsi_list = OpenAPI_list_create(); + OpenAPI_list_add(nf_profile1->nsi_list, "aaa"); + OpenAPI_list_add(nf_profile1->nsi_list, "bbbbb"); + + nf_profile1->priority = 30; + + udr_info1 = nf_profile1->udr_info = ogs_calloc(1, sizeof(*udr_info1)); + ABTS_PTR_NOTNULL(tc, udr_info1); + udr_info1->group_id = "group"; + + udr_info1->supi_ranges = OpenAPI_list_create(); + ABTS_PTR_NOTNULL(tc, udr_info1->supi_ranges); + + udr_info1->gpsi_ranges = OpenAPI_list_create(); + ABTS_PTR_NOTNULL(tc, udr_info1->gpsi_ranges); + + identity_range1 = ogs_calloc(1, sizeof(*identity_range1)); + ABTS_PTR_NOTNULL(tc, identity_range1); + identity_range1->start = "1"; + identity_range1->end = "9"; + OpenAPI_list_add(udr_info1->gpsi_ranges, identity_range1); + + item = OpenAPI_nf_profile_convertToJSON(nf_profile1); + ABTS_PTR_NOTNULL(tc, item); + +#if 0 + { + char *str = cJSON_Print(item); + printf("%s", str); + ogs_free(str); + } +#endif + + nf_profile2 = OpenAPI_nf_profile_parseFromJSON(item); + ABTS_PTR_NOTNULL(tc, nf_profile2); + + ABTS_STR_EQUAL(tc, + nf_profile1->nf_instance_id, nf_profile2->nf_instance_id); + ABTS_INT_EQUAL(tc, nf_profile1->nf_type, nf_profile2->nf_type); + ABTS_INT_EQUAL(tc, nf_profile1->nf_status, nf_profile2->nf_status); + + ABTS_PTR_NOTNULL(tc, nf_profile2->plmn_list); + + entry = nf_profile2->plmn_list->first; + ABTS_PTR_NOTNULL(tc, entry); + plmn_id2 = entry->data; + ABTS_PTR_NOTNULL(tc, plmn_id2); + ABTS_STR_EQUAL(tc, "111", plmn_id2->mcc); + ABTS_STR_EQUAL(tc, "222", plmn_id2->mnc); + + entry = entry->next; + ABTS_PTR_NOTNULL(tc, entry); + plmn_id2 = entry->data; + ABTS_PTR_NOTNULL(tc, plmn_id2); + ABTS_STR_EQUAL(tc, "333", plmn_id2->mcc); + ABTS_STR_EQUAL(tc, "444", plmn_id2->mnc); + + entry = entry->next; + ABTS_PTR_NOTNULL(tc, entry); + plmn_id2 = entry->data; + ABTS_PTR_NOTNULL(tc, plmn_id2); + ABTS_STR_EQUAL(tc, "555", plmn_id2->mcc); + ABTS_STR_EQUAL(tc, "666", plmn_id2->mnc); + + entry = entry->next; + ABTS_PTR_EQUAL(tc, NULL, entry); + + entry = nf_profile2->nsi_list->first; + ABTS_PTR_NOTNULL(tc, entry); + nsi = entry->data; + ABTS_PTR_NOTNULL(tc, nsi); + ABTS_STR_EQUAL(tc, "aaa", nsi); + + entry = entry->next; + ABTS_PTR_NOTNULL(tc, entry); + nsi = entry->data; + ABTS_PTR_NOTNULL(tc, nsi); + ABTS_STR_EQUAL(tc, "bbbbb", nsi); + + ABTS_INT_EQUAL(tc, 30, nf_profile2->priority); + + udr_info2 = nf_profile2->udr_info; + ABTS_PTR_NOTNULL(tc, udr_info2); + ABTS_STR_EQUAL(tc, "group", udr_info2->group_id); + + ABTS_PTR_NOTNULL(tc, udr_info2->supi_ranges); + ABTS_INT_EQUAL(tc, 0, udr_info2->supi_ranges->count); + + ABTS_PTR_NOTNULL(tc, udr_info2->gpsi_ranges); + entry = udr_info2->gpsi_ranges->first; + ABTS_PTR_NOTNULL(tc, entry); + identity_range2 = entry->data; + ABTS_PTR_NOTNULL(tc, identity_range2); + ABTS_STR_EQUAL(tc, "1", identity_range2->start); + ABTS_STR_EQUAL(tc, "9", identity_range2->end); + + ogs_free(identity_range1); + + OpenAPI_list_free(udr_info1->gpsi_ranges); + OpenAPI_list_free(udr_info1->supi_ranges); + ogs_free(udr_info1); + + OpenAPI_list_free(nf_profile1->plmn_list); + OpenAPI_list_free(nf_profile1->nsi_list); + ogs_free(nf_profile1); + + cJSON_Delete(item); + + OpenAPI_nf_profile_free(nf_profile2); +} + +static void sbi_message_test2(abts_case *tc, void *data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *entry; + + OpenAPI_nf_group_cond_t *nf_group_cond1; + OpenAPI_nf_group_cond_t *nf_group_cond2; + + OpenAPI_smf_info_t *smf_info1; + OpenAPI_smf_info_t *smf_info2; + OpenAPI_access_type_e access_type; + + nf_group_cond1 = ogs_calloc(1, sizeof(*nf_group_cond1)); + ABTS_PTR_NOTNULL(tc, nf_group_cond1); + nf_group_cond1->nf_type = OpenAPI_nf_group_cond_NFTYPE_UDR; + nf_group_cond1->nf_group_id = "group"; + + item = OpenAPI_nf_group_cond_convertToJSON(nf_group_cond1); + ABTS_PTR_NOTNULL(tc, item); + + ogs_free(nf_group_cond1); + +#if 0 + { + char *str = cJSON_Print(item); + printf("%s", str); + ogs_free(str); + } +#endif + + nf_group_cond2 = OpenAPI_nf_group_cond_parseFromJSON(item); + ABTS_PTR_NOTNULL(tc, nf_group_cond2); + + ABTS_STR_EQUAL(tc, + nf_group_cond1->nf_group_id, nf_group_cond2->nf_group_id); + ABTS_INT_EQUAL(tc, OpenAPI_nf_group_cond_NFTYPE_UDR, nf_group_cond2->nf_type); + + cJSON_Delete(item); + + OpenAPI_nf_group_cond_free(nf_group_cond2); + + smf_info1 = ogs_calloc(1, sizeof(*smf_info1)); + ABTS_PTR_NOTNULL(tc, smf_info1); + smf_info1->s_nssai_smf_info_list = OpenAPI_list_create(); + smf_info1->pgw_fqdn = "PGW_FQDN"; + smf_info1->access_type = OpenAPI_list_create(); + ABTS_PTR_NOTNULL(tc, smf_info1->access_type); + + OpenAPI_list_add(smf_info1->access_type, + (void*)OpenAPI_access_type_3GPP_ACCESS); + OpenAPI_list_add(smf_info1->access_type, + (void*)OpenAPI_access_type_NON_3GPP_ACCESS); + item = OpenAPI_smf_info_convertToJSON(smf_info1); + ABTS_PTR_NOTNULL(tc, item); + +#if 0 + { + char *str = cJSON_Print(item); + printf("%s", str); + ogs_free(str); + } +#endif + + smf_info2 = OpenAPI_smf_info_parseFromJSON(item); + ABTS_PTR_NOTNULL(tc, smf_info2); + + ABTS_STR_EQUAL(tc, + smf_info1->pgw_fqdn, smf_info2->pgw_fqdn); + ABTS_PTR_NOTNULL(tc, smf_info2->s_nssai_smf_info_list); + ABTS_INT_EQUAL(tc, smf_info1->s_nssai_smf_info_list->count, + smf_info2->s_nssai_smf_info_list->count); + ABTS_PTR_NOTNULL(tc, smf_info2->access_type); + ABTS_INT_EQUAL(tc, smf_info1->access_type->count, + smf_info2->access_type->count); + + entry = smf_info2->access_type->first; + ABTS_PTR_NOTNULL(tc, entry); + access_type = (OpenAPI_access_type_e)entry->data; + ABTS_INT_EQUAL(tc, OpenAPI_access_type_3GPP_ACCESS, access_type); + + entry = entry->next; + ABTS_PTR_NOTNULL(tc, entry); + access_type = (OpenAPI_access_type_e)entry->data; + ABTS_INT_EQUAL(tc, OpenAPI_access_type_NON_3GPP_ACCESS, access_type); + + OpenAPI_list_free(smf_info1->s_nssai_smf_info_list); + OpenAPI_list_free(smf_info1->access_type); + ogs_free(smf_info1); + + cJSON_Delete(item); + + OpenAPI_smf_info_free(smf_info2); +} + +static void sbi_message_test3(abts_case *tc, void *data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *entry; + + OpenAPI_nrf_info_t *nrf_info1; + OpenAPI_nrf_info_t *nrf_info2; + + OpenAPI_map_t *served_pcf_info1 = NULL; + OpenAPI_map_t *served_pcf_info2 = NULL; + OpenAPI_pcf_info_t *pcf_info1; + OpenAPI_pcf_info_t *pcf_info2; + + pcf_info1 = ogs_calloc(1, sizeof(*pcf_info1)); + ABTS_PTR_NOTNULL(tc, pcf_info1); + pcf_info1->group_id = "pcf_group_id"; + pcf_info2 = ogs_calloc(1, sizeof(*pcf_info2)); + ABTS_PTR_NOTNULL(tc, pcf_info2); + pcf_info2->group_id = "pcf_group_id2"; + + served_pcf_info1 = OpenAPI_map_create("nfInstanceId", pcf_info1); + ABTS_PTR_NOTNULL(tc, served_pcf_info1); + served_pcf_info2 = OpenAPI_map_create("nfInstanceId2", pcf_info2); + ABTS_PTR_NOTNULL(tc, served_pcf_info2); + + nrf_info1 = ogs_calloc(1, sizeof(*nrf_info1)); + ABTS_PTR_NOTNULL(tc, nrf_info1); + + nrf_info1->served_pcf_info = OpenAPI_list_create(); + ABTS_PTR_NOTNULL(tc, nrf_info1->served_pcf_info); + OpenAPI_list_add(nrf_info1->served_pcf_info, served_pcf_info1); + OpenAPI_list_add(nrf_info1->served_pcf_info, served_pcf_info2); + + item = OpenAPI_nrf_info_convertToJSON(nrf_info1); + ABTS_PTR_NOTNULL(tc, item); + +#if 0 + { + char *str = cJSON_Print(item); + printf("%s", str); + ogs_free(str); + } +#endif + + OpenAPI_map_free(served_pcf_info1); + OpenAPI_map_free(served_pcf_info2); + ogs_free(pcf_info1); + ogs_free(pcf_info2); + OpenAPI_list_free(nrf_info1->served_pcf_info); + ogs_free(nrf_info1); + + nrf_info2 = OpenAPI_nrf_info_parseFromJSON(item); + ABTS_PTR_NOTNULL(tc, nrf_info2); + + ABTS_INT_EQUAL(tc, nrf_info1->served_pcf_info->count, + nrf_info2->served_pcf_info->count); + + entry = nrf_info2->served_pcf_info->first; + ABTS_PTR_NOTNULL(tc, entry); + served_pcf_info1 = entry->data; + ABTS_PTR_NOTNULL(tc, served_pcf_info1); + ABTS_STR_EQUAL(tc, served_pcf_info1->key, "nfInstanceId"); + pcf_info1 = served_pcf_info1->value; + ABTS_PTR_NOTNULL(tc, pcf_info1); + ABTS_STR_EQUAL(tc, pcf_info1->group_id, "pcf_group_id"); + + entry = entry->next; + ABTS_PTR_NOTNULL(tc, entry); + served_pcf_info1 = entry->data; + ABTS_STR_EQUAL(tc, served_pcf_info1->key, "nfInstanceId2"); + pcf_info1 = served_pcf_info1->value; + ABTS_PTR_NOTNULL(tc, pcf_info1); + ABTS_STR_EQUAL(tc, pcf_info1->group_id, "pcf_group_id2"); + + cJSON_Delete(item); + OpenAPI_nrf_info_free(nrf_info2); +} + +abts_suite *test_sbi_message(abts_suite *suite) +{ + suite = ADD_SUITE(suite) + + abts_run_test(suite, sbi_message_test1, NULL); + abts_run_test(suite, sbi_message_test2, NULL); + abts_run_test(suite, sbi_message_test3, NULL); + + return suite; +}